This commit is contained in:
Eliezer Croitoru 2024-04-09 09:35:16 +03:00
parent d27ce151c5
commit a17b7ea9db
3 changed files with 12 additions and 8 deletions

6
.gitignore vendored
View File

@ -19,3 +19,9 @@ requests.rest
.prettierrc
CSV_FILES/
log/
bin/output/cert.csr
bin/output/cert.pem
bin/output/priv.key
bin/tmp/csrconfig.txt

View File

@ -1,20 +1,14 @@
#!/usr/bin/env bash
STATE=$(head -1 vars/state)
COUNTRY=$(head -1 vars/country)
LOCALITY=$(head -1 vars/locality)
ORGANIZATION=$(head -1 vars/organization)
LOCALITRY=$(head -1 vars/locality)
CN=$(head -1 vars/cn)
DAYS=$(head -1 vars/days)
SUBJECT_ALTERNATIVES=$( python3 gen-subject-alternatives.py )
#sed -e "s/###CN##/commonName = $COMMON_NAME/g" \
# -e "s/###COUNTRY###/countryName = $COUNTRY/g" \
# -e "s/###STATE###/stateOrProvinceName = $STATE/g" \
# -e "s/###LOCALITY###/localityName = $LOCALITY/g" \
# -e "s/###ORGANIZATION###/organizationName = $ORGANIZATION/g" \
# templates/csrconfig.txt.in
jinja2 templates/csrconfig.txt.j2 -D cn="${CN}" -D country="${COUNTRY}" -D state="${STATE}" -D locality="${LOCALITY}" \
-D org="${ORGANIZATION}" -D subj_alternative="${SUBJECT_ALTERNATIVES}" > tmp/csrconfig.txt
@ -25,3 +19,6 @@ openssl genpkey -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out o
#Create the CSR
openssl req -new -nodes -key output/priv.key -config tmp/csrconfig.txt -out output/cert.csr
# Generate the self-signed certificate
openssl x509 -req -days ${DAYS} -in output/cert.csr -signkey output/priv.key -out output/cert.pem

1
bin/vars/days Normal file
View File

@ -0,0 +1 @@
3650