This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:cockpit [2026/10/10 03:05] – oemb1905 | computing:cockpit [2026/11/12 16:32] (current) – oemb1905 | ||
|---|---|---|---|
| Line 106: | Line 106: | ||
| < | < | ||
| [WebService] | [WebService] | ||
| - | Origins = https://domain.com https://domain.com:9090 | + | AllowUnencrypted = true |
| - | # | + | Address = 0.0.0.0 |
| - | #ProtocolHeader = X-Forwarded-Proto | + | Origins = https://*.haacksnetworking.org http://127.0.0.1:9090 |
| + | ProtocolHeader = X-Forwarded-Proto | ||
| + | ForwardedForHeader = X-Forwarded-For | ||
| </ | </ | ||
| - | This instructs Cockpit' | + | This instructs Cockpit' |
| === Discussion on Access to Cockpit === | === Discussion on Access to Cockpit === | ||
| Line 141: | Line 143: | ||
| * [[https:// | * [[https:// | ||
| - | In conclusion, this tutorial allows for secure web browser access with no browser barf or work arounds. The cert renews on schedule and briefly opens port 80 during that process. If something goes wrong, TLS is ready and secure if ufw or location packages fail. Additionally, | + | In conclusion, this tutorial allows for secure web browser access with no browser barf or work arounds. The cert renews on schedule and briefly opens port 80 during that process. If something goes wrong, TLS is ready and secure if ufw or location packages fail. Additionally, |
| - | --- // | + | < |
| + | nano / | ||
| + | [Definition] | ||
| + | failregex = ^.*cockpit-session\[\d+\]: | ||
| + | ignoreregex = | ||
| + | </ | ||
| + | |||
| + | Now, create the jail: | ||
| + | |||
| + | < | ||
| + | nano / | ||
| + | [cockpit-apache] | ||
| + | enabled | ||
| + | port = http, | ||
| + | filter | ||
| + | backend | ||
| + | journalmatch = _COMM=cockpit-session | ||
| + | logpath | ||
| + | maxretry | ||
| + | </ | ||
| + | |||
| + | When testing, this might help: | ||
| + | |||
| + | fail2ban-client reload --restart --unban cockpit-apache | ||
| + | |||
| + | The pcp logging tool has a cranky timer: | ||
| + | |||
| + | apt install pcp python3-pcp cockpit-bridge | ||
| + | systemctl enable --now pmlogger.service | ||
| + | systemctl enable --now pmlogger_daily.timer | ||
| + | systemctl enable --now pmlogger_check.timer | ||
| + | systemctl restart pmlogger | ||
| + | systemctl status pmlogger_daily.timer | ||
| + | systemctl list-timers | grep pmlogger | ||
| + | systemctl reset-failed pmlogger_daily.service | ||
| + | |||
| + | To increase log retention, open '' | ||
| + | |||
| + | < | ||
| + | $PCP_COMPRESSAFTER=7 | ||
| + | LOCALHOSTNAME | ||
| + | </ | ||
| + | |||
| + | Once that's done, restart the service with '' | ||
| + | |||
| + | < | ||
| + | sudo certbot certonly --standalone \ | ||
| + | -d assist.domain.com \ | ||
| + | --pre-hook " | ||
| + | --post-hook " | ||
| + | |||
| + | sudo nano / | ||
| + | # HTTP → HTTPS | ||
| + | server { | ||
| + | listen 80; | ||
| + | listen [::]:80; | ||
| + | server_name assist.domain.com; | ||
| + | |||
| + | # allow 96.40.208.144; | ||
| + | # allow 2601: | ||
| + | # deny all; | ||
| + | |||
| + | return 301 https:// | ||
| + | } | ||
| + | |||
| + | # HTTPS reverse proxy to Cockpit | ||
| + | server { | ||
| + | listen 443 ssl http2; | ||
| + | listen [::]:443 ssl http2; | ||
| + | server_name assist.domain.com; | ||
| + | |||
| + | ssl_certificate / | ||
| + | ssl_certificate_key / | ||
| + | include / | ||
| + | ssl_dhparam / | ||
| + | |||
| + | add_header Strict-Transport-Security " | ||
| + | |||
| + | # allow 96.40.208.144; | ||
| + | # allow 2601: | ||
| + | # deny all; | ||
| + | |||
| + | location / { | ||
| + | proxy_pass http:// | ||
| + | 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_http_version 1.1; | ||
| + | proxy_set_header Upgrade $http_upgrade; | ||
| + | proxy_set_header Connection " | ||
| + | proxy_buffering off; | ||
| + | proxy_read_timeout 300s; | ||
| + | gzip off; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | sudo ln -s / | ||
| + | sudo nginx -t && sudo systemctl reload nginx | ||
| + | </ | ||
| + | |||
| + | Then, for the fail2ban rule, rewrite it as follows: | ||
| + | |||
| + | < | ||
| + | sudo nano / | ||
| + | [Definition] | ||
| + | failregex = ^< | ||
| + | ignoreregex = | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | sudo nano / | ||
| + | [cockpit-nginx] | ||
| + | enabled | ||
| + | port = http, | ||
| + | filter | ||
| + | logpath | ||
| + | maxretry = 2 | ||
| + | </ | ||
| + | |||
| + | --- // | ||