100 lines
2.6 KiB
Bash
100 lines
2.6 KiB
Bash
|
#!/bin/bash
|
||
|
CAPASS="passwordca"
|
||
|
SVPASS="passwordsv"
|
||
|
|
||
|
# このスクリプトはexpectコマンドを使用しています。
|
||
|
# インストールしてから使ってください。
|
||
|
# sudo apt -y install expect
|
||
|
|
||
|
expect <<EOF
|
||
|
set timeout -1
|
||
|
spawn ./01-setup.sh
|
||
|
|
||
|
expect -re {\[sudo\] password for .*:} {
|
||
|
stty -echo
|
||
|
interact -u tty_spawn_id -o "\r" return
|
||
|
stty echo
|
||
|
}
|
||
|
|
||
|
expect -re {CA certificate filename \(or enter to create\)}
|
||
|
send \r
|
||
|
expect -re {Enter PEM pass phrase:}
|
||
|
send ${CAPASS}\r
|
||
|
expect -re {Verifying - Enter PEM pass phrase:}
|
||
|
send ${CAPASS}\r
|
||
|
expect -re {Country Name \(2 letter code\) \[JA\]:}
|
||
|
send \r
|
||
|
expect -re {State or Province Name \(full name\)}
|
||
|
send \r
|
||
|
expect -re {Locality Name \(eg, city\) \[Chiyoda\]:}
|
||
|
send \r
|
||
|
expect -re {Organization Name \(eg, company\) \[Example Networks Inc\.\]:}
|
||
|
send \r
|
||
|
expect -re {Organizational Unit Name \(eg, section\) \[\]:}
|
||
|
send \r
|
||
|
expect -re {Common Name \(e\.g\. server FQDN or YOUR name\) \[example\.net\]:}
|
||
|
send \r
|
||
|
expect -re {Email Address \[webmaster@example\.net\]:}
|
||
|
send \r
|
||
|
expect -re {A challenge password \[\]:}
|
||
|
send \r
|
||
|
expect -re {An optional company name \[\]:}
|
||
|
send \r
|
||
|
expect -re {Enter pass phrase for .*/cakey\.pem:}
|
||
|
send ${CAPASS}\r
|
||
|
|
||
|
expect -re {Enter PEM pass phrase:}
|
||
|
send ${SVPASS}\r
|
||
|
expect -re {Verifying - Enter PEM pass phrase:}
|
||
|
send ${SVPASS}\r
|
||
|
expect -re {Country Name \(2 letter code\) \[JA\]:}
|
||
|
send \r
|
||
|
expect -re {State or Province Name \(full name\) \[Tokyo\]:}
|
||
|
send \r
|
||
|
expect -re {Locality Name \(eg, city\) \[Chiyoda\]:}
|
||
|
send \r
|
||
|
expect -re {Organization Name \(eg, company\) \[Example Networks Inc\.\]:}
|
||
|
send \r
|
||
|
expect -re {Organizational Unit Name \(eg, section\) \[\]:}
|
||
|
send \r
|
||
|
expect -re {Common Name \(e\.g\. server FQDN or YOUR name\) \[example\.net\]:}
|
||
|
send \r
|
||
|
expect -re {Email Address \[webmaster@example\.net\]:}
|
||
|
send \r
|
||
|
expect -re {A challenge password \[\]:}
|
||
|
send \r
|
||
|
expect -re {An optional company name \[\]:}
|
||
|
send \r
|
||
|
|
||
|
expect -re {Enter pass phrase for .*/cakey\.pem:}
|
||
|
send ${CAPASS}\r
|
||
|
|
||
|
expect -re {Sign the certificate\? \[y/n\]:}
|
||
|
send y\r
|
||
|
expect -re {1 out of 1 certificate requests certified, commit\? \[y/n\]}
|
||
|
send y\r
|
||
|
|
||
|
expect -re {Enter pass phrase for newkey\.pem:}
|
||
|
send ${SVPASS}\r
|
||
|
|
||
|
expect -re {Enter passphrase \(empty for no passphrase\):}
|
||
|
send \r
|
||
|
expect -re {Enter same passphrase again:}
|
||
|
send \r
|
||
|
|
||
|
expect -re {Enter passphrase \(empty for no passphrase\):}
|
||
|
send \r
|
||
|
expect -re {Enter same passphrase again:}
|
||
|
send \r
|
||
|
|
||
|
expect -re {コピーが終わったらEnterキーを押してください。} {
|
||
|
interact -u tty_spawn_id -o "\r" return
|
||
|
}
|
||
|
|
||
|
expect -re {IPアドレス:} {
|
||
|
interact -u tty_spawn_id -o "\r" return
|
||
|
}
|
||
|
|
||
|
expect eof
|
||
|
EOF
|