From d7ccaa19467cd4281989ac2f59ee2f20acbdc4e1 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 1 Apr 2016 16:54:59 +0200 Subject: Set a CSP on the webmail, website/wiki and list manager. --- roles/wiki/files/etc/nginx/sites-available/website | 6 ++++-- roles/wiki/files/etc/nginx/sites-available/wiki | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'roles/wiki/files/etc/nginx/sites-available') diff --git a/roles/wiki/files/etc/nginx/sites-available/website b/roles/wiki/files/etc/nginx/sites-available/website index 43cdd05..e372aa8 100644 --- a/roles/wiki/files/etc/nginx/sites-available/website +++ b/roles/wiki/files/etc/nginx/sites-available/website @@ -6,7 +6,6 @@ server { server_name www.fripost.org; include snippets/acme-challenge.conf; - include snippets/headers.conf; access_log /var/log/nginx/www.access.log; error_log /var/log/nginx/www.error.log info; @@ -25,13 +24,16 @@ server { server_name www.fripost.org; include snippets/ssl.conf; - include snippets/headers.conf; ssl_certificate /etc/nginx/ssl/www.fripost.org.pem; ssl_certificate_key /etc/nginx/ssl/www.fripost.org.key; access_log /var/log/nginx/www.access.log; error_log /var/log/nginx/www.error.log info; + include snippets/headers.conf; + add_header Content-Security-Policy + "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; font-src 'self'; upgrade-insecure-requests; block-all-mixed-content; reflected-xss block; referrer no-referrer-when-downgrade; frame-ancestors 'none'; form-action 'none'; base-uri fripost.org www.fripost.org"; + location / { try_files $uri $uri/ =404; index index.html; diff --git a/roles/wiki/files/etc/nginx/sites-available/wiki b/roles/wiki/files/etc/nginx/sites-available/wiki index d2be8db..bc44270 100644 --- a/roles/wiki/files/etc/nginx/sites-available/wiki +++ b/roles/wiki/files/etc/nginx/sites-available/wiki @@ -5,7 +5,6 @@ server { server_name wiki.fripost.org; include snippets/acme-challenge.conf; - include snippets/headers.conf; access_log /var/log/nginx/wiki.access.log; error_log /var/log/nginx/wiki.error.log info; @@ -24,13 +23,16 @@ server { server_name wiki.fripost.org; include snippets/ssl.conf; - include snippets/headers.conf; ssl_certificate /etc/nginx/ssl/www.fripost.org.pem; ssl_certificate_key /etc/nginx/ssl/www.fripost.org.key; access_log /var/log/nginx/wiki.access.log; error_log /var/log/nginx/wiki.error.log info; + include snippets/headers.conf; + add_header Content-Security-Policy + "default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; upgrade-insecure-requests; block-all-mixed-content; reflected-xss block; referrer no-referrer-when-downgrade; frame-ancestors 'none'; form-action 'self'; base-uri wiki.fripost.org"; + location / { location ~ ^/website(/.*)?$ { return 302 $scheme://fripost.org$1; } try_files $uri $uri/ =404; -- cgit v1.2.3