summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-04-01 16:54:59 +0200
committerGuilhem Moulin <guilhem@fripost.org>2016-04-01 18:05:27 +0200
commitd7ccaa19467cd4281989ac2f59ee2f20acbdc4e1 (patch)
treef66683fd6930fe593713a9a07e015a34a47e5874
parent22562f7dd530aba9b6832f927cf2d5027f41e17d (diff)
Set a CSP on the webmail, website/wiki and list manager.
-rw-r--r--roles/git/files/etc/nginx/sites-available/git4
-rw-r--r--roles/lists/files/etc/nginx/sites-available/sympa6
-rw-r--r--roles/webmail/files/etc/nginx/sites-available/roundcube6
-rw-r--r--roles/wiki/files/etc/nginx/sites-available/website6
-rw-r--r--roles/wiki/files/etc/nginx/sites-available/wiki6
5 files changed, 18 insertions, 10 deletions
diff --git a/roles/git/files/etc/nginx/sites-available/git b/roles/git/files/etc/nginx/sites-available/git
index fbbbb48..ca5555e 100644
--- a/roles/git/files/etc/nginx/sites-available/git
+++ b/roles/git/files/etc/nginx/sites-available/git
@@ -5,7 +5,6 @@ server {
server_name git.fripost.org;
include snippets/acme-challenge.conf;
- include snippets/headers.conf;
access_log /var/log/nginx/git.access.log;
error_log /var/log/nginx/git.error.log info;
@@ -23,13 +22,14 @@ server {
server_name git.fripost.org;
include snippets/ssl.conf;
- include snippets/headers.conf;
ssl_certificate /etc/nginx/ssl/git.fripost.org.pem;
ssl_certificate_key /etc/nginx/ssl/git.fripost.org.key;
access_log /var/log/nginx/git.access.log;
error_log /var/log/nginx/git.error.log info;
+ include snippets/headers.conf;
+
location ^~ /static/ {
alias /usr/share/cgit/;
expires 30d;
diff --git a/roles/lists/files/etc/nginx/sites-available/sympa b/roles/lists/files/etc/nginx/sites-available/sympa
index 7684867..79df229 100644
--- a/roles/lists/files/etc/nginx/sites-available/sympa
+++ b/roles/lists/files/etc/nginx/sites-available/sympa
@@ -5,7 +5,6 @@ server {
server_name lists.fripost.org;
include snippets/acme-challenge.conf;
- include snippets/headers.conf;
access_log /var/log/nginx/lists.access.log;
error_log /var/log/nginx/lists.error.log info;
@@ -25,8 +24,11 @@ server {
access_log /var/log/nginx/lists.access.log;
error_log /var/log/nginx/lists.error.log info;
- include snippets/ssl.conf;
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 lists.fripost.org";
+
+ include snippets/ssl.conf;
ssl_certificate /etc/nginx/ssl/lists.fripost.org.pem;
ssl_certificate_key /etc/nginx/ssl/lists.fripost.org.key;
diff --git a/roles/webmail/files/etc/nginx/sites-available/roundcube b/roles/webmail/files/etc/nginx/sites-available/roundcube
index ee6ff20..f4461ca 100644
--- a/roles/webmail/files/etc/nginx/sites-available/roundcube
+++ b/roles/webmail/files/etc/nginx/sites-available/roundcube
@@ -7,7 +7,6 @@ server {
server_name webmail.fripost.org;
include snippets/acme-challenge.conf;
- include snippets/headers.conf;
access_log /var/log/nginx/roundcube.access.log;
error_log /var/log/nginx/roundcube.error.log info;
@@ -27,8 +26,11 @@ server {
root /var/lib/roundcube;
- include snippets/ssl.conf;
include snippets/headers.conf;
+ add_header Content-Security-Policy
+ "default-src 'none'; child-src 'self'; frame-src 'self'; connect-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; 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 mail.fripost.org webmail.fripost.org";
+
+ include snippets/ssl.conf;
ssl_certificate /etc/nginx/ssl/mail.fripost.org.pem;
ssl_certificate_key /etc/nginx/ssl/mail.fripost.org.key;
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;