Quote from: TheHellSite on May 08, 2023, 08:54:15 pmHonestly please just follow my tutorial. I will not provide support for something else here.If you want to do it your way then just ask in the appropriate forum.But I will say if you keep on testing your way you will need much more time.If it is not working with my way you can simply disable the WAN firewall rule and re-enable the NAT portforward.This way you can also test this.I there, I followed the suggestion and at the end of the process i have this 2 issues which I can't figure out:1) Certificate is not valid. I also run the ssllab test and I received the same answer (rating T) showing certificate not trusted2) again error 503 Service unavailableChecking the HAProxy log, it shows:QuoteInformational haproxy public_IP:9911 [09/May/2023:17:25:07.299] 2_HTTPS_frontend/127.4.4.3:443: SSL handshake failurewhich I think I solved removing the SSL tick on the real server set up. I have the apache virtual server only listening on port 80 #1: is it possible it is because at the moment I'm using a staging cert?#2: this is the issue I'm investigating now for few days without any luck. I'll go over your tutorial but hints are welcomecheers
Honestly please just follow my tutorial. I will not provide support for something else here.If you want to do it your way then just ask in the appropriate forum.But I will say if you keep on testing your way you will need much more time.If it is not working with my way you can simply disable the WAN firewall rule and re-enable the NAT portforward.This way you can also test this.
Informational haproxy public_IP:9911 [09/May/2023:17:25:07.299] 2_HTTPS_frontend/127.4.4.3:443: SSL handshake failure
Your HAProxy config looks good.And since you get the 503 error this means connections are getting to HAProxy.Your issue is mostlikely the SSL (yes or no) checkbox in the Real Server settings. Verify which service needs SSL and which doesn't for the local access between HAProxy and the local service.Also unless you get your certificates using the HTTP-01 method, which I doubt, since there is no rule for it on the HTTP_frontend remove do the following:in the HAProxy plugin: delete the acme_challenge_backend and acme_challenge_host and all other haproxy entries auto generated by the ACME plugin.in the ACME plugin: Go the the settings and disable the "HAProxy Integration", hit Apply.
That got it, thanks! So the SSL check on the real server setting would only be if that server was serving its own cert?
503 Service UnavailableNo server is available to handle this request.
@mauroHAProxy config export and a basic network diagram. That is what you will have to provide now, not just error codes.
## Automatically generated configuration.# Do not edit this file manually.#global uid 80 gid 80 chroot /var/haproxy daemon stats socket /var/run/haproxy.socket group proxy mode 775 level admin nbthread 4 hard-stop-after 60s no strict-limits maxconn 10000 tune.ssl.default-dh-param 4096 spread-checks 2 tune.bufsize 16384 tune.lua.maxmem 0 log /var/run/log local0 warning lua-prepend-path /tmp/haproxy/lua/?.luadefaults log global option redispatch -1 maxconn 5000 timeout client 30s timeout connect 30s timeout server 30s retries 3 default-server init-addr last,libc# autogenerated entries for ACLs# autogenerated entries for config in backends/frontends# autogenerated entries for stats# Frontend: 0_SNI_Frontend (listening on LAN address port 80/443)frontend 0_SNI_Frontend bind lan_ip:80 name lan_ip:80 bind lan_ip:443 name lan_ip:443 mode tcp default_backend SSL_Backend # logging options# Frontend: 1_HTTP_frontend (Listening on lo_ip:80)frontend 1_HTTP_frontend bind lo_ip:80 name lo_ip:80 accept-proxy mode http option http-keep-alive option forwardfor # logging options option dontlognull option log-separate-errors option httplog # ACL: NoSSL_condition acl acl_6462b25dd3fc08.98092716 ssl_fc # ACTION: HTTP2HTTPS_r http-request redirect scheme https code 301 if !acl_6462b25dd3fc08.98092716# Frontend: 2_HTTPS_frontend (Listening on lo_ip:443)frontend 2_HTTPS_frontend http-response set-header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" bind lo_ip:443 name lo_ip:443 accept-proxy ssl curves secp384r1 no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES256-GCM-SHA384 ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 alpn h2,http/1.1 crt-list /tmp/haproxy/ssl/6463bbbf543239.59805119.certlist mode http option http-keep-alive option forwardfor timeout client 15m # logging options option dontlognull option log-separate-errors option httplog # ACTION: PUBLIC_SUBDOMAINS_r # NOTE: actions with no ACLs/conditions will always match use_backend %[req.hdr(host),lower,map_dom(/tmp/haproxy/mapfiles/645151c9cb3ae5.07476878.txt)] # Backend: s1_backend (s1 server backend)backend s1_backend # health checking is DISABLED mode http balance source # stickiness stick-table type ip size 50k expire 30m stick on src http-reuse safe server s1_server server_ip # Backend: SSL_Backend (SNI backend)backend SSL_Backend # health checking is DISABLED mode tcp balance source # stickiness stick-table type ip size 50k expire 30m stick on src server SSL_Server lo_ip send-proxy-v2 check-send-proxy# statistics are DISABLED
To keep the webapp available from the outside world I have the SNI Frontend based on the LAN address, port 80,443. I'm doing this way because I already tried following your tutorial using the WAN address on the SNI frontend with same result plus server unreachable.
I created a Firewall rule for LAN to acceppt incoming requests on port 80,443
1. Your apache is listening on port 80 (no ssl) and 443 (probably with ssl).
2. My tutorial assumes that the user wants all connections to be upgraded from port 80 to 443, what you also configured by using the HTTP_frontend on port 80 with the HTTPtoHTTPS_rule.
3. The HTTPS_frontend has SSL offloading enabled, so it decrypts any connection and then forwards it to the real server based on the real server connection configuration.
4. However, in your scenario you didn't configure your apache real server correctly since you left the port blank and didn't tell haproxy if the real server expects SSL or not.
# Automatically generated configuration.# Do not edit this file manually.#global uid 80 gid 80 chroot /var/haproxy daemon stats socket /var/run/haproxy.socket group proxy mode 775 level admin nbthread 4 hard-stop-after 60s no strict-limits maxconn 10000 tune.ssl.default-dh-param 4096 spread-checks 2 tune.bufsize 16384 tune.lua.maxmem 0 log /var/run/log local0 info lua-prepend-path /tmp/haproxy/lua/?.luadefaults log global option redispatch -1 maxconn 5000 timeout client 30s timeout connect 30s timeout server 30s retries 3 default-server init-addr last,libc default-server maxconn 5000# autogenerated entries for ACLs# autogenerated entries for config in backends/frontends# autogenerated entries for stats# Frontend: 0_SNI_frontend (listening on 80 and 443)frontend 0_SNI_frontend bind 0.0.0.0:443 name 0.0.0.0:443 bind 0.0.0.0:80 name 0.0.0.0:80 mode tcp default_backend SSL_backend # logging options option tcplog# Frontend: 1_HTTP_frontend (listening on localhost:80)frontend 1_HTTP_frontend bind 127.0.0.1:80 name 127.0.0.1:80 accept-proxy mode http option http-keep-alive option forwardfor # logging options option httplog # ACL: NoSSL_condition acl acl_6451d6d41f14e3.72189927 ssl_fc # ACTION: HTTPtoHTTPS_rule http-request redirect scheme https code 301 if !acl_6451d6d41f14e3.72189927# Frontend: 1_HTTPS_frontend (listening on localhost:443)frontend 1_HTTPS_frontend http-response set-header Strict-Transport-Security "max-age=15768000" bind 127.0.0.1:443 name 127.0.0.1:443 accept-proxy ssl curves secp384r1 no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES256-GCM-SHA384 ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 alpn h2,http/1.1 crt-list /tmp/haproxy/ssl/6451dd0fe21db7.63563341.certlist mode http option http-keep-alive option forwardfor timeout client 15m # logging options option httplog # ACL: cardav-endpoint acl acl_6461de0380c7b3.75062629 path_end -i /.well-known/carddav # ACL: caldav-endpoint acl acl_6461dde5d15634.54704624 path_end -i /.well-known/caldav # ACL: nc_nodeinfo acl acl_6466fe1b2e8ff2.47035478 path /.well-known/nodeinfo # ACL: nc_webfinger acl acl_6466fe303acb97.89104263 path /.well-known/webfinger # ACL: LOCAL_SUBDOMAINS_SUBNETS_condition acl acl_6451d1c3d510f5.88841915 src 10.1.1.0/24 192.168.0.0/24 # ACTION: cardav-endpoint http-request redirect code 301 location /remote.php/dav if acl_6461de0380c7b3.75062629 # ACTION: caldav-endpoint http-request redirect code 301 location /remote.php/dav if acl_6461dde5d15634.54704624 # ACTION: nc_nodeinfo http-request redirect code 301 location /index.php/%[capture.req.uri] if acl_6466fe1b2e8ff2.47035478 # ACTION: nc_webfinger http-request redirect code 301 location /index.php/%[capture.req.uri] if acl_6466fe303acb97.89104263 # ACTION: LOCAL_SUBDOMAINS_rule use_backend %[req.hdr(host),lower,map_dom(/tmp/haproxy/mapfiles/6451d0414cb7f2.59080919.txt)] if acl_6451d1c3d510f5.88841915 # ACTION: PUBLIC_SUBDOMAINS_rule # NOTE: actions with no ACLs/conditions will always match use_backend %[req.hdr(host),lower,map_dom(/tmp/haproxy/mapfiles/6451d7a6418a58.11785496.txt)] # Backend: SSL_backend ()backend SSL_backend # health checking is DISABLED mode tcp balance source # stickiness stick-table type ip size 50k expire 30m stick on src server SSL_server 127.0.0.1 send-proxy-v2 check-send-proxy# Backend: portainer_backend (portainer backend)backend portainer_backend # health checking is DISABLED mode http balance source # stickiness stick-table type ip size 50k expire 30m stick on src # WARNING: pass through options below this line timeout tunnel 3600s http-reuse safe server portainer 10.1.1.59:9443# Backend: nextcloud_backend (nextcloud_backend)backend nextcloud_backend # health checking is DISABLED mode http balance source # stickiness stick-table type ip size 50k expire 30m stick on src http-reuse safe server nextcloud 10.1.1.59:11000# statistics are DISABLED
2023-05-19T16:35:18 | Informational | haproxy | 10.1.1.59:58792 [19/May/2023:16:35:18.215] 0_SNI_frontend SSL_backend/SSL_server 1/-1/0 0 CC 2/2/1/1/0 0/0 | -- | -- | -- | -- | --2023-05-19T16:35:07 | Informational | haproxy | 10.1.1.103:46386 [19/May/2023:16:34:37.775] 1_HTTPS_frontend~ 1_HTTPS_frontend/<NOSRV> -1/-1/-1/-1/30003 0 0 - - PR-- 2/2/0/0/0 0/0 "<BADREQ>" | 2023-05-19T16:35:07 | Informational | haproxy | 10.1.1.103:46386 [19/May/2023:16:34:37.761] 0_SNI_frontend SSL_backend/SSL_server 1/0/30017 5134 cD 2/2/1/1/0 0/0 | 2023-05-19T16:34:48 | Informational | haproxy | 10.1.1.59:45564 [19/May/2023:16:34:48.055] 0_SNI_frontend SSL_backend/SSL_server 1/0/1 0 -- 3/3/2/2/0 0/0 | 2023-05-19T16:34:48 | Informational | haproxy | 10.1.1.59:45564 [19/May/2023:16:34:48.055] 1_HTTPS_frontend/127.0.0.1:443: Connection closed during SSL handshake
smoked-proposal would you mind posting in your HAproxy config? To my knowledge everything i've set is as per the tutorial but i'd like to see your config for Nextcloud if you have it working (I don't have SSL verify either). I've asked over in the Nextcloud forums and they do believe HAproxy is dropping something in the redirect considering hitting nextcloud directly works correctly.
... they do believe HAproxy is dropping something in the redirect considering hitting nextcloud directly works correctly.
Thank you, i did manage to resolve part of the issue from your help with clearing my browser cache. I had been testing via incognito mode often but had forgotten last few changes. Locally I can now access nextcloud via domain name as expected. Externally however, no joy.