Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Question on HAProxy, VIPs, DHCP, and Firewall Rules

    Scheduled Pinned Locked Moved Firewalling
    16 Posts 2 Posters 1.7k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      bjk002
      last edited by

      Hi PiBa,

      All traffic is forwarded to 8843 and HTTPS.

      The one subdomain that was handled happened to be the default backend... so, after further consideration, this may not have been working for any of the domains.

      But your comment on the NAT rules and port aliases got my head unstuck. This was the problem.

      I separated out the NAT rules and everything is working for both LAN and WAN.

      I am very happy. Thank you for the assist. And thanks for the tip regarding /tmp/rules.debug. That will come in handy in the future.

      1 Reply Last reply Reply Quote 0
      • B Offline
        bjk002
        last edited by

        So I need to resurrect this thread...

        I can confirm that a backend with HTTP is working. HOWEVER, a backend with HTTPS is not working, resulting in 503 at all times.

        So while the NAT rules and aliases was a problem that is now corrected, I still have an issue.

        If the backend server FQDN is MYSERVER.example.com, and the web server is listening on both port 8080 (HTTP) and port 443 (HTTPS) then if I set the backend as:

        834adea9-73c4-4a7e-8527-a56b288f5a08-image.png

        I am able to reach the backend server correctly, with valid cert, and everything is wonderful.

        If I flip the port to 443 in the backend and set "Encrypt(SSL)"
        4f5346fb-c6be-4889-a4fd-7a3294e1cef5-image.png

        I am unable to reach the backend server and instead get the 503 error.

        Yes, I can confirm I can reach the backend server directly via either port, using either HTTP or HTTPS. But something in the HAPROXY configuration is not allowing the HTTPS connection.

        I am at a loss and can use some assistance/ideas on where to look.

        Finally, for the record, the use cases require using HTTPS, so just using an HTTP backend is not a solution here.

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          PiBa @bjk002
          last edited by

          @bjk002
          What does haproxy LastChk column say on the status page?

          1 Reply Last reply Reply Quote 0
          • B Offline
            bjk002
            last edited by bjk002

            Hi PiBa,

            LastChk is blank. Not sure if it matters, but I do not have health checks enabled on any backend.

            ea505e13-8442-412f-9d90-771294152196-image.png

            P 1 Reply Last reply Reply Quote 0
            • P Offline
              PiBa @bjk002
              last edited by

              @bjk002
              Enabling http health-checks could help determine if haproxy is able to properly connect, negotiate ssl, and send a http request. And tell on which of those steps its possibly failing.

              1 Reply Last reply Reply Quote 0
              • B Offline
                bjk002
                last edited by

                OK.

                Here is the full list of backends and frontend stats, with blackouts for identifying info.

                Every backend defined with red status in below image is an HTTPS connection. Those in green are HTTP.

                Some of those red status backends (the actual servers) are listening on both HTTP and HTTPS ports (80 / 443). I can flip the backend from HTTPS port to HTTP port and everything works (enabling/disabling SSL check as appropriate).

                7b5ee05a-2768-48c6-aa70-1c63d83bc571-image.png

                So I am at a loss...

                I've got to believe this is some problem in my firewall rules, but I just do not see it.

                1 Reply Last reply Reply Quote 0
                • B Offline
                  bjk002
                  last edited by bjk002

                  to prove the point, I flipped the "docs" backend to HTTP. Below is the result:

                  78eb3cdb-1148-46d2-9c9d-5b2b81682758-image.png

                  P 1 Reply Last reply Reply Quote 0
                  • P Offline
                    PiBa @bjk002
                    last edited by

                    @bjk002
                    he problem is NOT a firewall-rules problem, as all the LastChk says "L6RSP in 3ms". This means that a TCP-connection was made succesfully. But the certificate/cipher negotiation failed.. If you 'hover' with your mouse over that line it might tell a little bit more about the reason that failed.

                    If you are only switching the 'port' on a already configured server it 'might' remember the old port.. If you hover with your mouse over the servername it should show the ip:port its trying to connect to verify that its showing the 443 port there..

                    Finally can you paste the configuration of a backend as it appears in haproxy.cfg (bottom of settings tab) here when its configured for the ssl-checks?

                    1 Reply Last reply Reply Quote 0
                    • B Offline
                      bjk002
                      last edited by

                      @PiBa said in Question on HAProxy, VIPs, DHCP, and Firewall Rules:

                      haproxy.cfg

                      PiBa,

                      Thanks for sticking with me. I hear you regarding firewall/rules.

                      Hovering over the "L6RSP in 6ms" yields "Layer6 invalid response: SSL handshake failure" for each backend.

                      I hovered over server name affiliated with each failed backend, and the server:port were correct for each.

                      Below is the content of haproxy.cfg for one backend with SSL. I changed domain and server names to obscure.

                      backend worklogs.example.com_ipvANY
                      	mode			http
                      	id			100
                      	log			global
                      	option			log-health-checks
                      	errorfile			503 /var/etc/haproxy/errorfile_worklogs.example.com_ipvANY_503_ErrorPage503
                      	timeout connect		30000
                      	timeout server		30000
                      	retries			3
                      	option			httpchk OPTIONS / 
                      	server			EXAMPLESERVER EXAMPLESERVER.example.com:443 id 101 ssl check inter 10000  ca-file /var/etc/haproxy/ca_5ea74728e9b92.pem crt /var/etc/haproxy/server_clientcert_5ea9847021976.pem resolvers globalresolvers
                      
                      P 1 Reply Last reply Reply Quote 0
                      • P Offline
                        PiBa @bjk002
                        last edited by

                        @bjk002
                        I see you configured both a CA-certificate and a client-certificate for the server.. Are you sure a client-certificate is needed to connect to the server? Can you try without those?
                        If that works then only add the CA-certificate, and try again. If it still works 'maybe' add the client cert back.?.

                        1 Reply Last reply Reply Quote 0
                        • B Offline
                          bjk002
                          last edited by

                          Let me give that a try. I'll report back.

                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            bjk002
                            last edited by

                            Confirmed. it works with no client cert.

                            cf9ec9d9-0fd7-4238-aec9-75eb83c20863-image.png

                            I will need to add client cert back and retry, but I've got to run for now. TY!!!

                            P 1 Reply Last reply Reply Quote 0
                            • P Offline
                              PiBa @bjk002
                              last edited by

                              @bjk002
                              Okay thats good news ;) . As for the client-certificate, when you connect with a browser to the servers, do they ask you for sending/selecting a client certificate from your browser? (This would mean most people cant visit those sites when they would connect to the servers, but maybe that intended.?.)

                              B 1 Reply Last reply Reply Quote 0
                              • B Offline
                                bjk002 @PiBa
                                last edited by bjk002

                                @PiBa - real quick - yes, good news. =)

                                And, yes, originally, you get a prompt for the client cert. it is intended.

                                I'll fiddle with it later this evening and see if I can get everything to work.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post
                                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.