-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
40 lines (37 loc) · 1.27 KB
/
setup.sh
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
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env sh
# Setup
set -x
HOME=/var/acme
CONF=/var/acme
mkdir -p $HOME/http
mkdir -p $CONF
cd $HOME
mount -o "remount,exec" /var
curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh -o acme.sh
chmod +x acme.sh
curl https://raw.githubusercontent.com/helsinki-systems/sophos-xgs-letsencrypt/main/renew.sh -o renew.sh
chmod +x renew.sh
curl https://raw.githubusercontent.com/helsinki-systems/sophos-xgs-letsencrypt/main/setup.sh -o setup.sh
chmod +x setup.sh
if [ -e /var/acme/config.csv ]
then
echo "config file already exists, skipping"
else
curl https://raw.githubusercontent.com/helsinki-systems/sophos-xgs-letsencrypt/main/config.csv -o $CONF/config.csv
fi
chmod +x $HOME/acme.sh
if [ -e /var/acme/ca/acme-v02.api.letsencrypt.org/directory/account.json ]
then
echo "Account already registered (/var/acme/ca/.. exists)"
else
echo "Please insert letsencrypt account email"
read email
$HOME/acme.sh --config-home $CONF --register-account -m $email --server letsencrypt
fi
mount -o "remount,noexec" /var
## install on boot
mount -o remount,rw /
curl https://raw.githubusercontent.com/helsinki-systems/sophos-xgs-letsencrypt/main/S01acme -o /etc/rc.d/S01acme
chmod +x /etc/rc.d/S01acme
mount -o remount,ro /
echo "Installed sophos-xgs-letsencrypt"