-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathcertbot_staging.sh
More file actions
executable file
·60 lines (44 loc) · 1.71 KB
/
Copy pathcertbot_staging.sh
File metadata and controls
executable file
·60 lines (44 loc) · 1.71 KB
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
#!/bin/bash
#Set Font Colors
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
#The script below assumes you have a install docker
#Ensure Script is run as root and if not exit
if [ `id -u` -ne 0 ]; then
echo "${RED}This script must be executed as root, Exiting... ${RESET}"
exit 1
fi
#Check if /usr/bin/docker exists and if not exit
if [ ! -f "/usr/bin/docker" ]; then
echo "${RED}Docker does not seem to be installed. Please install Docker and try again. Exiting for now... ${RESET}"
exit 1
fi
#GET INPUTS
echo "Certbot Certificate Staging" | boxes -d stone -p a2v1
PS3='Ensure that both ports 80/TCP and 443/TCP are Internet accessible and the Hermes SEG FQDN you are going to use is pointing to the public IP address of this machine. Do you wish to continue?: '
options=("Yes" "No")
select opt in "${options[@]}"
do
case $opt in
"Yes")
echo "Starting Certbot Certificate Staging"
break
;;
"No")
echo "Exiting Certbot Certificate Staging";
exit
;;
*) echo "invalid option $REPLY";;
esac
done
#=== GET USER INPUTS STARTS HERE ===
read -p "Enter the FQDN of your Hermes SEG (Example: smtp.domain.tld):" HERMES_FQDN
if [ -z "$HERMES_FQDN" ]
then
echo "${RED}The Hermes FQDN cannot be empty ${RESET}"
exit
fi
#Export the variable
export HERMES_FQDN
docker run -it --rm --name hermes_certbot -v ./config/hermes/var/www/html:/var/www/certbot -v ./config/certbot/conf:/etc/letsencrypt -v ./config/certbot/logs:/var/log certbot/certbot:latest certonly --webroot --webroot-path /var/www/certbot --email someone@example.com --agree-tos --no-eff-email --dry-run -d $HERMES_FQDN