CNs cant be arbitrary
This commit is contained in:
parent
f7776e7269
commit
8982353f0a
1 changed files with 6 additions and 5 deletions
|
|
@ -1,13 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
read -p "Enter Server CN (localhost or address): " SRVNAME
|
||||
read -p "Enter Client CN (localhost or address): " CLTNAME
|
||||
|
||||
SERVER_CA_CN=jobserv-server-ca
|
||||
SERVER_CN=jobserv-server
|
||||
SERVER_PATH=resources/server
|
||||
CLIENT_CA_CN=jobserv-client-ca
|
||||
CLIENT_CN=jobserv-client
|
||||
CLIENT_PATH=resources/client
|
||||
TEST_CA_CN=jobserv-bad-cert-ca
|
||||
TEST_CN=jobserv-bad-cert
|
||||
TEST_CN=localhost
|
||||
TEST_PATH=resources/test
|
||||
|
||||
# refactor this to test for directory existanc
|
||||
|
|
@ -43,7 +44,7 @@ openssl req -passin pass:dontusethiskey -new -x509 -days 365 -key $TEST_PATH/ca.
|
|||
echo "[+] Generating Server key"
|
||||
openssl genrsa -passout pass:${SRVCAPASS} -aes256 -out $SERVER_PATH/private.key 4096
|
||||
echo "[+] Generating Server signing request"
|
||||
openssl req -passin pass:${SRVCAPASS} -new -key $SERVER_PATH/private.key -out $SERVER_PATH/request.csr -subj "/CN=${SERVER_CN}"
|
||||
openssl req -passin pass:${SRVCAPASS} -new -key $SERVER_PATH/private.key -out $SERVER_PATH/request.csr -subj "/CN=${SRVNAME}"
|
||||
echo "[+] Generating Server certificate "
|
||||
openssl x509 -req -passin pass:${SRVCAPASS} -days 365 -in $SERVER_PATH/request.csr -CA $SERVER_PATH/ca.crt -CAkey $SERVER_PATH/ca.key -set_serial 01 -out $SERVER_PATH/server.crt
|
||||
echo "[+] Removing passphrase from server key"
|
||||
|
|
@ -53,7 +54,7 @@ openssl rsa -passin pass:${SRVCAPASS} -in $SERVER_PATH/private.key -out $SERVER_
|
|||
echo "[+] Generating Client key"
|
||||
openssl genrsa -passout pass:${CLTCAPASS} -aes256 -out $CLIENT_PATH/private.key 4096
|
||||
echo "[+] Generating Client signing request"
|
||||
openssl req -passin pass:${CLTCAPASS} -new -key $CLIENT_PATH/private.key -out $CLIENT_PATH/request.csr -subj "/CN=${CLIENT_CN}"
|
||||
openssl req -passin pass:${CLTCAPASS} -new -key $CLIENT_PATH/private.key -out $CLIENT_PATH/request.csr -subj "/CN=${CLTNAME}"
|
||||
echo "[+] Generating Client certificate "
|
||||
openssl x509 -req -passin pass:${CLTCAPASS} -days 365 -in $CLIENT_PATH/request.csr -CA $CLIENT_PATH/ca.crt -CAkey $CLIENT_PATH/ca.key -set_serial 01 -out $CLIENT_PATH/client.crt
|
||||
echo "[+] Removing passphrase from client key"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue