iankelling.org
/
git
/
basic-https-conf
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make nginx script have roughly parity
[basic-https-conf]
/
apache-site
diff --git
a/apache-site
b/apache-site
index 4550e85f5b55ee15eba1617444f4e6ceafdc1ec6..9a22d2aad73a308d4bffc0b4fd6c6e2a85e2dcf7 100755
(executable)
--- a/
apache-site
+++ b/
apache-site
@@
-26,10
+26,10
@@
ssl config provided by let's encrypt and my standard
location for storing certs.
EXTRA_SETTINGS_FILE can be - for stdin
location for storing certs.
EXTRA_SETTINGS_FILE can be - for stdin
--p PORT
--i Insecure, no ssl
-c CERT_DIR In priority: this arg, $ACME_TINY_WRAPPER_CERT_DIR,
$HOME/webservercerts, if the other options aren't set.
-c CERT_DIR In priority: this arg, $ACME_TINY_WRAPPER_CERT_DIR,
$HOME/webservercerts, if the other options aren't set.
+-i Insecure, no ssl
+-p PORT Main port to listen on, default 443
-r DocumentRoot
-h|--help Print help and exit
-r DocumentRoot
-h|--help Print help and exit
@@
-62,9
+62,9
@@
while true; do
done
if (( ${#@} == 2 )); then
done
if (( ${#@} == 2 )); then
- read
extra_settings h <<<"${args[@]
}"
+ read
-r extra_settings h <<<"${@
}"
else
else
- read
h <<<"${args[@]
}"
+ read
-r h <<<"${@
}"
fi
if [[ ! $h ]]; then
fi
if [[ ! $h ]]; then
@@
-94,7
+94,8
@@
fi
rm -f /etc/apache2/sites-enabled/000-default.conf
mkdir -p $root
rm -f /etc/apache2/sites-enabled/000-default.conf
mkdir -p $root
-dd of=/etc/apache2/sites-enabled/$h.conf <<EOF
+vhost_file=/etc/apache2/sites-enabled/$h.conf
+cat >$vhost_file <<EOF
<VirtualHost $port>
ServerName $h
ServerAlias www.$h
<VirtualHost $port>
ServerName $h
ServerAlias www.$h
@@
-102,26
+103,30
@@
dd of=/etc/apache2/sites-enabled/$h.conf <<EOF
EOF
if [[ $extra_settings ]]; then
EOF
if [[ $extra_settings ]]; then
- cat -- $extra_settings | tee -a
/etc/apache2/sites-enabled/$h.conf
+ cat -- $extra_settings | tee -a
$vhost_file
fi
# go faster!
if [[ -e /etc/apache2/mods-available/http2.load ]]; then
# https://httpd.apache.org/docs/2.4/mod/mod_http2.html
a2enmod http2
fi
# go faster!
if [[ -e /etc/apache2/mods-available/http2.load ]]; then
# https://httpd.apache.org/docs/2.4/mod/mod_http2.html
a2enmod http2
-tee -a
/etc/apache2/sites-enabled/$h.conf
<<EOF
+tee -a
$vhost_file
<<EOF
Protocols h2 http/1.1
EOF
fi
if $ssl; then
Protocols h2 http/1.1
EOF
fi
if $ssl; then
- tee -a /etc/apache2/sites-enabled/$h.conf <<EOF
+ certbot_ssl_conf=/etc/letsencrypt/options-ssl-apache.conf
+ tee -a $vhost_file <<EOF
SSLCertificateFile $cert_dir/$h-chained.pem
SSLCertificateKeyFile $cert_dir/$h-domain.key
SSLCertificateFile $cert_dir/$h-chained.pem
SSLCertificateKeyFile $cert_dir/$h-domain.key
- Include
/etc/letsencrypt/options-ssl-apache.
conf
+ Include
$certbot_ssl_
conf
EOF
dd of=/etc/apache2/sites-enabled/httpsredir.conf <<'EOF'
EOF
dd of=/etc/apache2/sites-enabled/httpsredir.conf <<'EOF'
+# vhost_combined with %D (request time in microseconds)
+# this file is just a convenient place to drop it.
+LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %D" vhost_time_combined
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
@@
-138,9
+143,8
@@
EOF
mkdir -p /etc/letsencrypt
mkdir -p /etc/letsencrypt
- base_file=/etc/letsencrypt/options-ssl-apache.conf
# this is from cerbot, see below.
# this is from cerbot, see below.
-
dd of=$base_file
<<'EOF'
+
cat >$certbot_ssl_conf
<<'EOF'
# Baseline setting to Include for SSL sites
SSLEngine on
# Baseline setting to Include for SSL sites
SSLEngine on
@@
-166,7
+170,7
@@
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
EOF
upstream=https://github.com/certbot/certbot/raw/master/certbot-apache/certbot_apache/options-ssl-apache.conf
EOF
upstream=https://github.com/certbot/certbot/raw/master/certbot-apache/certbot_apache/options-ssl-apache.conf
- if ! diff -c <(wget -q -O - $upstream) $
base_file
; then
+ if ! diff -c <(wget -q -O - $upstream) $
certbot_ssl_conf
; then
cat <<EOF
WARNING!!!!!!!!!
WARNING!!!!!!!!!
cat <<EOF
WARNING!!!!!!!!!
WARNING!!!!!!!!!
@@
-175,15
+179,15
@@
WARNING!!!!!!!!!
WARNING!!!!!!!!!
upstream ssl settings differ from the snapshot we have taken!!!
We diffed with this command:
WARNING!!!!!!!!!
upstream ssl settings differ from the snapshot we have taken!!!
We diffed with this command:
-diff -c <(wget -q -O - $upstream) $
base_file
+diff -c <(wget -q -O - $upstream) $
certbot_ssl_conf
Update this script to take care this warning!!!!!
EOF
sleep 1
fi
fi
Update this script to take care this warning!!!!!
EOF
sleep 1
fi
fi
-tee -a
/etc/apache2/sites-enabled/$h.conf
<<EOF
+tee -a
$vhost_file
<<EOF
ErrorLog \${APACHE_LOG_DIR}/error.log
ErrorLog \${APACHE_LOG_DIR}/error.log
- CustomLog \${APACHE_LOG_DIR}/access.log vhost_combined
+ CustomLog \${APACHE_LOG_DIR}/access.log vhost_
time_
combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet