summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-12-09 19:57:14 +0100
committerErich Eckner <git@eckner.net>2019-12-09 19:57:14 +0100
commite22fe06a43fbc00b8162f35926095abe81b30d06 (patch)
tree24e58902a65fa5e84f1e3343b54528bf536d65de
parent9682674483d63e54d854cb173994c818c000a4bc (diff)
downloadsimple-pki-e22fe06a43fbc00b8162f35926095abe81b30d06.tar.xz
sign-ca.in: keep serial
-rwxr-xr-xsign-ca.in13
1 files changed, 10 insertions, 3 deletions
diff --git a/sign-ca.in b/sign-ca.in
index 372309c..6ac277d 100755
--- a/sign-ca.in
+++ b/sign-ca.in
@@ -38,9 +38,16 @@ level_ground_for_new_ca() {
touch \
'#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.db' \
'#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.db.attr'
- echo '01' \
- |tee '#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.crt.srl' \
- >'#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.crl.srl'
+ for srl in 'crl' 'crt'; do
+ old='#ETCDIR#/'"$1"'.old/ca/'"$1"'/db/'"$1"'.old.'"${srl}"'.srl'
+ new='#ETCDIR#/'"$1"'/ca/'"$1"'/db/'"$1"'.'"${srl}"'.srl'
+ if [ ! -f "${old}" ]; then
+ cp "${old}" "${new}"
+ else
+ echo '01' \
+ >"${new}"
+ fi
+ done
}
if [ -f '#ETCDIR#/simple-pki/ca/root-ca.crt' ]; then