From 2c56972be62f6eb41a8d2091d851171f991d97b3 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 27 Jun 2018 15:03:38 +0200 Subject: [PATCH] update changelog and example nginx config --- CHANGELOG.md | 2 ++ docs/example.nginx.conf | 46 ++++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c1c5c256..f8e061afd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ For version 2.4.0 we chose to use our time to address difficulties that some use * We have released new clientside dependencies, so server administrators will need to run `bower update` * This release also depends on new serverside dependencies, so administraotrs will also need to run `npm update` +* Since this release takes advantage of Webworker APIs, administrators will need to update their Content Security Headers to include worker-src (and child-src for safari). + * see cryptpad/docs/example.nginx.conf for more details * Finally, administrators will need to restart their servers after updating, as clients will require new functionality ## What's new diff --git a/docs/example.nginx.conf b/docs/example.nginx.conf index 44b12ade8..afbd86846 100644 --- a/docs/example.nginx.conf +++ b/docs/example.nginx.conf @@ -6,12 +6,11 @@ server { listen 443 ssl http2; + server_name your-main-domain.com your-sandbox-domain.com; - server_name cryptpad.fr www.cryptpad.fr beta.cryptpad.fr; - - ssl_certificate /home/cryptpad/.acme.sh/alpha.cryptpad.fr/fullchain.cer; - ssl_certificate_key /home/cryptpad/.acme.sh/alpha.cryptpad.fr/alpha.cryptpad.fr.key; - ssl_trusted_certificate /home/cryptpad/.acme.sh/alpha.cryptpad.fr/ca.cer; + ssl_certificate /home/cryptpad/.acme.sh/your-main-domain.com/fullchain.cer; + ssl_certificate_key /home/cryptpad/.acme.sh/your-main-domain.com/your-main-domain.com.key; + ssl_trusted_certificate /home/cryptpad/.acme.sh/your-main-domain.com/ca.cer; ssl_dhparam /etc/nginx/dhparam.pem; ssl_session_timeout 5m; @@ -27,6 +26,7 @@ server { root /home/cryptpad/cryptpad; index index.html; + error_page 404 /customize.dist/404.html; if ($args ~ ver=) { set $cacheControl max-age=31536000; @@ -34,25 +34,31 @@ server { # Will not set any header if it is emptystring add_header Cache-Control $cacheControl; - set $styleSrc "'unsafe-inline' 'self'"; - set $scriptSrc "'self'"; - set $connectSrc "'self' wss://cryptpad.fr wss://api.cryptpad.fr"; - set $fontSrc "'self'"; + set $styleSrc "'unsafe-inline' 'self' your-main-domain.com"; + set $scriptSrc "'self' your-main-domain.com"; + set $connectSrc "'self' https://your-main-domain.com wss://your-main-domain.com https://api.your-main-domain.com wss://your-main-domain.com your-main-domain.com blob: your-main-domain.com"; + set $fontSrc "'self' data: your-main-domain.com"; set $imgSrc "data: * blob:"; - set $frameSrc "'self' beta.cryptpad.fr"; - - if ($uri = /pad/inner.html) { - set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline'"; + set $frameSrc "'self' your-sandbox-domain.com blob:"; + set $mediaSrc "* blob:"; + set $childSrc "https://your-main-domain.com"; + set $workerSrc "https://your-main-domain.com"; + + set $unsafe 0; + if ($uri = "/pad/inner.html") { set $unsafe 1; } + if ($host != sandbox.cryptpad.info) { set $unsafe 0; } + if ($unsafe) { + set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline' new2.cryptpad.fr cryptpad.fr"; } - add_header Content-Security-Policy "default-src 'none'; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc;"; + add_header Content-Security-Policy "default-src 'none'; child-src $childSrc; worker-src $workerSrc; media-src $mediaSrc; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc;"; + - location = /cryptpad_websocket { + location ^~ /cryptpad_websocket { proxy_pass http://localhost:3000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; # WebSocket support (nginx 1.4) proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; @@ -72,8 +78,8 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - + } + location ^~ /blob/ { add_header Cache-Control max-age=31536000; try_files $uri =404; @@ -84,11 +90,9 @@ server { try_files $uri =404; } - ## TODO fix in the code so that we don't need this - location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard|file|media)$ { + location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard|file|media|profile|contacts|todo|filepicker|debug|kanban)$ { rewrite ^(.*)$ $1/ redirect; } try_files /www/$uri /www/$uri/index.html /customize/$uri; } -