This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| deb13:haconfig [2026/09/15 12:39] – Bernard Condrau | deb13:haconfig [2026/10/29 17:30] (current) – Bernard Condrau | ||
|---|---|---|---|
| Line 43: | Line 43: | ||
| log-format " | log-format " | ||
| timeout connect 5s | timeout connect 5s | ||
| - | timeout client | + | timeout client |
| - | timeout server | + | timeout server |
| # 1. Public Interface (SNI Router) | # 1. Public Interface (SNI Router) | ||
| Line 76: | Line 76: | ||
| # Remove once all hosts are terminated here | # Remove once all hosts are terminated here | ||
| acl terminate_ssl req.ssl_sni -i bak.condrau.com | acl terminate_ssl req.ssl_sni -i bak.condrau.com | ||
| + | acl terminate_mail req.ssl_sni -i mail.condrau.com | ||
| # Route conditionally based on SNI | # Route conditionally based on SNI | ||
| use_backend http_dispatcher if terminate_ssl | use_backend http_dispatcher if terminate_ssl | ||
| + | use_backend webmail_server if terminate_mail | ||
| default_backend passthrough_server | default_backend passthrough_server | ||
| Line 90: | Line 92: | ||
| bind quic4@:443 ssl crt / | bind quic4@:443 ssl crt / | ||
| mode http | mode http | ||
| - | http-reuse aggressive | ||
| # Handle Letsencrypt requests | # Handle Letsencrypt requests | ||
| Line 118: | Line 119: | ||
| # downstream server handling its own TLS certificates (Calypso) | # downstream server handling its own TLS certificates (Calypso) | ||
| - | server calypso 192.168.3.18:443 check | + | server calypso 192.168.3.90:443 check |
| + | |||
| + | backend webmail_server | ||
| + | mode tcp | ||
| + | |||
| + | # downstream (synology mail) server handling its own TLS certificates (Merkur) | ||
| + | server merkur 192.168.3.90: | ||
| # 3. Intermediary loopback backend | # 3. Intermediary loopback backend | ||
| Line 133: | Line 140: | ||
| bind 127.0.0.1: | bind 127.0.0.1: | ||
| mode http | mode http | ||
| - | http-reuse aggressive | ||
| # Handle Letsencrypt requests | # Handle Letsencrypt requests | ||
| Line 159: | Line 165: | ||
| backend backuppc_server | backend backuppc_server | ||
| mode http | mode http | ||
| + | http-reuse safe | ||
| cookie SERVERID insert indirect nocache | cookie SERVERID insert indirect nocache | ||
| server epione 192.168.1.50: | server epione 192.168.1.50: | ||
| Line 164: | Line 171: | ||
| backend http_server | backend http_server | ||
| mode http | mode http | ||
| + | http-reuse aggressive | ||
| cookie SERVERID insert indirect nocache | cookie SERVERID insert indirect nocache | ||
| - | server serenity 192.168.3.100: | + | server serenity 192.168.3.100: |
| # 6. stick table that stores IPv4 addresses | # 6. stick table that stores IPv4 addresses | ||
| Line 194: | Line 202: | ||
| * Remove IP address from whitelist stick table:< | * Remove IP address from whitelist stick table:< | ||
| * Show content of whitelist stick table:< | * Show content of whitelist stick table:< | ||
| - | * To add an IP address | + | * To add an IP address |
| - | IP=$(dig +short host.duckdns.org) | + | echo "clear table stick_table_whitelist" |
| - | ERROR=$? | + | |
| - | # | + | |
| - | # do not update if DIG timed out | + | |
| - | if [ $ERROR -eq 0 ]; then | + | |
| - | # update HAProxy stick table | + | |
| - | | + | |
| - | fi | + | |
| </ | </ | ||
| - | | + | * To make this work you need to add < |
| - | | + | < |
| - | < | + | * Call the script |
| - | * To remove an IP address | + | # bco, 2026-09-20 |
| + | # update my current IP address in HAProxy stick table | ||
| # | # | ||
| - | # update HAProxy stick table | + | IP=$(curl -s https://api.ipify.org) |
| - | echo "clear table stick_table_whitelist" | + | |
| - | </ | + | # Regex pattern matching 0-255 for individual octets |
| - | * This way you can add your computer to the trusted IP list (whitelist) no matter what is the current IP address, provided that you set up a dynamic domain name which you can update with your [[#powershell|Powerhell]] script below. | + | octet=' |
| + | pattern=" | ||
| - | ===== Powershell ===== | + | if [[ $IP =~ $pattern ]]; then |
| - | * Create the following Powershell script and use it with a shortcut to '' | + | ssh -p 50322 huahin.condrau.com "echo \"set table stick_table_whitelist key $IP\" | sudo /usr/bin/socat / |
| - | # This is an example Powershell file for DuckDNS updater, see https://www.duckdns.org | + | else |
| - | param($domain) | + | |
| - | $duckdomain = if (!$domain) { " | + | sleep 5 |
| - | $addr = curl.exe -s "https:// | + | exit 1 |
| - | curl.exe -k " | + | fi |
| + | exit 0 | ||
| </ | </ | ||
| + | * Put a shortcut on the Windows Desktop for easy access:< | ||
| + | * This way you can add your computer to the trusted IP list (whitelist) no matter what is the current IP address. | ||