-
Notifications
You must be signed in to change notification settings - Fork 1
/
certbot-sysmd.sh
executable file
·105 lines (93 loc) · 2.88 KB
/
certbot-sysmd.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
file="/etc/systemd/system/certbot.service"
function apache_alone {
if [ $? -eq 0 ]
then
if [[ -e "$file" ]]; then
echo Configuration files exist. You all good.
else
echo "Copying apache service file..."
cp lib/certbot.timer /etc/systemd/system/certbot.timer
cp lib/certbot-apache-standalone.service /etc/systemd/system/certbot.service
systemctl enable certbot.timer && systemctl start certbot.timer
echo "Timer enabled to renew Certificate. Checks renewal twice daily! :)"
fi
else
echo "Service/Timer configuration failed :("
fi
}
function nginx_alone {
if [ $? -eq 0 ]
then
if [[ -e "$file" ]]; then
echo Configuration files exist. You all good.
else
echo "Copying nginx service file... "
cp lib/certbot.timer /etc/systemd/system/certbot.timer
cp lib/certbot-nginx-standalone.service /etc/systemd/system/certbot.service
systemctl enable certbot.timer && systemctl start certbot.timer
echo "Timer enabled to renew Certificate. Checks renewal twice daily! :)"
fi
else
echo "Service/Timer configuration failed :("
fi
}
function apache {
if [ $? -eq 0 ]
then
if [[ -e "$file" ]]; then
echo Configuration files exist. You all good.
else
echo "Copying apache service file..."
cp lib/certbot-apache.service /etc/systemd/system/certbot.service
cp lib/certbot.timer /etc/systemd/system/certbot.timer
systemctl enable certbot.timer && systemctl start certbot.timer
echo "Timer enabled to renew Certificate. Checks renewal twice daily! :)"
fi
else
echo "Service/Timer configuration failed :("
fi
}
function nginx {
if [ $? -eq 0 ]
then
if [[ -e "$file" ]]; then
echo Configuration files exist. You all good.
else
echo "Copying nginx service file..."
cp lib/certbot-nginx.service /etc/systemd/system/certbot.service
cp lib/certbot.timer /etc/systemd/system/certbot.timer
systemctl enable certbot.timer && systemctl start certbot.timer
echo "Timer enabled to renew Certificate. Checks renewal twice daily! :)"
fi
else
echo "Service/Timer configuration failed :("
fi
}
PS3="Please select your current webserver configuration:"
OPTIONS="Apache Apache-standalone Nginx-standalone Nginx Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Apache" ]; then
apache
echo Apache Timer/Service configuration complete.
exit
elif [ "$opt" = "Nginx" ]; then
nginx
echo Nginx Timer/Service configuration complete.
exit
elif [ "$opt" = "Apache-standalone" ]; then
apache_alone
echo Apache Timer/Service configuration complete.
exit
elif [ "$opt" = "Nginx-standalone" ]; then
nginx_alone
echo Nginx Timer/Service configuration complete.
exit
elif [ "$opt" = "Quit" ]; then
echo Goodbye.
exit
else
clear
echo Bad option
fi
done