1
Tutorials and FAQs / Re: Tutorial 2024/06: HAProxy + Let's Encrypt Wildcard Certificates + 100% A+ Rating
« on: November 21, 2024, 04:16:37 pm »
Here's another solution:
https://www.reddit.com/r/selfhosted/comments/i0iq4g/guide_haproxy_with_openvpn/
"global
log /dev/log local0
log /dev/log local1 notice
tune.ssl.default-dh-param 2048
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5s
timeout client 50s
timeout server 50s
frontend http
bind :80
mode http
option http-keep-alive
option forwardfor
timeout client 30s
# Redirect everything to https
redirect scheme https code 301 if !{ ssl_fc }
frontend TLS_passthrough
bind :443
mode tcp
option tcplog
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 } or !{ req_ssl_hello_type 1 }
# Change this to your domain
use_backend tcp_to_https if { req_ssl_sni -m end .yourdomain.tld }
default_backend openvpn
acl http req.ssl_ver gt 0
backend tcp_to_https
mode tcp
timeout connect 30s
timeout server 30s
server https 127.0.0.1:8443
frontend https
bind :8443 ssl crt-list /etc/ssl/haproxy.certlist
mode http
option http-keep-alive
option forwardfor
timeout client 30s
acl acl_guacamole hdr_beg(host) -i guacamole
acl acl_plex hdr_beg(host) -i plex
use_backend guacamole if acl_guacamole
use_backend plex if acl_plex
backend openvpn
mode tcp
timeout connect 30s
timeout server 30s
retries 3
server openvpn 192.168.100.218:443
backend plex
mode http
balance source
stick-table type ip size 50k expire 30m
stick on src
timeout connect 30s
timeout server 30s
http-reuse never
server plex 192.168.100.212:32400
backend guacamole
mode http
balance source
stick-table type ip size 50k expire 30m
stick on src
timeout connect 30s
timeout server 30s
http-reuse never
server guacamole 192.168.100.201:8084
"
How to translate this to OPNsense??? I tried for a few days, but it's beyond my knowledge.
https://www.reddit.com/r/selfhosted/comments/i0iq4g/guide_haproxy_with_openvpn/
"global
log /dev/log local0
log /dev/log local1 notice
tune.ssl.default-dh-param 2048
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5s
timeout client 50s
timeout server 50s
frontend http
bind :80
mode http
option http-keep-alive
option forwardfor
timeout client 30s
# Redirect everything to https
redirect scheme https code 301 if !{ ssl_fc }
frontend TLS_passthrough
bind :443
mode tcp
option tcplog
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 } or !{ req_ssl_hello_type 1 }
# Change this to your domain
use_backend tcp_to_https if { req_ssl_sni -m end .yourdomain.tld }
default_backend openvpn
acl http req.ssl_ver gt 0
backend tcp_to_https
mode tcp
timeout connect 30s
timeout server 30s
server https 127.0.0.1:8443
frontend https
bind :8443 ssl crt-list /etc/ssl/haproxy.certlist
mode http
option http-keep-alive
option forwardfor
timeout client 30s
acl acl_guacamole hdr_beg(host) -i guacamole
acl acl_plex hdr_beg(host) -i plex
use_backend guacamole if acl_guacamole
use_backend plex if acl_plex
backend openvpn
mode tcp
timeout connect 30s
timeout server 30s
retries 3
server openvpn 192.168.100.218:443
backend plex
mode http
balance source
stick-table type ip size 50k expire 30m
stick on src
timeout connect 30s
timeout server 30s
http-reuse never
server plex 192.168.100.212:32400
backend guacamole
mode http
balance source
stick-table type ip size 50k expire 30m
stick on src
timeout connect 30s
timeout server 30s
http-reuse never
server guacamole 192.168.100.201:8084
"
How to translate this to OPNsense??? I tried for a few days, but it's beyond my knowledge.