-
Notifications
You must be signed in to change notification settings - Fork 5
/
le.sh
74 lines (74 loc) · 2.59 KB
/
le.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
#!/bin/bash
#clear
echo "Usage(testing): le.sh domain www.domain.com,domain.com /path/to/webdomain/files/ -t";
echo "Usage(live): le.sh domain www.domain.com,domain.com /path/to/webdomain/files/ -l";
echo "Usage(renewal - 7 days before expiration automatically): le.sh domain www.domain.com,domain.com /path/to/webdomain/files/ -r";
echo;
sw="/root/software";
skeys="/root/software/keys";
cd $skeys
if [[ $1 = "" ]]; then
echo "First argument: domain is required!";
cd $sw
exit
else
if [[ -d "$1.keys" ]]; then
cd $1.keys;
else
mkdir $1.keys && cd $1.keys
fi
if [[ $4 = "-t" ]]; then
if [[ $2 = "" ]]; then
echo "Domain name(s) is/are required!";
exit
fi
if [[ $3 = "" ]]; then
echo "Path to webdomain files is required!";
exit
fi
echo "Testing...";
if [[ ! -d $3.well-known/acme-challenge/ ]]; then
mkdir -p $3.well-known/acme-challenge/
fi
echo `le.pl --key account.key --csr $1.csr --csr-key $1.key --crt $1.crt --domains "$2" --path $3.well-known/acme-challenge/ --generate-missing --unlink`
cd $sw
exit
fi
if [[ $4 = "-l" ]]; then
if [[ $2 = "" ]]; then
echo "Domain name(s) is/are required!";
exit
fi
if [[ $3 = "" ]]; then
echo "Path to webdomain files is required!";
exit
fi
echo "Generating live certificates...";
if [[ ! -d $3.well-known/acme-challenge/ ]]; then
mkdir -p $3.well-known/acme-challenge/
fi
echo `le.pl --key account.key --csr $1.csr --csr-key $1.key --crt $1.crt --domains "$2" --path $3.well-known/acme-challenge/ --generate-missing --unlink --live`
cd $sw
exit
fi
if [[ $4 = "-r" ]]; then
if [[ $2 = "" ]]; then
echo "Domain name(s) is/are required!";
exit
fi
if [[ $3 = "" ]]; then
echo "Path to webdomain files is required!";
exit
fi
echo "Renewing...";
if [[ ! -d $3.well-known/acme-challenge/ ]]; then
mkdir -p $3.well-known/acme-challenge/
fi
echo `le.pl --key account.key --csr $1.csr --csr-key $1.key --crt $1.crt --domains "$2" --path $3.well-known/acme-challenge/ --generate-missing --unlink --renew 7 --live`
cd $sw
exit
fi
echo "You didn't supply all the required arguments!";
cd $sw
exit
fi