Merge branch 'dickeylth-master'

This commit is contained in:
OttoMao 2016-04-29 14:12:53 +08:00
commit b4a2d88186
3 changed files with 14 additions and 14 deletions

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
#Required #Required
domain=$1 domain=$1
outputPath=$2 outputPath=$2
commonname=$domain commonname=$domain
#Change to your company details #Change to your company details
country=ZH country=ZH
state=Shanghai state=Shanghai
@ -12,20 +12,20 @@ locality=Shanghai
organization=a.com organization=a.com
organizationalunit=IT organizationalunit=IT
email=a@b.com email=a@b.com
#Optional #Optional
password=a password=a
if [ -z "$domain" ] if [ -z "$domain" ]
then then
echo "Argument not present." echo "Argument not present."
echo "Useage $0 [domain] [outputPath]" echo "Useage $0 [domain] [outputPath]"
exit 99 exit 99
fi fi
echo "Generating key request for $outputPath$domain" echo "Generating key request for $outputPath$domain"
#Generate a key #Generate a key
# openssl genrsa -out host.key 2048 # openssl genrsa -out host.key 2048
# openssl genrsa -des3 -out $outputPath$domain.key 2048 -noout # openssl genrsa -des3 -out $outputPath$domain.key 2048 -noout
@ -35,14 +35,14 @@ openssl genrsa -passout pass:$password -out $outputPath$domain.key 2048
#Remove passphrase from the key. Comment the line out to keep the passphrase #Remove passphrase from the key. Comment the line out to keep the passphrase
echo "Removing passphrase from key" echo "Removing passphrase from key"
openssl rsa -in $outputPath$domain.key -passin pass:$password -out $outputPath$domain.key openssl rsa -in $outputPath$domain.key -passin pass:$password -out $outputPath$domain.key
#Create the request #Create the request
echo "Creating CSR" echo "Creating CSR"
openssl req -new -key $outputPath$domain.key -out $outputPath$domain.csr -passin pass:$password \ openssl req -sha256 -new -key $outputPath$domain.key -out $outputPath$domain.csr -passin pass:$password \
-subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email" -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"
#Generating a Self-Signed Certificate #Generating a Self-Signed Certificate
openssl x509 -req -days 365 -in $outputPath$domain.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out $outputPath$domain.crt openssl x509 -req -sha256 -days 3650 -in $outputPath$domain.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out $outputPath$domain.crt
# -signkey $outputPath$domain.key # -signkey $outputPath$domain.key
#openssl x509 -req -in host.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out host.crt -days 365 #openssl x509 -req -in host.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out host.crt -days 365
echo "Finished" echo "Finished"

View File

@ -21,7 +21,7 @@ echo Removing passphrase from key
openssl rsa -in %domain%.key -passin pass:%password% -out %domain%.key openssl rsa -in %domain%.key -passin pass:%password% -out %domain%.key
echo Creating CSR echo Creating CSR
openssl req -new -key %domain%.key -out %domain%.csr -passin pass:%password% -subj /C=%country%/ST=%state%/L=%locality%/O=%organization%/OU=%organizationalunit%/CN=%commonname%/emailAddress=%email% openssl req -sha256 -new -key %domain%.key -out %domain%.csr -passin pass:%password% -subj /C=%country%/ST=%state%/L=%locality%/O=%organization%/OU=%organizationalunit%/CN=%commonname%/emailAddress=%email%
openssl x509 -req -days 3650 -in %domain%.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out %domain%.crt openssl x509 -req -sha256 -days 3650 -in %domain%.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out %domain%.crt
echo Finished echo Finished

View File

@ -3,7 +3,7 @@
outputPath=$1 outputPath=$1
cd $outputPath cd $outputPath
openssl genrsa -out rootCA.key 2048 openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -days 36500 -out rootCA.crt \ openssl req -sha256 -x509 -new -nodes -key rootCA.key -days 36500 -out rootCA.crt \
-subj "/C=CN/ST=SH/L=SH/O=AnyProxy/OU=Section/CN=Anyproxy SSL Proxying/emailAddress=AnyProxy@AnyProxy" -subj "/C=CN/ST=SH/L=SH/O=AnyProxy/OU=Section/CN=Anyproxy SSL Proxying/emailAddress=AnyProxy@AnyProxy"
echo "=============" echo "============="
echo "rootCA generated at :" echo "rootCA generated at :"