Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Add support of private key pass in pem file
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdenisov committed May 24, 2021
1 parent 54e2bc8 commit 4ffbd62
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
7 changes: 3 additions & 4 deletions static/chrome/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ if env | grep -q ROOT_CA_; then
echo ${!e} | base64 -d >/tmp/cert.pem
certutil -A -n ${certname} -t "TC,C,T" -i /tmp/cert.pem -d sql:$HOME/.pki/nssdb
if cat tmp/cert.pem | grep -q "PRIVATE KEY"; then
EMPTY_PASS=\'\'
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${EMPTY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${EMPTY_PASS}
echo ${EMPTY_PASS} > /tmp/empty.file
PRIVATE_KEY_PASS=${PRIVATE_KEY_PASS:-\'\'}
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${PRIVATE_KEY_PASS} -passin pass:${PRIVATE_KEY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${PRIVATE_KEY_PASS}
rm /tmp/key.p12
fi
rm /tmp/cert.pem
Expand Down
6 changes: 3 additions & 3 deletions static/edge/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ if env | grep -q ROOT_CA_; then
echo ${!e} | base64 -d >/tmp/cert.pem
certutil -A -n ${certname} -t "TC,C,T" -i /tmp/cert.pem -d sql:$HOME/.pki/nssdb
if cat tmp/cert.pem | grep -q "PRIVATE KEY"; then
EMPTY_PASS=\'\'
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${EMPTY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${EMPTY_PASS}
PRIVATE_KEY_PASS=${PRIVATE_KEY_PASS:-\'\'}
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${PRIVATE_KEY_PASS} -passin pass:${PRIVATE_KEY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${PRIVATE_KEY_PASS}
rm /tmp/key.p12
fi
rm /tmp/cert.pem
Expand Down
6 changes: 3 additions & 3 deletions static/firefox/selenoid/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ if env | grep -q ROOT_CA_; then
echo ${!e} | base64 -d >/tmp/cert.pem
certutil -A -n ${certname} -t "TC,C,T" -i /tmp/cert.pem -d sql:${certdir}
if cat tmp/cert.pem | grep -q "PRIVATE KEY"; then
EMPTY_PASS=\'\'
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${EMPTY_PASS}
pk12util -d sql:${certdir} -i /tmp/key.p12 -W ${EMPTY_PASS}
PRIVATE_KEY_PASS=${PRIVATE_KEY_PASS:-\'\'}
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${PRIVATE_KEY_PASS} -passin pass:${PRIVATE_KEY_PASS}
pk12util -d sql:${certdir} -i /tmp/key.p12 -W ${PRIVATE_KEY_PASS}
rm /tmp/key.p12
fi
rm /tmp/cert.pem
Expand Down
6 changes: 3 additions & 3 deletions static/opera/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ if env | grep -q ROOT_CA_; then
echo ${!e} | base64 -d >/tmp/cert.pem
certutil -A -n ${certname} -t "TC,C,T" -i /tmp/cert.pem -d sql:$HOME/.pki/nssdb
if cat tmp/cert.pem | grep -q "PRIVATE KEY"; then
EMPTY_PASS=\'\'
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${EMPTY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${EMPTY_PASS}
PRIVATE_KEY_PASS=${PRIVATE_KEY_PASS:-\'\'}
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${PRIVATE_KEY_PASS} -passin pass:${PRIVATE_KEY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${PRIVATE_KEY_PASS}
rm /tmp/key.p12
fi
rm /tmp/cert.pem
Expand Down
6 changes: 3 additions & 3 deletions static/yandex/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ if env | grep -q ROOT_CA_; then
echo ${!e} | base64 -d >/tmp/cert.pem
certutil -A -n ${certname} -t "TC,C,T" -i /tmp/cert.pem -d sql:$HOME/.pki/nssdb
if cat tmp/cert.pem | grep -q "PRIVATE KEY"; then
EMPTY_PASS=\'\'
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${EMPTY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${EMPTY_PASS}
PRIVATE_KEY_PASS=${PRIVATE_KEY_PASS:-\'\'}
openssl pkcs12 -export -in /tmp/cert.pem -clcerts -nodes -out /tmp/key.p12 -passout pass:${PRIVATE_KEY_PASS} -passin pass:${PRIVATE_KEY_PASS}
pk12util -d sql:$HOME/.pki/nssdb -i /tmp/key.p12 -W ${PRIVATE_KEY_PASS}
rm /tmp/key.p12
fi
rm /tmp/cert.pem
Expand Down

0 comments on commit 4ffbd62

Please sign in to comment.