UI delivery, stage B: single CSP with optional connect-src origins (OVPMON_CSP_CONNECT_EXTRA)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-07 13:28:30 +03:00
1 parent d38acd74de
commit d5e83eaff5
13 files changed
+211 -17

No files matched your search

+6 -1
View File
@@ -1,7 +1,7 @@
# managed by ovpmon deploy/native (install.sh / update.sh replace this file only while this marker line is present)
#
# HTTPS site of OpenVPN Monitor & Profiler. Rendered by install.sh / update.sh: they fill in the HTTPS port
# (default 8088), the UI directory (/var/www/ovpmon) and the certificate and key paths (/etc/ovpmon/tls/ovpmon.crt
# (default 8088), the extra CSP connect-src origins (default none), the UI directory (/var/www/ovpmon) and the certificate and key paths (/etc/ovpmon/tls/ovpmon.crt
# and .key: self-signed by install.sh; replace them with a real certificate under the same names, or edit this
# file and remove the marker line above so that updates leave it alone).
# Installed to the nginx include directory (Alpine /etc/nginx/http.d, Debian/Ubuntu /etc/nginx/conf.d),
@@ -32,6 +32,11 @@ server {
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "no-referrer" always;
add_header Cache-Control "no-store" always;
# CSP: the bundle is served from this origin only; style-src 'unsafe-inline' is needed by Bootstrap and Chart.js
# (inline style attributes). connect-src: same origin plus the optional origins of another API host
# (install.sh / update.sh --csp-connect-extra, state OVPMON_CSP_CONNECT_EXTRA; the value is filled in
# with its own leading space, so there is none before the placeholder). Same policy as APP_UI/default.conf.template.
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'@CSP_CONNECT_EXTRA@; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml;