forked from hernandito/Apache-LetsEncrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXuserscript.sh
41 lines (32 loc) · 1017 Bytes
/
Xuserscript.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
40
41
#!/bin/bash
crontab /config/crons.conf
# May or may not have HOME set, and this drops stuff into ~/.local.
export HOME="/root"
export PATH="${PATH}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
if [ ! -f /etc/letsencrypt/cli.ini ]; then
apt-get update
apt-get install -y mc
mkdir -p /etc/letsencrypt
cat > /etc/letsencrypt/cli.ini <<EOF
# Uncomment to use the staging/testing server - avoids rate limiting.
# server = https://acme-staging.api.letsencrypt.org/directory
# Use a 4096 bit RSA key instead of 2048.
rsa-key-size = 4096
# Set email and domains.
email = "$YOUR_EMAIL"
domains = "$YOUR_DOMAIN"
# Text interface.
text = True
# No prompts.
non-interactive = True
# Suppress the Terms of Service agreement interaction.
agree-tos = True
# Use the webroot authenticator.
authenticator = webroot
webroot-path = /var/www/html
EOF
cd /defaults
certbot-auto --noninteractive --os-packages-only
# Obtain cert.
/config/dl.eff.org/certbot-auto certonly --noninteractive --agree-tos
fi