From 746e48f6f2591a745d638a1d18daa3249f986c33 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 Sep 2021 08:17:52 +0200 Subject: Adding domain preseeding for dehydrated. Signed-off-by: Daniel Baumann --- debian/open-infrastructure-dehydrated-tools.config | 6 +++- .../open-infrastructure-dehydrated-tools.postinst | 36 ++++++++++++++-------- .../open-infrastructure-dehydrated-tools.templates | 21 +++++++++---- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/debian/open-infrastructure-dehydrated-tools.config b/debian/open-infrastructure-dehydrated-tools.config index 6c7a683..5d062af 100644 --- a/debian/open-infrastructure-dehydrated-tools.config +++ b/debian/open-infrastructure-dehydrated-tools.config @@ -60,11 +60,15 @@ then fi db_settitle open-infrastructure-dehydrated-tools/title -db_input low open-infrastructure-dehydrated-tools/register "${REGISTER}" || true +db_input low open-infrastructure-dehydrated-tools/domains "${DOMAINS}" || true db_go db_settitle open-infrastructure-dehydrated-tools/title db_input low open-infrastructure-dehydrated-tools/tsig "${TSIG}" || true db_go +db_settitle open-infrastructure-dehydrated-tools/title +db_input low open-infrastructure-dehydrated-tools/register "${REGISTER}" || true +db_go + db_stop diff --git a/debian/open-infrastructure-dehydrated-tools.postinst b/debian/open-infrastructure-dehydrated-tools.postinst index 083c2ac..48b5d0f 100755 --- a/debian/open-infrastructure-dehydrated-tools.postinst +++ b/debian/open-infrastructure-dehydrated-tools.postinst @@ -66,24 +66,27 @@ case "${1}" in db_get open-infrastructure-dehydrated-tools/contact-email CONTACT_EMAIL="${RET}" # string (w/ empty) + db_get open-infrastructure-dehydrated-tools/ocsp-fetch + OCSP_FETCH="${RET}" # boolean + + db_get open-infrastructure-dehydrated-tools/ocsp-must-staple + OCSP_MUST_STAPLE="${RET}" # boolean + db_get open-infrastructure-dehydrated-tools/hooks HOOKS="${RET}" # multi-select (w/ empty) db_get open-infrastructure-dehydrated-tools/basedir NEW_BASEDIR="${RET}" # string (w/o empty) - db_get open-infrastructure-dehydrated-tools/register - REGISTER="${RET}" # boolean - - db_get open-infrastructure-dehydrated-tools/ocsp-fetch - OCSP_FETCH="${RET}" # boolean - - db_get open-infrastructure-dehydrated-tools/ocsp-must-staple - OCSP_MUST_STAPLE="${RET}" # boolean + db_get open-infrastructure-dehydrated-tools/domains + DOMAINS="${RET}" # string (w/ empty) db_get open-infrastructure-dehydrated-tools/tsig TSIG="${RET}" # string (w/ empty) + db_get open-infrastructure-dehydrated-tools/register + REGISTER="${RET}" # boolean + db_stop case "${AUTO_CLEANUP}" in @@ -228,11 +231,12 @@ EOF Install "${BASEDIR}" "${NEW_BASEDIR}" fi - case "${REGISTER}" in - true) - dehydrated --register --accept-terms - ;; - esac + if [ -n "${DOMAINS}" ] + then + echo "${DOMAINS}" > /etc/dehydrated/domains.txt + else + cat /etc/hostname > /etc/dehydrated/domains.txt + fi if [ -n "${TSIG}" ] then @@ -285,6 +289,12 @@ EOF mv -f "${DEFAULT_FILE}.tmp" "${DEFAULT_FILE}" fi + + case "${REGISTER}" in + true) + dehydrated --register --accept-terms + ;; + esac ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/open-infrastructure-dehydrated-tools.templates b/debian/open-infrastructure-dehydrated-tools.templates index 947e5eb..ae72683 100644 --- a/debian/open-infrastructure-dehydrated-tools.templates +++ b/debian/open-infrastructure-dehydrated-tools.templates @@ -67,12 +67,14 @@ Default: Description: dehydrated hooks: Please select any hooks that should be enabled for dehydrated. -Template: open-infrastructure-dehydrated-tools/register -Type: boolean -Default: false -Description: dehydrated register: - Should a 'dehydrated --register --accept-terms' be executed now to create - an account for this system with your CA. +Template: open-infrastructure-dehydrated-tools/domains +Type: string +Default: +Description: dehydrated domains: + Please enter the domains to be configured for dehydrated. + . + If unsure, leave empty (default) which will use the hostname + of the system. Template: open-infrastructure-dehydrated-tools/tsig Type: string @@ -83,3 +85,10 @@ Description: dehydrated TSIG: itself (format as used by nsupdate -y in algorithm:name:base64). . If unsure, leave empty (default). + +Template: open-infrastructure-dehydrated-tools/register +Type: boolean +Default: false +Description: dehydrated register: + Should a 'dehydrated --register --accept-terms' be executed now to create + an account for this system with your CA. -- cgit v1.2.3