Skip to content

Instantly share code, notes, and snippets.

@t-cyrill
Last active August 29, 2015 14:02
Show Gist options
  • Save t-cyrill/1a1bd2a85ab597189525 to your computer and use it in GitHub Desktop.
Save t-cyrill/1a1bd2a85ab597189525 to your computer and use it in GitHub Desktop.
SSL csr auto-generate scripts.
#!/usr/bin/expect -f
set timeout 5
spawn openssl genrsa -out server.key -aes128 2048
expect "Enter pass phrase"
send "pass phrase\n"
expect "Verifying - Enter pass phrase"
send "pass phrase\n"
interact
spawn openssl req -new -key server.key -out server.csr
expect "Enter pass phrase"
send "pass phrase\n"
expect "Country Name"
send "JP\n"
expect "State or Province Name "
send "Tokyo\n"
expect "Locality Name"
send "Tokyo\n"
expect "Organization Name"
send "foo\n"
expect "Organizational Unit Name"
send "bar\n"
expect "Common Name "
send "localhost\n"
expect "Email Address"
send "\n"
expect "A challenge password "
send "\n"
expect "An optional company name "
send "\n"
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment