summaryrefslogtreecommitdiffstats
path: root/roles/webmail/files/etc/nginx/sites-available/roundcube
diff options
context:
space:
mode:
Diffstat (limited to 'roles/webmail/files/etc/nginx/sites-available/roundcube')
-rw-r--r--roles/webmail/files/etc/nginx/sites-available/roundcube87
1 files changed, 45 insertions, 42 deletions
diff --git a/roles/webmail/files/etc/nginx/sites-available/roundcube b/roles/webmail/files/etc/nginx/sites-available/roundcube
index 8251841..602668f 100644
--- a/roles/webmail/files/etc/nginx/sites-available/roundcube
+++ b/roles/webmail/files/etc/nginx/sites-available/roundcube
@@ -1,73 +1,76 @@
server {
listen 80;
- listen [::]:80 ipv6only=on;
+ listen [::]:80;
- server_name mail.fripost.org;
+ server_name mail.fripost.org;
+ server_name webmail.fripost.org;
- access_log /var/log/nginx/roundcube.access.log;
- error_log /var/log/nginx/roundcube.error.log info;
+ include /etc/lacme/nginx.conf;
- return 301 https://$host$request_uri;
+ access_log /var/log/nginx/roundcube.access.log;
+ error_log /var/log/nginx/roundcube.error.log info;
+
+ location / {
+ return 301 https://$host$request_uri;
+ }
}
server {
- listen 443;
- listen [::]:443 ipv6only=on;
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+
+ server_name mail.fripost.org;
+ server_name webmail.fripost.org;
+
+ root /var/lib/roundcube/public_html;
- server_name mail.fripost.org;
- root /var/lib/roundcube;
+ include snippets/headers.conf;
+ add_header Content-Security-Policy
+ "default-src 'none'; frame-src 'self'; connect-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; frame-ancestors 'self'; form-action 'self'; base-uri mail.fripost.org webmail.fripost.org";
- include ssl/config;
- # include the intermediate certificate, see
- # - https://www.ssllabs.com/ssltest/analyze.html?d=mail.fripost.org
- # - http://nginx.org/en/docs/http/configuring_https_servers.html
- ssl_certificate /etc/nginx/ssl/mail.fripost.org.chained.pem;
- ssl_certificate_key /etc/nginx/ssl/mail.fripost.org.key;
+ include snippets/ssl.conf;
+ ssl_certificate ssl/mail.fripost.org.pem;
+ ssl_certificate_key ssl/mail.fripost.org.key;
+ include snippets/mail.fripost.org.hpkp-hdr;
+
+ gzip on;
+ gzip_static on;
+ gzip_vary on;
+ gzip_min_length 256;
+ gzip_types application/font-woff application/font-woff2 application/javascript application/json application/xml image/svg+xml image/x-icon text/css text/plain text/vcard;
location = /favicon.ico {
- root /usr/share/roundcube/skins/default/images;
+ root /usr/share/roundcube/skins/elastic/images;
log_not_found off;
access_log off;
- expires max;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
- # Deny all attempts to access hidden files, or files under hidden
- # directories.
- location ~ /\. { return 404; }
-
- access_log /var/log/nginx/roundcube.access.log;
- error_log /var/log/nginx/roundcube.error.log info;
+ access_log /var/log/nginx/roundcube.access.log;
+ error_log /var/log/nginx/roundcube.error.log info;
- index index.php;
client_max_body_size 64m;
+ location = / { index index.php; }
location = /index.php {
- include fastcgi/php;
- include fastcgi/php-ssl;
-
- # From /var/lib/roundcube/.htaccess
- fastcgi_param PHP_VALUE "upload_max_filesize=25M
- post_max_size=30M
- memory_limit=64M
- session.gc_maxlifetime=21600
- session.gc_divisor=500
- session.gc_probability=1";
- fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root:/usr/share/roundcube:/etc/roundcube:/var/log/roundcube:/usr/share/php:/usr/share/javascript:/usr/share/tinymce:/usr/share/misc/magic
- upload_tmp_dir=$document_root/temp";
+ # TODO enable gzip for Roundcube >=1.5: it's immune to BREACH attacks once
+ # $config['session_samesite'] is set to 'Strict', see
+ # https://github.com/roundcube/roundcubemail/pull/6772
+ # https://www.sjoerdlangkemper.nl/2016/11/07/current-state-of-breach-attack/#same-site-cookies
+ gzip off;
+ include snippets/fastcgi-php-ssl.conf;
+ fastcgi_pass unix:/var/run/php/php7.4-fpm@roundcube.sock;
}
- # Security rules
- location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
- return 404;
- }
- location ~ ^/(bin|SQL)/ {
- return 404;
+ location ~ "^/(?:plugins|program/js|program/resources|skins)(?:/[[:alnum:]][[:alnum:]\-\._]*)+\.(?:css|eot|gif|html|ico|jpg|js|pdf|png|svg|tiff?|ttf|webp|woff2?)$" {
+ expires 30d;
+ try_files $uri =404;
}
+ location / { internal; }
}