Le système
DANE fonctionne en publiant dans le
J'utilise le logiciel
% aptitude install hash-slinger
Une fois qu'il est installé, testons-le avec un site Web qui a
des enregistrements DANE :
% tlsa --verify dns.bortzmeyer.org
SUCCESS (Usage 1 [PKIX-EE]): Certificate offered by the server matches the one mentioned in the TLSA record and chains to a valid CA certificate (204.62.14.153)
SUCCESS (Usage 1 [PKIX-EE]): Certificate offered by the server matches the one mentioned in the TLSA record and chains to a valid CA certificate (2605:4500:2:245b::42)
(Il y a deux lignes car le nom
% tlsa --verify dns.bortzmeyer.org ; echo $?
...
0
Si l'enregistrement TLSA a un problème, le code de retour est
différent de zéro :
% tlsa --verify dougbarton.us ; echo $?
FAIL: Certificate offered by the server does not match the TLSA record (208.79.90.218)
FAIL: Certificate offered by the server does not match the TLSA record (2607:f2f8:ab14::2)
2
Rien de magique dans la commande
% dig TLSA _443._tcp.mercredifiction.bortzmeyer.org
...
;; ANSWER SECTION:
_443._tcp.mercredifiction.bortzmeyer.org. 86400 IN TLSA 1 1 1 (
928DDE55DF4CD94CDCF998C55085FBB5228B561CC237
A122D950260029C5B8C9 )
_443._tcp.mercredifiction.bortzmeyer.org. 86400 IN RRSIG TLSA 8 5 86400 (
20171113165155 20171025071419 50229 bortzmeyer.org.
eRNZfL8ERWhs0SIGYHOIMh1l+tzFFfvDmV7XlPxd8BYa
...
Puis comparer avec ce que donne
% openssl s_client -servername mercredifiction.bortzmeyer.org -showcerts -connect mercredifiction.bortzmeyer.org:443 | \
openssl x509 -noout -pubkey | openssl pkey -outform der -pubin | openssl dgst -sha256
...
(stdin)= 928dde55df4cd94cdcf998c55085fbb5228b561cc237a122d950260029c5b8c9
On voit qu'on a le même
Bien, on a désormais un moyen de tester qu'un serveur
% /usr/local/lib/nagios/plugins/check_dane_http -H www.afnic.fr ; echo $?
OK - SUCCESS (Usage 3 [DANE-EE]): Certificate offered by the server matches the TLSA record (192.134.5.24)
SUCCESS (Usage 3 [DANE-EE]): Certificate offered by the server matches the TLSA record (2001:67c:2218:30::24)
0
% /usr/local/lib/nagios/plugins/check_dane_http -H dougbarton.us ; echo $?
DANE server 'dougbarton.us' has a problem: FAIL: Certificate offered by the server does not match the TLSA record (208.79.90.218)
FAIL: Certificate offered by the server does not match the TLSA record (2607:f2f8:ab14::2)
2
% /usr/local/lib/nagios/plugins/check_dane_http -H ssi.gouv.fr ; echo $?
DANE server 'ssi.gouv.fr' has a problem: Unable to resolve ssi.gouv.fr.: Unsuccessful DNS lookup or no data returned for rrtype TLSA (52).
2
Le premier domaine a un enregistrement TLSA et marche bien. Le
second, comme vu plus haut, a un enregistrement TLSA mais
incorrect. Le troisième n'a pas d'enregistrement TLSA.
On peut désormais configurer
object CheckCommand "dane_http" {
command = [ PluginContribDir + "/check_dane_http" ]
arguments = {
"-H" = "$dane_domain$"
}
}
...
apply Service for (dane_domain => config in host.vars.dane_domains) {
import "generic-service"
check_command = "dane_http"
vars.dane_domain = dane_domain
}
...
vars.dane_domains["dns.bortzmeyer.org"] = true
(Bon, ça serait mieux si on pouvait spécifier indépendemment le nom à
tester, l'adresse IP du serveur, et le nom qui va apparaitre dans
l'interface Web d'Icinga. Mais j'étais paresseux et j'ai fait simple.)
Voilà, désormais Icinga surveille périodiquement l'enregistrement
DANE et le certificat TLS et tout va bien :
S'il y a un problème, on sera averti et on verra le problème dans
l'interface Web d'Icinga. Ici, par exemple, l'enregistrement TLSA
était pour le certificat entier (sélecteur 0) et un renouvellement a
changé le certificat (mais pas la clé). Le message d'Icinga
indiquait :
CRITICAL since 00:59
Service: mercredifiction.bortzmeyer.org
Plugin Output
DANE server 'mercredifiction.bortzmeyer.org' has a problem: FAIL: Certificate offered by the server does not match the TLSA record (217.70.190.232)
FAIL: Certificate offered by the server does not match the TLSA record (2001:4b98:dc0:41:216:3eff:fece:1902)
Cet incident a permis de tester que la supervision de DANE marchait
bien 😁. Mais il mérite davantage de discussion. Dans ce cas
précis, l'enregistrement TLSA commençait par « 1 0 1 ». Cela veut
dire « Usage 1, Sélecteur 0, Correspondance 0 » (voir les
explications dans le
Voilà, maintenant que ça marche, prochaine étape : faire la même chose pour
% tlsa --verify --port 25 --starttls smtp mail.bortzmeyer.org
SUCCESS (Usage 2 [DANE-TA]): A certificate in the certificate chain offered by the server (including the end-entity certificate) matches the TLSA record (217.70.190.232)
SUCCESS (Usage 2 [DANE-TA]): A certificate in the certificate chain offered by the server (including the end-entity certificate) matches the TLSA record (2001:4b98:dc0:41:216:3eff:fece:1902)
Autres solutions possibles pour tester DANE :