From 992062600133f2558a456202f9be90a571f3f7e3 Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 5 Jan 2021 18:56:37 +0100 Subject: [PATCH] jitsi-post-install.sh: add HTTP secure headers to nginx configuration. --- jitsi-post-install.sh | 59 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/jitsi-post-install.sh b/jitsi-post-install.sh index 20f1deb..b762804 100755 --- a/jitsi-post-install.sh +++ b/jitsi-post-install.sh @@ -1055,7 +1055,64 @@ server { ssl_session_cache shared:SSL:50m; ssl_session_tickets off; - add_header Strict-Transport-Security "max-age=31536000"; + + # ========== + # HTTP security Headers + # ========== + + # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) + # + add_header Strict-Transport-Security "max-age=31536000" always; + + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header X-Content-Type-Options nosniff always; + + add_header Referrer-Policy "strict-origin"; + + # - Geteiltes Dokument öffnen + # + # # Add Etherpad-Lite host to frame-src, so frame-src becomes: + # # + # # #frame-src 'self' https:// https://www.youtube.com ; + # # + # # i.e. etherpad-litehost = epad-01.oopen.de + # # + # frame-src 'self' https://epad-01.oopen.de https://www.youtube.com ; + # + # + # - YouTube-Video teilen + # + # # Add https://www.youtube.com to script-src, so script-src becomes: + # # + # script-src 'self' 'unsafe-inline' https://www.youtube.com ; + # + # # Add https://www.youtube.com to frame-src, so frame-src becomes: + # # + # frame-src 'self' https://meet-ep-pee7eiji-xein9aiy.oopen.de https://www.youtube.com ; + # + # # Add https://img.youtube.com to img-src, so img-src becomes: + # img-src 'self' https://img.youtube.com + # + # + # - Hintergrundschärfe aktivieren: + # + # # Add https://storage.googleapis.com to connect-src, so connect source becomes: + # # + # connect-src 'self' https://storage.googleapis.com; + # + # # Add blob: to script-src, so script-src becomes: + # script-src 'self' 'unsafe-inline' https://www.youtube.com blob: + # + # Note! + # Other directives (like worker-src, or child-src, or..) are falling back to 'default-src'. + # + #add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-inline' https://www.youtube.com ; img-src 'self' https://img.youtube.com ; style-src 'self' 'unsafe-inline' ; font-src 'self'; frame-src 'self' https://epad-01.oopen.de https://www.youtube.com ; object-src 'none'; frame-ancestors 'none'; form-action 'self'; base-uri 'self'; connect-src 'self' https://storage.googleapis.com ; media-src 'self'"; + + add_header Content-Security-Policy "block-all-mixed-content ; default-src 'none'; script-src 'self' 'unsafe-inline' https: blob: ; img-src 'self' https: ; style-src 'self' 'unsafe-inline' ; font-src 'self'; frame-src 'self' https: ; object-src 'none'; frame-ancestors 'none'; form-action 'self'; base-uri 'self'; connect-src 'self' https: ; media-src 'self'"; + + add_header Permissions-Policy "geolocation=();midi=();notifications=();push=();sync-xhr=();microphone=();camera=();magnetometer=();gyroscope=();speaker=(self);vibrate=();fullscreen=(self);payment=();"; + ssl_certificate /var/lib/dehydrated/certs/${FQHN_HOSTNAME}/fullchain.pem; ssl_certificate_key /var/lib/dehydrated/certs/${FQHN_HOSTNAME}/privkey.pem;