From 095b343fdeea11e60817693d413be3e4dd815ec4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Sep 2024 18:11:51 +0200 Subject: [PATCH] factorize/ca --- readme.md | 1 - spcd/bootstrap.sh | 36 +++++++++++++++--------------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/readme.md b/readme.md index a42e5c2..ce580ee 100644 --- a/readme.md +++ b/readme.md @@ -230,7 +230,6 @@ Handle project workflows in a unified way: * available * effective * factorize - * ca * dns * locales * handle errors diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 65e71c6..2d17ee3 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -200,33 +200,27 @@ _spcd_txt_pick() { # ╰───────────╯ spcd_ca() { - local index name value local grep="\(After\|Before\|Issuer\|Signature Algorithm\|Subject:\)" - case "${1}" in - "list") - while true; do - index=$((index + 1)) - name="SPCD_CA_${index}" - eval "value=\"\${${name}}\"" - [ -n "${value}" ] || break + local index name value + local root="${2}" + while true; do + index=$((index + 1)) + name="SPCD_CA_${index}" + eval "value=\"\${${name}}\"" + [ -n "${value}" ] || break + case "${1}" in + "list") echo "${name} =" echo "${value}" | openssl x509 -noout -text | grep "${grep}" - done - ;; - "write") - local root="${2}" - while true; do - index=$((index + 1)) - name="SPCD_CA_${index}" - eval "value=\"\${${name}}\"" - [ -n "${value}" ] || break + ;; + "write") spcd_os_write "${root}/${index}.crt" "${value}" - done - ;; - *) ;; - esac + ;; + *) ;; + esac + done } spcd_dns() {