File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # a simple script for use on shared cpanel server to automatically add the
4
+ # the certificates to cpanel if the uapi function is available
5
+ # use with RELOAD_CMD="${HOME}/cpanel_cert_upload domain.com"
6
+
7
+ domain=" $1 "
8
+
9
+ rawurlencode () {
10
+ local string
11
+ string=$( cat " ${1} " )
12
+ local strlen=${# string}
13
+ local encoded=" "
14
+ local pos c o
15
+
16
+ for (( pos= 0 ; pos< strlen ; pos++ )) ; do
17
+ c=${string: $pos : 1}
18
+ case " $c " in
19
+ [-_.~a-zA-Z0-9] ) o=" ${c} " ;;
20
+ * ) printf -v o ' %%%02x' " '$c "
21
+ esac
22
+ encoded+=" ${o} "
23
+ done
24
+ echo " ${encoded} "
25
+ }
26
+
27
+ ecert=$( rawurlencode " ${HOME} /.getssl/${domain} /${domain} .crt" )
28
+ ekey=$( rawurlencode " ${HOME} /.getssl/${domain} /${domain} .key" )
29
+ echain=$( rawurlencode " ${HOME} /.getssl/${domain} /chain.crt" )
30
+
31
+ uapi SSL install_ssl domain=" ${domain} " cert=" ${ecert} " key=" ${ekey} " cabundle=" ${echain} "
You can’t perform that action at this time.
0 commit comments