war.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. .. _installation_war:
  2. Web archive
  3. ===========
  4. GeoServer is packaged as a standalone servlet for use with existing application servers such as `Apache Tomcat <http://tomcat.apache.org/>`_ and `Jetty <http://eclipse.org/jetty/>`_.
  5. .. note:: GeoServer has been mostly tested using Tomcat, and so is the recommended application server. GeoServer requires a newer version of Tomcat (7.0.65 or later) that implements Servlet 3 and annotation processing. Other application servers have been known to work, but are not guaranteed.
  6. Installation
  7. ------------
  8. #. Make sure you have a Java Runtime Environment (JRE) installed on your system. GeoServer requires a **Java 11** or **Java 17** environment,available from `OpenJDK <https://openjdk.java.net>`__, `Adoptium <https://adoptium.net>`__, or provided by your OS distribution.
  9. .. note:: For more information about Java and GeoServer compatibility, please see the section on :ref:`production_java`.
  10. #. Navigate to the :website:`GeoServer Download page <download>`.
  11. #. Select the version of GeoServer that you wish to download. If you're not sure, select :website:`Stable <release/stable>` release.
  12. .. only:: snapshot
  13. These instructions are for GeoServer |version|-SNAPSHOT which is provided as a :website:`Nightly <release/main>` release.
  14. Testing a Nightly release is a great way to try out new features, and test community modules. Nightly releases
  15. change on an ongoing basis and are not suitable for a production environment.
  16. .. only:: not snapshot
  17. These instructions are for GeoServer |release|.
  18. #. Select :guilabel:`Web Archive` on the download page: :download_release:`war`
  19. #. Download and unpack the archive.
  20. #. Deploy the web archive as you would normally. Often, all that is necessary is to copy the :file:`geoserver.war` file to the application server's ``webapps`` directory, and the application will be deployed.
  21. .. note:: A restart of your application server may be necessary.
  22. Tomcat Hardening
  23. ----------------
  24. Hide the Tomcat version in error responses and its error details.
  25. To remove the Tomcat version, create following file with empty parameters
  26. ::
  27. cd $CATALINA_HOME (where Tomcat binaries are installed)
  28. mkdir -p ./lib/org/apache/catalina/util/
  29. cat > ./lib/org/apache/catalina/util/ServerInfo.properties <<EOF
  30. server.info=
  31. server.number=
  32. server.built=
  33. EOF
  34. Additionally add to :file:`server.xml` the ErrorReportValve to disable showReport and showServerInfo. This is used to hide errors handled globally by tomcat in host section.
  35. ``vi ./conf/server.xml``
  36. Add to ``<Host name=...`` section this new ErrorReportValve entry:
  37. ::
  38. ...
  39. <Host name="localhost" appBase="webapps"
  40. unpackWARs="true" autoDeploy="true">
  41. ...
  42. <Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false" />
  43. </Host>
  44. </Engine>
  45. </Service>
  46. </Server>
  47. Why, if security by obscurity does not work?
  48. Even though this is not the final solution, it at least mitigates the visible eye-catcher of outdated software packages.
  49. Let's take the attackers point of view.
  50. Response with just HTTP status:
  51. ::
  52. HTTP Status 400 – Bad Request
  53. Ok, it looks like a Tomcat is installed.
  54. Default full response:
  55. ::
  56. HTTP Status 400 – Bad Request
  57. Type Status Report
  58. Message Invalid URI
  59. Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
  60. Apache Tomcat/7.0.67
  61. Ahh, great, the software is not really maintained. Tomcat is far outdated from Dec. 2015 (6 years old as of today Jan. 2022) with a lot of unfixed vulnerabilities.
  62. Notice: For support reason, the local output of version.sh still outputs the current version
  63. ::
  64. $CATALINA_HOME/bin/version.sh
  65. ...
  66. Server number: 7.0.67
  67. ...
  68. Running
  69. -------
  70. Use your container application's method of starting and stopping webapps to run GeoServer.
  71. To access the :ref:`web_admin`, open a browser and navigate to ``http://SERVER/geoserver`` . For example, with Tomcat running on port 8080 on localhost, the URL would be ``http://localhost:8080/geoserver``.
  72. If you see the GeoServer Welcome page, then GeoServer is successfully installed.
  73. .. figure:: images/success.png
  74. GeoServer Welcome Page
  75. Update
  76. ------
  77. Update regularly at least the container application! And repeat the hardening process.
  78. There are a lot of geoserver installations visible with outdated Tomcat versions.
  79. Uninstallation
  80. --------------
  81. #. Stop the container application.
  82. #. Remove the GeoServer webapp from the container application's ``webapps`` directory. This will usually include the :file:`geoserver.war` file as well as a :file:`geoserver` directory.