#!/bin/bash
exit 0

apt install haveged

apt-get install letsencrypt python-certbot-apache

# XXX change www1 to the right host name.
# XXX DNS setup
certbot									\
	--authenticator standalone					\
	--installer apache						\
	-d www.forksand.com,www1.forksand.com				\
	--email letsencrypt@forksand.com				\
	--pre-hook "service apache2 stop"				\
	--post-hook "service apache2 start"

rm /etc/apache2/sites-enabled/default-ssl.conf

service apache2 restart


exit 0
# Notes:
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)
-------------------------------------------------------------------------------
1: default-ssl.conf               |                       | HTTPS |
2: 000-default.conf               |                       |       | Enabled
3: 000-default-le-ssl.conf        | www.forksand.com      | HTTPS | Enabled
-------------------------------------------------------------------------------
Select the appropriate number [1-3] then [enter] (press 'c' to cancel): 3
Deploying Certificate to VirtualHost /etc/apache2/sites-available/000-default-le-ssl.conf

1: Easy - Allow both HTTP and HTTPS access to these sites
2: Secure - Make all requests redirect to secure HTTPS access
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2