
웹사이트가 아닌 Exim에 대한 TLS 인증서가 필요합니다. 웹 서버를 사용하지 않는 사람들을 위해 Let's Encrypt는 소위 DNS-01 챌린지를 통해 인증서를 제공합니다. 정말 간단합니다. 후크 스크립트는 Let's Encrypt에서 인증서 요청을 확인하는 데 사용되는 TXT 챌린지 RR을 사용하여 BIND 영역을 동적으로 업데이트합니다.
BIND의 DDNS 업데이트까지 모두 작동합니다. 다음과 같은 영역 구성이 있습니다.
zone "example.com" IN {
type master;
notify yes;
allow-query { "any"; };
file "/etc/bind/example.com.zone";
update-policy {
grant ddns-key zonesub ANY;
};
};
그런 다음 dehydrated
클라이언트를 사용하여 인증서 요청을 발행하고 인증서 서명을 받습니다. dehydrated
도메인에 대한 챌린지와 함께 TXT 레코드를 동적으로 추가하는 후크 스크립트를 사용합니다.
% dehydrated -c --domain example.com -t dns-01 -k /myhook.sh
# INFO: Using main config file /etc/dehydrated/config
Processing example.com
+ Signing domains...
+ Generating private key...
+ Generating signing request...
+ Requesting new certificate order from CA...
+ Received 1 authorizations URLs from the CA
+ Handling authorization for example.com
+ 1 pending challenge(s)
+ Deploying challenge tokens...
+ Responding to challenge for example.com authorization...
+ Cleaning challenge tokens...
+ Challenge validation has failed :(
ERROR: Challenge is invalid! (returned: invalid) (result: {
"type": "dns-01",
"status": "invalid",
"error": {
"type": "urn:ietf:params:acme:error:dns",
"detail": "DNS problem: NXDOMAIN looking up TXT for _acme-challenge.example.com - check that a DNS record exists for this domain",
"status": 400
},
"url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/9027433651/.....",
"token": "g_zU3NXkYwjt2LrRm3Yo33O22BFPLRvl......"
})
후크 스크립트는 다음을 기반으로 합니다.https://github.com/dehydrated-io/dehydrated/wiki/example-dns-01-nsupdate-script.
dehydrated
삭제를 시도하기 전에 TXT 레코드가 있는지 확인하면 실제로 존재하지 않습니다.
dig TXT _acme-challenge.example.com @inet.example.com
...NXDOMAIN
로그에서 BIND는 관련된 단일 행을 작성합니다.
02-Dec-2020 20:21:56.089 update: info: client 10.5.1.181#49440/key ddns-key: updating zone 'example.com/IN': adding an RR at '_acme-challenge.example.com' TXT "GLuKNhJkt3MJ4refRS_nkL9BRBbqXSl4a3QytkGfY64"
그게 다야. 디버깅을 위해 로깅 수준을 높였지만 더 이상 아무것도 없습니다. TXT 레코드가 나타나지 않고 오류 메시지도 없습니다.
이 문제를 어떻게 해결할 수 있나요?
OS: 데비안 9. BIND 버전: 9.10.
% named -V
BIND 9.10.3-P4-Debian <id:ebd72b3>
built by make with '--prefix=/usr' '--mandir=/usr/share/man' '--libdir=/usr/lib/x86_64-linux-gnu' '--infodir=/usr/share/info' '--sysconfdir=/etc/bind' '--with-python=python3' '--localstatedir=/' '--enable-threads' '--enable-largefile' '--with-libtool' '--enable-shared' '--enable-static' '--with-gost=no' '--with-openssl=/usr' '--with-gssapi=/usr' '--with-gnu-ld' '--with-geoip=/usr' '--with-atf=no' '--enable-ipv6' '--enable-rrl' '--enable-filter-aaaa' '--enable-native-pkcs11' '--with-pkcs11=/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so' '--with-randomdev=/dev/urandom' 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/bind9-3gVwXu/bind9-9.10.3.dfsg.P4=. -fstack-protector-strong -Wformat -Werror=format-security -fno-strict-aliasing -fno-delete-null-pointer-checks -DNO_VERSION_DATE -DDIG_SIGCHASE' 'LDFLAGS=-Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
compiled by GCC 6.3.0 20170516
compiled with OpenSSL version: OpenSSL 1.0.2u 20 Dec 2019
linked to OpenSSL version: OpenSSL 1.0.2u 20 Dec 2019
compiled with libxml2 version: 2.9.4
linked to libxml2 version: 20904
업데이트
뭔가를 발견했습니다. 이는 BIND가 수신하는 IP/인터페이스와 관련된 것 같습니다. 외부에서 볼 수 있는 네임서버를 사용하는 경우 example.com
다음 명령이 거부됩니다 nsupdate
.
% nsupdate -k /etc/exim4/ddns.key < /tmp/s
; TSIG error with server: tsig indicates error
update failed: NOTAUTH(BADKEY)
% cat /tmp/s
server inet.example.com
add _acme-challenge.example.com 1010001 in TXT "abc"
send
하지만 오류가 발생하지 않고 TXT 레코드가 표시됩니다.하다다음 명령을 사용하여 삽입하십시오 nsupdate
.
server 10.0.0.1
add _acme-challenge.example.com 1010001 in TXT "abc"
send