Compare commits

...

2 Commits

Author SHA1 Message Date
rohhie e9af069d86 Add setup helper 2023-05-28 14:46:57 +00:00
rohhie 9c83f0057a Apache communicates via HTTP/2 2023-05-28 14:45:44 +00:00
2 changed files with 101 additions and 1 deletions

99
00-setup-helper.sh Executable file
View File

@ -0,0 +1,99 @@
#!/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

View File

@ -94,7 +94,7 @@ sudo a2ensite example.net gitea kopano test
[ ! -d /var/www/test ] && sudo mkdir /var/www/test && sudo chown $(whoami):$(whoami) /var/www/test [ ! -d /var/www/test ] && sudo mkdir /var/www/test && sudo chown $(whoami):$(whoami) /var/www/test
secho 3 "=== モジュールの有効化" secho 3 "=== モジュールの有効化"
sudo a2enmod ssl rewrite proxy_http headers sudo a2enmod ssl rewrite proxy_http headers http2
secho 3 "=== 警告を止める設定" secho 3 "=== 警告を止める設定"
echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf > /dev/null echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf > /dev/null
@ -222,4 +222,5 @@ echo "================================================"
echo "8" > $SCRIPTHOME/.setupphase.txt echo "8" > $SCRIPTHOME/.setupphase.txt
secho 3 "=== セットアップ完了" secho 3 "=== セットアップ完了"
echo "rmvコマンドが正しく動作するように、一度端末を開き直してください"
exit exit