v0.1.0
This commit is contained in:
1 parent
cdca612a59
commit
eb25f8de4a
56 files changed
+7848
-4345
No files matched your search
@@ -1,7 +1,57 @@
|
||||
location /postfixadmin/ {
|
||||
proxy_pass http://127.0.0.1:8080/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# PostfixAdmin-RS behind nginx with TLS.
|
||||
# In config.toml set: trusted_proxies = ["127.0.0.1", "::1"], cookie_secure = true, hsts = true
|
||||
#
|
||||
# Serving under a sub-path (e.g. https://mail.example.com/postfixadmin/) also works:
|
||||
# set base_path = "/postfixadmin" in config.toml and use `location /postfixadmin/`
|
||||
# with `proxy_pass http://127.0.0.1:8080;` (no trailing slash).
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name admin.example.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
server_name admin.example.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/admin.example.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/admin.example.com/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
|
||||
client_max_body_size 4m;
|
||||
server_tokens off;
|
||||
|
||||
# Optional: restrict the panel to known networks.
|
||||
# allow 203.0.113.0/24;
|
||||
# deny all;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 90s;
|
||||
}
|
||||
|
||||
# Slow down credential stuffing in addition to the built-in rate limit.
|
||||
location = /api/auth/login {
|
||||
limit_req zone=pa_login burst=5 nodelay;
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# Put this into the http {} block (e.g. /etc/nginx/conf.d/postfixadmin-rs-limits.conf):
|
||||
# limit_req_zone $binary_remote_addr zone=pa_login:10m rate=10r/m;
|
||||
@@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=PostfixAdmin-RS mail administration panel
|
||||
After=network-online.target
|
||||
Documentation=https://github.com/postfixadmin/postfixadmin
|
||||
After=network-online.target mariadb.service mysql.service postgresql.service
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
@@ -10,22 +11,39 @@ Group=postfixadmin
|
||||
WorkingDirectory=/var/lib/postfixadmin-rs
|
||||
Environment=POSTFIXADMIN_RS_CONFIG=/etc/postfixadmin-rs/config.toml
|
||||
EnvironmentFile=-/etc/default/postfixadmin-rs
|
||||
ExecStartPre=/usr/bin/postfixadmin-rs --check-config
|
||||
ExecStart=/usr/bin/postfixadmin-rs
|
||||
Restart=on-failure
|
||||
RestartSec=3s
|
||||
UMask=0077
|
||||
StateDirectory=postfixadmin-rs
|
||||
StateDirectoryMode=0750
|
||||
|
||||
# Hardening. Hooks (doveadm, maildir scripts) run with the same restrictions;
|
||||
# grant write access to additional paths with ReadWritePaths= if a hook needs it,
|
||||
# e.g. ReadWritePaths=/var/lib/rspamd/dkim /etc/rspamd/local.d
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
PrivateDevices=true
|
||||
ProtectHome=true
|
||||
ProtectSystem=true
|
||||
ProtectSystem=full
|
||||
ProtectKernelTunables=true
|
||||
ProtectKernelModules=true
|
||||
ProtectKernelLogs=true
|
||||
ProtectControlGroups=true
|
||||
ProtectClock=true
|
||||
ProtectHostname=true
|
||||
RestrictSUIDSGID=true
|
||||
RestrictNamespaces=true
|
||||
RestrictRealtime=true
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||
LockPersonality=true
|
||||
MemoryDenyWriteExecute=true
|
||||
CapabilityBoundingSet=
|
||||
AmbientCapabilities=
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
SystemCallFilter=~@privileged @resources
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in new issue
Block a user