generate-certificates: 未应用 bind alpn 设置
作者: alex1989hu创建于 2026年9月6日更新于 2026年9月21日
标签type: bugdevstatus: reviewed2.62.83.03.23.3
setup.sh
#!/bin/sh
set -e
cd "$(dirname "$0")"
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
-keyout ca.key -out ca.crt -days 3650 -subj '/CN=gen-ca'
cat ca.key ca.crt > ca.pem
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
-keyout leaf.key -out leaf.crt -days 3650 \
-subj '/CN=in-list.example.com' -addext 'subjectAltName=DNS:in-list.example.com'
cat leaf.key leaf.crt > leaf.pem
echo 'leaf.pem' > crt-list.txthaproxy.cfg
global
log stdout format raw local0 debug
defaults
mode http
timeout connect 5s
timeout client 5s
timeout server 5s
frontend fe
bind [email protected]:8443 ssl crt-list crt-list.txt alpn h2,http/1.1 generate-certificates ca-sign-file ca.pem
bind [email protected]:8443 ssl crt-list crt-list.txt alpn h3 generate-certificates ca-sign-file ca.pem
http-request return status 200 content-type "text/plain" lf-string "ok alpn=%[ssl_fc_alpn]\n"test.sh
#!/bin/sh
set -e
cd "$(dirname "$0")"
NET=hap-repro-net
Docker network create "$NET" >/dev/null 2>&1 || true
Docker rm -f hap-repro >/dev/null 2>&1 || true
Docker run -d --user 0 --network "$NET" --name hap-repro -v "$PWD":/w -w /w \
haproxytech/haproxy-debian:3.4.4 haproxy -f haproxy.cfg >/dev/null
sleep 1
Docker run --rm --network "$NET" alpine:edge sh -ec '
apk add -q openssl
probe() { echo | openssl s_client "$@" -connect hap-repro:8443 2>&1 \
| grep -E "^subject=|ALPN protocol|No ALPN|quic_do_handshake"; }
echo "== TCP in-list =="; probe -servername in-list.example.com -alpn h2,http/1.1
echo "== TCP absent =="; probe -servername
…内容来源: haproxy/haproxy