|
1 | 1 | # Secure Mergin Maps installation |
2 | 2 |
|
3 | 3 | ::: warning |
4 | | -This sections aims to provide some guidelines and a minimalistic example on how to secure a Mergin Maps deployment. |
| 4 | +This sections aims to provide some guidelines and a minimalistic example on how to secure a <MainPlatformName /> deployment. |
5 | 5 |
|
6 | 6 | Further security enhancements should be implemented by experts in accordance to cybersecurity policies in place. |
7 | 7 |
|
8 | 8 | ::: |
9 | | -For security and privacy reasons Mergin Maps deployments should enable HTTPS secured connection via certificate file. |
| 9 | +For security and privacy reasons <MainPlatformName /> deployments should enable HTTPS secured connection via certificate file. |
10 | 10 |
|
11 | 11 | We provide a template configuration file <GitHubRepo id="MerginMaps/server/blob/master/ssl-proxy.conf" desc="ssl-proxy.conf" />as base for your configuration. |
12 | 12 |
|
@@ -35,15 +35,31 @@ Next, you need to point your certificate files to NGINX configuration. This is d |
35 | 35 |
|
36 | 36 | The above example uses automated keys generated by CertBot. For more information, visit [CertBot](https://certbot.eff.org/instructions) website and check how you can generate your own keys. |
37 | 37 |
|
38 | | -Lastly, adjust the provided NGINX `docker compose` deployment file on the <GitHubRepo id="MerginMaps/server/blob/master/docker-compose.yml" desc="proxy service section" /> |
| 38 | +Some extra security settings for HTTP headers are provided. Please review them and update in accordance to your requirements. |
39 | 39 |
|
40 | | -``` shell |
41 | | - - "8080:8080" |
42 | | - volumes: |
43 | | - - ./projects:/data # map data dir to host |
44 | | -- - ./nginx.conf:/etc/nginx/conf.d/default.conf |
45 | | -+ - ./ssl-proxy.conf:/etc/nginx/conf.d/default.conf |
46 | | - - ./logs:/var/log/nginx/ |
47 | | - networks: |
48 | | - - merginmaps |
| 40 | +```shell |
| 41 | + # Prevent crawlers from indexing and following links for all content served from the mergin app |
| 42 | + add_header X-Robots-Tag "none"; |
| 43 | +
|
| 44 | + # Protect against clickjacking iframe |
| 45 | + add_header Content-Security-Policy "frame-ancestors 'self';" always; |
| 46 | +
|
| 47 | + # Add a HSTS policy to prevent plain http from browser |
| 48 | + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; |
| 49 | +
|
| 50 | + # Set cookies security flags |
| 51 | + proxy_cookie_flags ~ secure httponly samesite=strict; |
| 52 | +
|
| 53 | + location / { |
| 54 | + root /var/www/html; |
| 55 | +
|
| 56 | + # The lines below were copied from application proxy |
| 57 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 58 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 59 | + proxy_set_header Host $http_host; |
| 60 | + # we don't want nginx trying to do something clever with |
| 61 | + # redirects, we set the Host: header above already. |
| 62 | + proxy_redirect off; |
| 63 | + proxy_pass http://app_server; |
| 64 | + } |
49 | 65 | ``` |
0 commit comments