diff options
author | Erich Eckner <git@eckner.net> | 2019-12-09 19:57:14 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-12-09 19:57:14 +0100 |
commit | e22fe06a43fbc00b8162f35926095abe81b30d06 (patch) | |
tree | 24e58902a65fa5e84f1e3343b54528bf536d65de /sign-ca.in | |
parent | 9682674483d63e54d854cb173994c818c000a4bc (diff) | |
download | simple-pki-e22fe06a43fbc00b8162f35926095abe81b30d06.tar.xz |
sign-ca.in: keep serial
Diffstat (limited to 'sign-ca.in')
-rwxr-xr-x | sign-ca.in | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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 |