#yum install expect
2.修改 web webb 參數為目標網址
#!/bin/bash
date=$(date +%Y%m%d%H%M)
web='abc123'
webb='abc123.info'
cd /etc/pki/tls/certs
expect -c "
spawn make $web.key
expect \"phrase:\"
send \"0000\n\"
expect \"phrase:\"
send \"0000\n\"
expect eof
"
mv $web.key $web.raw
expect -c "
spawn openssl rsa -in $web.raw -out $web.key
expect \"raw:\"
send \"0000\n\"
expect eof
"
rm -rf $web.raw
chmod 400 $web.key
expect -c "
spawn make $web.crt SERIAL=$date
expect \"]\"
send \"\n\"
expect \"]\"
send \"\n\"
expect \"]\"
send \"\n\"
expect \"]\"
send \"\n\"
expect \"]\"
send \"\n\"
expect \"]\"
send \"$webb\n\"
expect \"]\"
send \"admin@$webb\n\"
expect eof
"
reference:
鳥哥的 Linux 私房菜
expect學習筆記及實例詳解
0 意見:
張貼留言