This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| deb13:haconfig [2026/09/12 14:59] – created Bernard Condrau | deb13:haconfig [2026/09/12 15:16] (current) – [Powershell] Bernard Condrau | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== HAProxy Config Files ====== | ====== HAProxy Config Files ====== | ||
| + | ===== HAProxy ===== | ||
| + | < | ||
| + | # 0. Settings | ||
| + | global | ||
| + | log /dev/log local0 | ||
| + | log /dev/log local1 notice | ||
| + | chroot / | ||
| + | user haproxy | ||
| + | group haproxy | ||
| + | daemon | ||
| + | |||
| + | # Modern SSL/TLS security settings for Debian 13 | ||
| + | # Minimum TLS version requirement | ||
| + | ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets | ||
| + | |||
| + | # TLS 1.3 Cipher Suites (handled by ssl-default-bind-ciphersuites) | ||
| + | ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256: | ||
| + | |||
| + | # TLS 1.2 Ciphers (handled by ssl-default-bind-ciphers) | ||
| + | ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256: | ||
| + | |||
| + | # Administrative socket for stats/ | ||
| + | stats socket / | ||
| + | stats timeout 30s | ||
| + | |||
| + | defaults | ||
| + | log | ||
| + | mode tcp | ||
| + | log-format " | ||
| + | timeout connect 5s | ||
| + | timeout client | ||
| + | timeout server | ||
| + | |||
| + | # 1. Public Interface (SNI Router) | ||
| + | frontend public_inbound_http | ||
| + | bind *:80 | ||
| + | mode http | ||
| + | |||
| + | # Deny traffic based on origin | ||
| + | http-request deny if { src -f / | ||
| + | |||
| + | # Redirect all incoming traffic to HTTPS permanently | ||
| + | http-request redirect scheme https code 301 unless { ssl_fc } | ||
| + | |||
| + | frontend public_inbound | ||
| + | bind :443 | ||
| + | mode tcp | ||
| + | | ||
| + | # Deny traffic based on origin | ||
| + | tcp-request connection reject if { src -f / | ||
| + | |||
| + | # Wait for the TLS client hello to parse the SNI extension | ||
| + | tcp-request inspect-delay 5s | ||
| + | tcp-request content accept if { req.ssl_hello_type 1 } | ||
| + | |||
| + | # Define the domains (one line for each) you want to terminate SSL for | ||
| + | acl terminate_ssl req.ssl_sni -i bak.condrau.com | ||
| + | |||
| + | # Route conditionally based on SNI | ||
| + | use_backend http_dispatcher if terminate_ssl | ||
| + | default_backend passthrough_server | ||
| + | |||
| + | # 2. Transparent passthrough for encrypted TLS domains | ||
| + | backend passthrough_server | ||
| + | mode tcp | ||
| + | |||
| + | # downstream server handling its own TLS certificates (Calypso) | ||
| + | server calypso 192.168.3.18: | ||
| + | |||
| + | # 3. Intermediary loopback backend | ||
| + | # This forwards traffic to the Layer 7 (HTTP) processing frontend | ||
| + | backend http_dispatcher | ||
| + | mode tcp | ||
| + | server loopback 127.0.0.1: | ||
| + | |||
| + | # 4. Layer 7 http frontend | ||
| + | # Receives traffic from the loopback, decrypts SSL, and processes HTTP rules | ||
| + | frontend internal_inbound_http | ||
| + | |||
| + | # pass certs directory path so all pem files will be loaded | ||
| + | bind 127.0.0.1: | ||
| + | mode http | ||
| + | |||
| + | # Deny traffic based on origin (host aware) | ||
| + | acl trusted_ip src -f / | ||
| + | acl backuppc hdr(host) -i bak.condrau.com | ||
| + | http-request deny if backuppc !trusted_ip | ||
| + | |||
| + | # Inject headers so backend servers know the original request was HTTPS | ||
| + | http-request set-header X-Forwarded-Proto https | ||
| + | http-request set-header X-Forwarded-Port 443 | ||
| + | http-request set-header X-Forwarded-For %[src] | ||
| + | |||
| + | # Route traffic based on HTTP host headers | ||
| + | use_backend backuppc_server if backuppc | ||
| + | # default_backend backuppc_server | ||
| + | |||
| + | # 5. HTTP backends | ||
| + | backend backuppc_server | ||
| + | mode http | ||
| + | cookie SERVERID insert indirect nocache | ||
| + | server epione 192.168.1.14: | ||
| + | </ | ||
| + | |||
| + | ===== Whitelist ===== | ||
| + | < | ||
| + | # Allow static addresses | ||
| + | 183.88.218.149 | ||
| + | 109.205.169.18 | ||
| + | # Allow dynamic addresses 'dig +short host.mydyndns.org' | ||
| + | 183.88.218.149 | ||
| + | </ | ||
| + | |||
| + | ===== Blacklist ===== | ||
| + | < | ||
| + | # Deny malicious IP addresses | ||
| + | 148.66.10.94 | ||
| + | 5.188.62.0/ | ||
| + | 54.39.29.64 | ||
| + | 185.185.134.115 | ||
| + | 185.46.46.0/ | ||
| + | </ | ||
| + | |||
| + | ===== Powershell ===== | ||
| + | < | ||
| + | # This is an example Powershell file for DuckDNS updater, see https:// | ||
| + | param($domain) | ||
| + | $duckdomain = if (!$domain) { " | ||
| + | $addr = curl.exe -s " | ||
| + | curl.exe -k " | ||
| + | </ | ||
| + | Use it with '' | ||
| + | |||