-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathencrypt.bash
More file actions
29 lines (23 loc) · 867 Bytes
/
encrypt.bash
File metadata and controls
29 lines (23 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
if [ -z $1 ] || [ -z $2 ] ; then
echo "Please run command as: $0 domain.com domain.com,www.domain.com"
exit
fi
# Install git
if which git ; then
NOTHINGTOSEEHERE=0
else
apt-get update
apt-get install -y git
fi
# checkout etsencrypt
if [ -d /opt/letsencrypt ] ; then
NOTHINGTOSEEHERE=0
else
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
fi
# Request certificates
/opt/letsencrypt/letsencrypt-auto certonly --email ssl_certificates_letsencrypt@$1 --agree-tos --webroot --renew-by-default -w /home/$1/public_html/ -d $2 --authenticator webroot
# Activate SSL cert
virtualmin enable-feature --domain $1 --ssl
virtualmin install-cert --domain $1 --cert /etc/letsencrypt/live/$1/cert.pem --key /etc/letsencrypt/live/$1/privkey.pem --ca /etc/letsencrypt/live/$1/fullchain.pem