メインコンテンツに移動
ネットワークを右往左往

メインナビゲーション

  • ホーム
  • 今日のご飯
  • 攻撃の履歴
ユーザーアカウントメニュー
  • ログイン

パンくず

  1. ホーム

[備忘録]HaproxyのCertbot設定

By aki, 18 10月, 2025

Let's Encryptの証明書を利用する際に、Let's Encryptからサーバへのアクセスが必要になるので、HAProxyの設定をしておく。

Frontend設定

対象のサーバの認証に利用するURLにアクセスしてきたhttpをルーティング。hdr(host)の値はDNSのAレコードの値と一致させておくこと

rontend certbot
        mode http
        bind *:80

        acl certbot-path path_beg -i /.well-known/acme-challenge
        acl leantime-host hdr(host) -i lt.gp7.info
        use_backend be-http-certbot-leantime if certbot-path leantime-host

 

Backend設定

バックエンドのサーバを設定

backend be-http-certbot-leantime
        server certbot lt01:8899

 

設定Reload

設定ファイルに間違いがないか確認

:/etc/haproxy# haproxy -c -- /etc/haproxy/haproxy.cfg
Configuration file is valid

設定をリロードして終了

/etc/haproxy# systemctl reload haproxy

 

動作確認

Webブラウザからhttp://lt.gp7.info/.well-known/acme-challengeにアクセスし、サーバ側にパケットが到着していることを確認。Webサーバはまだインストールしていないので、アクセス自体は503で終了する

root@lt01:~# tcpdump -i eth0 port 8899
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
23:19:55.049018 IP px01.lxd.48078 > lt01.lxd.8899: Flags [S], seq 1780193467, win 64240, options [mss 1460,sackOK,TS val 2872413250 ecr 0,nop,wscale 7], length 0
23:19:55.049032 IP lt01.lxd.8899 > px01.lxd.48078: Flags [R.], seq 0, ack 1780193468, win 0, length 0
23:19:56.050528 IP px01.lxd.48082 > lt01.lxd.8899: Flags [S], seq 348966832, win 64240, options [mss 1460,sackOK,TS val 2872414252 ecr 0,nop,wscale 7], length 0
23:19:56.050548 IP lt01.lxd.8899 > px01.lxd.48082: Flags [R.], seq 0, ack 348966833, win 0, length 0
23:19:57.052264 IP px01.lxd.48086 > lt01.lxd.8899: Flags [S], seq 3217373224, win 64240, options [mss 1460,sackOK,TS val 2872415253 ecr 0,nop,wscale 7], length 0
23:19:57.052289 IP lt01.lxd.8899 > px01.lxd.48086: Flags [R.], seq 0, ack 3217373225, win 0, length 0
23:19:58.052806 IP px01.lxd.48102 > lt01.lxd.8899: Flags [S], seq 873336480, win 64240, options [mss 1460,sackOK,TS val 2872416254 ecr 0,nop,wscale 7], length 0
23:19:58.052831 IP lt01.lxd.8899 > px01.lxd.48102: Flags [R.], seq 0, ack 873336481, win 0, length 0
  • コメントを投稿するにはログインまたは登録をしてください

コメント

AbuseIPDB Contributor Badge

本日の攻撃

20260105
CountryCount
kr67
lt143
nl51
pl1
ru1
us10
vn272
cn261
Powered by Drupal