HAProxy Crowdsec Workshop
Version vom 27. März 2025, 17:45 Uhr von Thomas.will (Diskussion | Beiträge) (→Konfigurations Datei)
Vorbereitung
Nameserver
- Wildcard Record anlegen
*.art113.int. 300 IN A 10.88.113.61
Rechner aufsetzen
- Hostname: star.art113.int
- Address: 10.88.113.61/24
- Nameserver: 10.88.113.21
- Netz: DMZ
Wildcard Certifikat für *.art113.int
- Request erstellen
- openssl req -new -newkey rsa:4096 -nodes -keyout star.art113.int.key -out star.art113.int.csr -subj "/CN=*.art113.int"
- Zu CA schicken dort wird signiert
- openssl x509 -req -days 730 -in star.art113.int.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out star.art113.int.crt -extfile <(echo "subjectAltName=DNS:*.art113.int")
- Empfang des star.art113.int Zertifikat
star.art113.int.crt
HAProxy
Installation
- apt install -y haproxy
Minimales Szenario
- HAProxy unter mail.art113.int erreichbar zu machen
- Anfragen an einen internen Server mailit113.int per HTTPS weiterzuleiten (Reverse Proxy)
- Das Wildcard-Zertifikat zu verwenden (star.art113.int.pem)
Konfiguration
- mkdir /etc/haproxy/ssl
- sudo sh -c 'cat star.art113.int.crt star.art113.int.key > /etc/haproxy/ssl/star.art113.int.pem'
Konfigurations Datei
- vi /etc/haproxy/haproxy.cfg
global
daemon
defaults
mode http
timeout connect 10s
timeout client 30s
timeout server 30s
frontend https-in
bind *:443 ssl crt /etc/haproxy/star.art113.int.pem
mode http
acl host_mail hdr(host) -i mail.art113.int
use_backend mailit113_backend if host_mail
backend mailit113_backend
mode http
server mailit113 mail.it113.int:443 ssl verify none
Check
- haproxy -c -f /etc/haproxy/haproxy.cfg
Configuration file is valid