Last active
March 3, 2017 21:20
-
-
Save mokapyo/9dda1c89395a90ec04abcdd05db17a41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#apt-get -y install expect | |
### define parameter | |
dirname=/etc/ssl/www.piyoweb.com | |
keyname=web.key | |
keypass=piyoweb | |
cername=web.csr | |
IPaddr=192.168.1.7 | |
### | |
mkdir $dirname | |
cd $dirname | |
expect -c " | |
set timeout 5 | |
spawn openssl genrsa -des3 -out ./$keyname 2048 | |
expect \"pass\" | |
send \"$keypass\n\" | |
expect \"Verifying\" | |
send \"$keypass\n\" | |
expect \"$\" | |
exit 0 | |
" | |
expect -c " | |
set timeout 5 | |
spawn openssl req -new -key ./$keyname -out ./$cername | |
expect \"Country\" | |
send \"JP\n\" | |
expect \"State\" | |
send \"Kanagawa\n\" | |
expect \"Locality\" | |
send \"Zama\n\" | |
expect \"company\" | |
send \"Company\n\" | |
expect \"Unit\" | |
send \"Unit\n\" | |
expect \"Common\" | |
send \"$IPaddr\n\" | |
expect \"Email\" | |
send \"a@a.com\n\" | |
expect \"challenge\" | |
send \"challenge\n\" | |
expect \"optional\" | |
send \"\n\" | |
expect \"$\" | |
exit 0 | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment