Ubuntu 24.04
Sponsored Link

HAProxy : ACL Settings (L4)2024/05/28

This is the ACL Setting example.
It's possible to use on Layer4 mode.
Refer to the official documents to see various usages.
⇒ https://www.haproxy.com/documentation/hapee/latest/onepage/#7.3.3
[2] Configure HAProxy.
By following settings, requests to [80] port is forwarded to the backend [],
requests to [3306] port is forwarded to the backend [],
requests to [22] port is forwarded to the backend [].
vi /etc/haproxy/haproxy.cfg
# add to last line
frontend mariadb-in
        bind *:3306
        # set ACL
        # destination port is [3306]
        acl dst_3306 dst_port 3306

        # set action for ACL
        use_backend mariadb_node01 if dst_3306

backend mariadb_node01
        server node01 check

frontend ssh-in
        bind *:22
        acl dst_22 dst_port 22
        use_backend ssh_node02 if dst_22

backend ssh_node02
        server node02 check

frontend http-in
        bind *:80
        acl dst_80 dst_port 80
        use_backend http_www if dst_80

backend http_www
        server www check

systemctl stop ssh mariadb apache2

systemctl restart haproxy

[3] Verify working normally to access to the frontend HAproxy Server with each service ports.
mysql -u ubuntu -p -h dlp.srv.world -e "show variables like 'hostname';"

Enter password:
| Variable_name | Value            |
| hostname      | node01.srv.world |

ssh ubuntu@dlp.srv.world hostname

ubuntu@dlp.srv.world's password:

curl http://dlp.srv.world/

Matched Content