PageRenderTime 53ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/documentation/hosting.md

https://gitlab.com/internet-cleanup-foundation/server
Markdown | 133 lines | 81 code | 52 blank | 0 comment | 0 complexity | 89b0992c41dce2f41d906166fbd28407 MD5 | raw file
  1. # WebSecMap server installation and maintenance
  2. ## Introduction
  3. One of the core principles of the WebSecMap project is automation. This is reflected in the server configuration by having almost full configuration management. Setting up a hosted production instance of WebSecMap should be trivial and not require extensive knowledge of involved components (although it will help in troubleshooting).
  4. The following knowledge is _required_ for basic installation:
  5. - Basic Linux experience (using terminal/shell/ssh)
  6. The following knowledge _may_ be needed for advanced maintenance or troubleshooting:
  7. - Linux (Debian)
  8. - Puppet
  9. - Docker
  10. - Nginx
  11. - MySQL
  12. - Python
  13. - Django
  14. - Redis
  15. - Celery
  16. - Git
  17. - Consul
  18. Additionally knowledge of the following related technologies is advised:
  19. - Virtualization/Hosting
  20. - DNS
  21. - Networking
  22. ## Whats in the box
  23. When using this installation method you will end up with a fully featured WebSecMap server including:
  24. - Full websecmap installation with:
  25. - Frontend map website (with https, http/2 and caching)
  26. - Administrative backend (secured by TLS client certificates)
  27. - Workers to automatically perform scanning tasks
  28. - Hardened server (firewall, security updates, etc)
  29. - Monitoring dashboards (Grafana, secured by TLS client certificates)
  30. - SSH for remote access
  31. ## Requirements
  32. To install the fully featured WebSecMap server the following is required:
  33. - Dedicated bare-metal or virtual host with:
  34. - Debian based Linux (Debian 9 or Ubuntu 18.04) clean installed
  35. - 1-2 CPU
  36. - 2-8GB RAM
  37. - 50-100GB disks
  38. - internet connectivity (IPv4 and optional IPv6)
  39. - Terminal access to the host (SSH or via VM console, etc)
  40. - Sudo/root permissions on the host
  41. - DNS A record pointing to the server IPv4 addresses (and optional AAAA record for IPv6). In this document we will use `example.com` as placeholder for the DNS record name you intend to use for the website. Using a subdomain is also possible, eg: `map.example.com`. (optional, highly recommended)
  42. ## Installation
  43. **Warning**: this installation assumes to run on a **clean and dedicated** host for a WebSecMap installation! It will **modify the OS** and take over things like firewalling, Docker, SSH, etc! **Do not run** on a server with existing other software or configuration that you do not want modified!
  44. With that said please follow these instructions to get a WebSecMap instance up and running:
  45. 1. Bring the server up and follow the basic OS (Ubuntu/Debian) installation procedure (if it is not already installed). Configure basic settings (language, keyboard, user) as seen fit and give it a hostname you like (it does not have to match the DNS A record used for the website).
  46. 1. Log in to the server via SSH or VM terminal as `root` user. Or as normal user and sudo to root `sudo su -`.
  47. 1. Run the following command to start installation:
  48. wget -q -O- https://gitlab.com/internet-cleanup-foundation/server/raw/master/install.sh > /install.sh; /bin/bash /install.sh
  49. 1. Grab a Club-Mate (or 2) and wait until everything completes and you are greeted by a rainbow.
  50. 1. You WebSecMap server is now ready, you can visit the frontend at it's public IP address or the domain name (if you have already configured a DNS record).
  51. 1. HTTPS is enabled by default but with a **insecure** self-signed certificate. To properly configure automatic HTTPS using Letsencrypt please use the server tool:
  52. sudo websecmap-server-tool
  53. > Configure domain name / Setup HTTPS
  54. 1. For visiting the administrative backend (https://example.com/admin/) or monitoring (https://example.com/grafana), credentials are required. You can create and manage admin user acces using the server tool:
  55. sudo websecmap-server-tool
  56. > Manage administrative users / SSH access
  57. ## Troubleshooting
  58. If after the installation things don't work as expected please first try the following steps:
  59. Run server provisioning and verify configuration is complete:
  60. 1. Open a terminal (eg: SSH) on the server and become root user (`sudo su -`)
  61. 2. Run provisioning step:
  62. sudo websecmap-server-apply-configuration
  63. 3. This command should provide output similar to this:
  64. Starting server provisioning (showing Puppet catalog compiler warnings (deprecations, etc))
  65. Notice: Scope(Class[Base]): fqdn=faalserver.faalkaart.test, env=hosted, os=Ubuntu 18.04.2 LTS
  66. Notice: Compiled catalog for faalserver.faalkaart.test in environment production in 4.49 seconds
  67. Notice: Applied catalog in 20.51 seconds
  68. Any lines between `Notice: Compiled catalog for...` and `Notice: Applied catalog in...` indicate changes made to the system. If repeated apply commands still keep showing changes made this indicates a problem with provisioning. Please contact the Internet Cleanup Foundation team for further assistance (https://gitlab.com/internet-cleanup-foundation/web-security-map#get-involved).
  69. ## Upgrading
  70. WebSecMap server configuration is split into a _base configuration_ (maintained by Internet Cleanup Foundation at https://gitlab.com/internet-cleanup-foundation/server/) and a _server configuration_ (with customizations for a specific installation).
  71. If new features or bugfixes are developed in the _base configuration_ the server can be updated on demand using the following procedure:
  72. 1. Open a terminal (eg: SSH) on the server and become root user (`sudo su -`)
  73. 1. Run the following command to pull in new changes and apply the configuration:
  74. sudo websecmap-server-update
  75. ## Configuration (advanced)
  76. An initial configuration file (the 'server configuration') is created during installation (see above) and is stored on the server on the path: `/opt/websecmap/server/configuration/settings.yaml`
  77. Aspects of the server can be customized in this file. All available settings and documentation can be found in this configuration file.
  78. After the configuration file has changed, the following command has to be run to apply the new configuration:
  79. sudo websecmap-server-apply-configuration
  80. ## Customization (advanced)
  81. If you want customizations outside of the current possibilities of the configuration. Or want to make custom changes on the server that will not be overwritten by the configuration system (eg: custom firewall rules). Please contact the Internet Cleanup Foundation team for further assistance. Or if you know Puppet feel free to drop a merge-request in the Gitlab repository.