2015-12-16 16:55:43 +00:00
|
|
|
#! /bin/bash
|
2019-06-06 09:22:44 +00:00
|
|
|
# @(#)(CAcert) $Id: mk-tlsa-recs,v 1.2 2019/04/02 15:37:17 root Exp $
|
2015-12-16 16:55:43 +00:00
|
|
|
# mk-tlsa-recs - generate TLSA records for domains found in the certs subdirectory
|
|
|
|
|
2019-06-06 09:22:44 +00:00
|
|
|
LDNS_DANE=/usr/bin/ldns-dane
|
|
|
|
|
2015-12-16 16:55:43 +00:00
|
|
|
PORT=443 # HTTPS
|
|
|
|
|
|
|
|
USAGE=3 # 0: CA constraint
|
|
|
|
# 1: Service certificate constraint
|
|
|
|
# 2: Trust anchor assertion
|
|
|
|
# 3: Domain-issued certificate
|
2019-06-06 09:22:44 +00:00
|
|
|
ALT_USAGE=2
|
2015-12-16 16:55:43 +00:00
|
|
|
|
|
|
|
SELECTOR=1 # 0: Full certificate
|
|
|
|
# 1: SubjectPublicKeyInfo
|
|
|
|
|
|
|
|
TYPE=1 # 0: No hash used
|
|
|
|
# 1: SHA-256
|
|
|
|
# 2: SHA-512
|
|
|
|
|
|
|
|
for crt in certs/*.crt
|
|
|
|
do
|
2019-06-06 09:22:44 +00:00
|
|
|
test -L ${crt} || continue
|
2015-12-16 16:55:43 +00:00
|
|
|
DOMAIN=`basename ${crt} .crt`
|
2019-06-06 09:22:44 +00:00
|
|
|
for usage in ${USAGE} ${ALT_USAGE}
|
|
|
|
do
|
|
|
|
${LDNS_DANE} -c ${crt} create \
|
|
|
|
${DOMAIN} ${PORT} ${usage} ${SELECTOR} ${TYPE}
|
|
|
|
done
|
2015-12-16 16:55:43 +00:00
|
|
|
done
|