Fedora 37
Sponsored Link

HAProxy : SSL/TLS の設定2022/11/25

 
HAProxy サーバーの SSL/TLS の設定です。
クライント ⇔ HAproxy サーバー間の通信が SSL 対応になります。
-----------+---------------------------+--------------------------+------------
           |                           |                          |
           |10.0.0.30                  |10.0.0.51                 |10.0.0.52
+----------+-----------+   +-----------+----------+   +-----------+----------+
|   [ dlp.srv.world ]  |   | [ node01.srv.world ] |   | [ node02.srv.world ] |
|        HAProxy       |   |      Web Server#1    |   |      Web Server#2    |
+----------------------+   +----------------------+   +----------------------+

[1]
[2] 前項で例示した HAProxy 基本設定をベースに、SSL/TLS 用の追加設定をします。
# 証明書とキーをまとめておく

[root@dlp ~]#
cat /etc/letsencrypt/live/dlp.srv.world/{fullchain.pem,privkey.pem} > /etc/haproxy/haproxy.pem

[root@dlp ~]#
vi /etc/haproxy/haproxy.cfg
# frontend セクションへ追記
# * 80 ポートのリスンが不要の場合はコメント化

frontend http-in
    bind *:80
    bind *:443 ssl crt /etc/haproxy/haproxy.pem 

[root@dlp ~]#
systemctl restart haproxy

[3] Firewalld を有効にしている場合は、HAProxy が待ち受けるポートの許可が必要です。
[root@dlp ~]#
firewall-cmd --add-service=https

success
[root@dlp ~]#
firewall-cmd --runtime-to-permanent

success
[4] 任意のクライアントコンピューターから HAProxy フロントエンドサーバーへ HTTPS アクセスして動作を確認しておきます。
関連コンテンツ