-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathle-dns.sh
More file actions
117 lines (105 loc) · 3.39 KB
/
Copy pathle-dns.sh
File metadata and controls
117 lines (105 loc) · 3.39 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
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
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
BASEPATH=$(cd `dirname $0`; pwd)
CONFIG0=$1
CONFIG1=$BASEPATH/$1
CONFIG2=$BASEPATH/le-dns.conf
if [ -f "$CONFIG0" ];then
. "$CONFIG0"
DIRNAME=$(dirname "$CONFIG0")
cd "$DIRNAME" || exit 1
export CONFIG=$CONFIG0
else
if [ -f "$CONFIG1" ];then
. "$CONFIG1"
DIRNAME=$(dirname "$CONFIG1")
cd "$DIRNAME" || exit 1
export CONFIG=$CONFIG1
else
if [ -f "$CONFIG2" ];then
. "$CONFIG2"
DIRNAME=$(dirname "$CONFIG2")
cd "$DIRNAME" || exit 1
export CONFIG=$CONFIG2
else
echo "ERROR CONFIG."
exit 1
fi
fi
fi
if [ ! -f "letsencrypt.sh" ];then
wget https://raw.githubusercontent.com/Mr-Fook/dehydrated/master/dehydrated -O letsencrypt.sh -o /dev/null
chmod +x letsencrypt.sh
fi
if [ "$API" = "cloudxns" ];then
if [ ! -f "cloudxns.sh" ];then
wget https://raw.githubusercontent.com/Mr-Fook/le-dns-shell/master/cloudxns.sh -O cloudxns.sh -o /dev/null
chmod +x cloudxns.sh
fi
if [ ! -f "cloudxns-hook.sh" ];then
wget https://raw.githubusercontent.com/Mr-Fook/le-dns-shell/master/cloudxns-hook.sh -O cloudxns-hook.sh -o /dev/null
chmod +x cloudxns-hook.sh
fi
fi
if [ "$API" = "dnspod" ];then
if [ ! -f "dnspod.sh" ];then
wget https://raw.githubusercontent.com/Mr-Fook/le-dns-shell/master/dnspod.sh -O dnspod.sh -o /dev/null
chmod +x dnspod.sh
fi
if [ ! -f "dnspod-hook.sh" ];then
wget https://raw.githubusercontent.com/Mr-Fook/le-dns-shell/master/dnspod-hook.sh -O dnspod-hook.sh -o /dev/null
chmod +x dnspod-hook.sh
fi
fi
if [ "$API" = "cloudflare" ];then
if [ ! -f "cloudflare.sh" ];then
wget https://raw.githubusercontent.com/Mr-Fook/le-dns-shell/master/cloudflare.sh -O cloudflare.sh -o /dev/null
chmod +x cloudflare.sh
fi
if [ ! -f "cloudflare-hook" ];then
wget https://raw.githubusercontent.com/Mr-Fook/le-dns-shell/master/cloudflare-hook.sh -O cloudflare-hook.sh -o /dev/null
chmod +x cloudflare-hook.sh
fi
fi
echo "$CERT_DOMAINS" > domains.txt
if [ -d "$BASEPATH/accounts" ];then
echo "Already registered."
else
./letsencrypt.sh --register --accept-terms
echo "Registration completed."
fi
if [ "$API" = "cloudxns" ];then
if [ "$CERTTYPE" = "ECC" ];then
./letsencrypt.sh -c -x -k ./cloudxns-hook.sh -t dns-01 -a "$KEY" -o "$CERTPATH"
fi
if [ "$CERTTYPE" = "RSA" ];then
./letsencrypt.sh -c -x -k ./cloudxns-hook.sh -t dns-01 -o "$CERTPATH"
fi
if [ "$CERTTYPE" = "BOTH" ];then
./letsencrypt.sh -c -x -k ./cloudxns-hook.sh -t dns-01 -a "$KEY" -o "$CERTPATH"/ecc
./letsencrypt.sh -c -x -k ./cloudxns-hook.sh -t dns-01 -o "$CERTPATH"/non_ecc
fi
fi
if [ "$API" = "dnspod" ];then
if [ "$CERTTYPE" = "ECC" ];then
./letsencrypt.sh -c -x -k ./dnspod-hook.sh -t dns-01 -a "$KEY" -o "$CERTPATH"
fi
if [ "$CERTTYPE" = "RSA" ];then
./letsencrypt.sh -c -x -k ./dnspod-hook.sh -t dns-01 -o "$CERTPATH"
fi
if [ "$CERTTYPE" = "BOTH" ];then
./letsencrypt.sh -c -x -k ./dnspod-hook.sh -t dns-01 -a "$KEY" -o "$CERTPATH"/ecc
./letsencrypt.sh -c -x -k ./dnspod-hook.sh -t dns-01 -o "$CERTPATH"/non_ecc
fi
fi
if [ "$API" = "cloudflare" ];then
if [ "$CERTTYPE" = "ECC" ];then
./letsencrypt.sh -c -x -k ./cloudflare-hook.sh -t dns-01 -a "$KEY" -o "$CERTPATH"
fi
if [ "$CERTTYPE" = "RSA" ];then
./letsencrypt.sh -c -x -k ./cloudflare-hook.sh -t dns-01 -o "$CERTPATH"
fi
if [ "$CERTTYPE" = "BOTH" ];then
./letsencrypt.sh -c -x -k ./cloudflare-hook.sh -t dns-01 -a "$KEY" -o "$CERTPATH"/ecc
./letsencrypt.sh -c -x -k ./cloudflare-hook.sh -t dns-01 -o "$CERTPATH"/non_ecc
fi
fi