Skip to content
Snippets Groups Projects
Commit 86d9c4cf authored by nimrod's avatar nimrod
Browse files

Save serial to not repeat serial numbers (just happened to me).

parent ec782bb1
Branches
No related tags found
No related merge requests found
...@@ -8,4 +8,5 @@ openssl.cnf ...@@ -8,4 +8,5 @@ openssl.cnf
CA.key CA.key
CA.crt CA.crt
CA.p12 CA.p12
CA.srl
.server.pid .server.pid
...@@ -5,7 +5,7 @@ install: ...@@ -5,7 +5,7 @@ install:
chmod 755 /usr/local/bin/ssl-ca chmod 755 /usr/local/bin/ssl-ca
clean: clean:
rm -rf openssl.cnf certs keys CA.key CA.crt CA.p12 .server.pid rm -rf openssl.cnf certs keys CA.key CA.crt CA.p12 CA.srl .server.pid
test: clean test: clean
./ssl-ca init ./ssl-ca init
......
...@@ -15,6 +15,7 @@ default_md = sha256 ...@@ -15,6 +15,7 @@ default_md = sha256
email_in_dn = no email_in_dn = no
RANDFILE = /dev/urandom RANDFILE = /dev/urandom
database = /dev/null database = /dev/null
serial = serial
[ req ] [ req ]
distinguished_name = req_distinguished_name distinguished_name = req_distinguished_name
...@@ -58,6 +59,12 @@ init () { ...@@ -58,6 +59,12 @@ init () {
else else
echo "$config" > "openssl.cnf" echo "$config" > "openssl.cnf"
fi fi
if [ -e CA.srl ]
then
echo CA.srl already exists, skipping.
else
echo 1000 > CA.srl
fi
if [ -e CA.key ] if [ -e CA.key ]
then then
echo CA.key already exists, skipping. echo CA.key already exists, skipping.
...@@ -120,7 +127,7 @@ sign_key () { ...@@ -120,7 +127,7 @@ sign_key () {
-in "$csr" \ -in "$csr" \
-out "certs/$1" \ -out "certs/$1" \
-CA CA.crt \ -CA CA.crt \
-set_serial $seed \ -CAserial CA.srl \
-extensions v3_req \ -extensions v3_req \
-extfile openssl.cnf \ -extfile openssl.cnf \
-days 3650 \ -days 3650 \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment