You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

687 lines
16 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. #!/bin/bash
  2. DEFAULT_CA="https://acme-v01.api.letsencrypt.org"
  3. DEFAULT_AGREEMENT="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
  4. API="$DEFAULT_CA"
  5. AGREEMENT="$DEFAULT_AGREEMENT"
  6. _debug() {
  7. if [ -z "$DEBUG" ] ; then
  8. return
  9. fi
  10. if [ -z "$2" ] ; then
  11. echo $1
  12. else
  13. echo $1:$2
  14. fi
  15. }
  16. _info() {
  17. if [ -z "$2" ] ; then
  18. echo $1
  19. else
  20. echo $1:$2
  21. fi
  22. }
  23. _err() {
  24. if [ -z "$2" ] ; then
  25. echo "$1" >&2
  26. else
  27. echo "$1:$2" >&2
  28. fi
  29. }
  30. #domain [2048]
  31. createAccountKey() {
  32. if [ -z "$1" ] ; then
  33. echo Usage: $0 account-domain [2048]
  34. return
  35. fi
  36. account=$1
  37. length=$2
  38. if [ -z "$2" ] ; then
  39. _info "Use default length 2048"
  40. length=2048
  41. fi
  42. _initpath
  43. if [ -f "$ACCOUNT_KEY_PATH" ] ; then
  44. _info "Account key exists, skip"
  45. return
  46. else
  47. #generate account key
  48. openssl genrsa $length > $ACCOUNT_KEY_PATH
  49. fi
  50. }
  51. #domain length
  52. createDomainKey() {
  53. if [ -z "$1" ] ; then
  54. echo Usage: $0 domain [2048]
  55. return
  56. fi
  57. domain=$1
  58. length=$2
  59. if [ -z "$2" ] ; then
  60. _info "Use default length 2048"
  61. length=2048
  62. fi
  63. _initpath $domain
  64. mkdir -p $WORKING_DIR/$domain
  65. CERT_KEY_PATH=$WORKING_DIR/$domain/$domain.key
  66. if [ -f "$CERT_KEY_PATH" ] ; then
  67. _info "Domain key exists, skip"
  68. else
  69. #generate account key
  70. openssl genrsa $length > $CERT_KEY_PATH
  71. fi
  72. }
  73. # domain domainlist
  74. createCSR() {
  75. if [ -z "$1" ] ; then
  76. echo Usage: $0 domain [domainlist]
  77. return
  78. fi
  79. domain=$1
  80. _initpath $domain
  81. domainlist=$2
  82. if [ -f $CSR_PATH ] ; then
  83. _info "CSR exists, skip"
  84. return
  85. fi
  86. if [ -z "$domainlist" ] ; then
  87. #single domain
  88. _info "Single domain" $domain
  89. openssl req -new -sha256 -key $CERT_KEY_PATH -subj "/CN=$domain" > $CSR_PATH
  90. else
  91. alt=DNS:$(echo $domainlist | sed "s/,/,DNS:/g")
  92. #multi
  93. _info "Multi domain" $alt
  94. openssl req -new -sha256 -key $CERT_KEY_PATH -subj "/CN=$domain" -reqexts SAN -config <(printf "[ req_distinguished_name ]\n[ req ]\ndistinguished_name = req_distinguished_name\n[SAN]\nsubjectAltName=$alt") -out $CSR_PATH
  95. fi
  96. }
  97. _b64() {
  98. __n=$(cat)
  99. echo $__n | tr '/+' '_-' | tr -d '= '
  100. }
  101. _send_signed_request() {
  102. url=$1
  103. payload=$2
  104. needbase64=$3
  105. _debug url $url
  106. _debug payload "$payload"
  107. CURL_HEADER="$WORKING_DIR/curl.header"
  108. dp="$WORKING_DIR/curl.dump"
  109. CURL="curl --silent --dump-header $CURL_HEADER "
  110. if [ "$DEBUG" ] ; then
  111. CURL="$CURL --trace-ascii $dp "
  112. fi
  113. payload64=$(echo -n $payload | base64 -w 0 | _b64)
  114. _debug payload64 $payload64
  115. nonceurl="$API/directory"
  116. nonce=$($CURL -I $nonceurl | grep "^Replay-Nonce:" | sed s/\\r//|sed s/\\n//| cut -d ' ' -f 2)
  117. _debug nonce $nonce
  118. protected=$(echo -n "$HEADERPLACE" | sed "s/NONCE/$nonce/" )
  119. _debug protected "$protected"
  120. protected64=$( echo -n $protected | base64 -w 0 | _b64)
  121. _debug protected64 "$protected64"
  122. sig=$(echo -n "$protected64.$payload64" | openssl dgst -sha256 -sign $ACCOUNT_KEY_PATH | base64 -w 0 | _b64)
  123. _debug sig "$sig"
  124. body="{\"header\": $HEADER, \"protected\": \"$protected64\", \"payload\": \"$payload64\", \"signature\": \"$sig\"}"
  125. _debug body "$body"
  126. if [ "$needbase64" ] ; then
  127. response="$($CURL -X POST --data "$body" $url | base64 -w 0)"
  128. else
  129. response="$($CURL -X POST --data "$body" $url)"
  130. fi
  131. responseHeaders="$(sed 's/\r//g' $CURL_HEADER)"
  132. _debug responseHeaders "$responseHeaders"
  133. _debug response "$response"
  134. code="$(grep ^HTTP $CURL_HEADER | tail -1 | cut -d " " -f 2)"
  135. _debug code $code
  136. }
  137. _get() {
  138. url="$1"
  139. _debug url $url
  140. response="$(curl --silent $url)"
  141. ret=$?
  142. _debug response "$response"
  143. code="$(echo $response | grep -o '"status":[0-9]\+' | cut -d : -f 2)"
  144. _debug code $code
  145. return $ret
  146. }
  147. #setopt "file" "opt" "=" "value" [";"]
  148. _setopt() {
  149. __conf="$1"
  150. __opt="$2"
  151. __sep="$3"
  152. __val="$4"
  153. __end="$5"
  154. if [ -z "$__opt" ] ; then
  155. echo usage: $0 '"file" "opt" "=" "value" [";"]'
  156. return
  157. fi
  158. if [ ! -f $__conf ] ; then
  159. touch $__conf
  160. fi
  161. if grep -H -n "^$__opt$__sep" $__conf > /dev/null ; then
  162. _debug OK
  163. sed -i "s|^$__opt$__sep.*$|$__opt$__sep$__val$__end|" $__conf
  164. else
  165. _debug APP
  166. echo "$__opt$__sep$__val$__end" >> $__conf
  167. fi
  168. _debug "$(grep -H -n "^$__opt$__sep" $__conf)"
  169. }
  170. _startserver() {
  171. content="$1"
  172. while true ; do
  173. if [ -z "$DEBUG" ] ; then
  174. echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80 > /dev/null
  175. else
  176. echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80
  177. fi
  178. done
  179. }
  180. _stopserver() {
  181. pid="$1"
  182. if [ "$pid" ] ; then
  183. if [ "$DEBUG" ] ; then
  184. kill -s 9 $pid 2>&1
  185. killall -s 9 nc 2>&1
  186. else
  187. kill -s 9 $pid 2>&1 > /dev/null
  188. killall -s 9 nc 2>&1 > /dev/null
  189. fi
  190. fi
  191. }
  192. _initpath() {
  193. if [ -z "$WORKING_DIR" ]; then
  194. WORKING_DIR=~/.le
  195. fi
  196. domain=$1
  197. mkdir -p $WORKING_DIR
  198. ACCOUNT_KEY_PATH=$WORKING_DIR/account.acc
  199. if [ -z "$domain" ] ; then
  200. return 0
  201. fi
  202. mkdir -p $WORKING_DIR/$domain
  203. CSR_PATH=$WORKING_DIR/$domain/$domain.csr
  204. CERT_KEY_PATH=$WORKING_DIR/$domain/$domain.key
  205. CERT_PATH=$WORKING_DIR/$domain/$domain.cer
  206. CA_CERT_PATH=$WORKING_DIR/$domain/ca.cer
  207. }
  208. issue() {
  209. if [ -z "$1" ] ; then
  210. echo "Usage: le issue webroot|no a.com [www.a.com,b.com,c.com]|no [key-length]|no [cert-file-path]|no [key-file-path]|no [ca-cert-file-path]|no [reloadCmd]|no"
  211. return 1
  212. fi
  213. Le_Webroot=$1
  214. Le_Domain=$2
  215. Le_Alt=$3
  216. Le_Keylength=$4
  217. Le_RealCertPath=$5
  218. Le_RealKeyPath=$6
  219. Le_RealCACertPath=$7
  220. Le_ReloadCmd=$8
  221. if [ -z "$Le_Domain" ] ; then
  222. Le_Domain="$1"
  223. fi
  224. _initpath $Le_Domain
  225. DOMAIN_CONF=$WORKING_DIR/$Le_Domain/$Le_Domain.conf
  226. if [ -f "$DOMAIN_CONF" ] ; then
  227. source "$DOMAIN_CONF"
  228. if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ "$(date -u "+%s" )" -lt "$Le_NextRenewTime" ] ; then
  229. _info "Skip, Next renwal time is: $Le_NextRenewTimeStr"
  230. return 2
  231. fi
  232. fi
  233. if [ "$Le_Alt" == "no" ] ; then
  234. Le_Alt=""
  235. fi
  236. if [ "$Le_Keylength" == "no" ] ; then
  237. Le_Keylength=""
  238. fi
  239. if [ "$Le_RealCertPath" == "no" ] ; then
  240. Le_RealCertPath=""
  241. fi
  242. if [ "$Le_RealKeyPath" == "no" ] ; then
  243. Le_RealKeyPath=""
  244. fi
  245. if [ "$Le_RealCACertPath" == "no" ] ; then
  246. Le_RealCACertPath=""
  247. fi
  248. if [ "$Le_ReloadCmd" == "no" ] ; then
  249. Le_ReloadCmd=""
  250. fi
  251. if [ "$Le_Webroot" == "no" ] ; then
  252. _info "Standalone mode."
  253. if ! command -v "nc" > /dev/null ; then
  254. _err "Please install netcat(nc) tools first."
  255. return 1
  256. fi
  257. if ! command -v "netstat" > /dev/null ; then
  258. _err "Please install netstat first."
  259. return 1
  260. fi
  261. netprc="$(netstat -ntpl | grep ':80 ')"
  262. if [ "$netprc" ] ; then
  263. _err "$netprc"
  264. _err "tcp port 80 is already used by $(echo "$netprc" | cut -d '/' -f 2)"
  265. _err "Please stop it first"
  266. return 1
  267. fi
  268. fi
  269. createAccountKey $Le_Domain $Le_Keylength
  270. createDomainKey $Le_Domain $Le_Keylength
  271. createCSR $Le_Domain $Le_Alt
  272. pub_exp=$(openssl rsa -in $ACCOUNT_KEY_PATH -noout -text | grep "^publicExponent:"| cut -d '(' -f 2 | cut -d 'x' -f 2 | cut -d ')' -f 1)
  273. if [ "${#pub_exp}" == "5" ] ; then
  274. pub_exp=0$pub_exp
  275. fi
  276. _debug pub_exp "$pub_exp"
  277. e=$(echo $pub_exp | xxd -r -p | base64)
  278. _debug e "$e"
  279. modulus=$(openssl rsa -in $ACCOUNT_KEY_PATH -modulus -noout | cut -d '=' -f 2 )
  280. n=$(echo $modulus| xxd -r -p | base64 -w 0 | _b64 )
  281. jwk='{"e": "'$e'", "kty": "RSA", "n": "'$n'"}'
  282. HEADER='{"alg": "RS256", "jwk": '$jwk'}'
  283. HEADERPLACE='{"nonce": "NONCE", "alg": "RS256", "jwk": '$jwk'}'
  284. _debug HEADER "$HEADER"
  285. accountkey_json=$(echo -n "$jwk" | sed "s/ //g")
  286. thumbprint=$(echo -n "$accountkey_json" | sha256sum | xxd -r -p | base64 -w 0 | _b64)
  287. _info "Registering account"
  288. regjson='{"resource": "new-reg", "agreement": "'$AGREEMENT'"}'
  289. if [ "$ACCOUNT_EMAIL" ] ; then
  290. regjson='{"resource": "new-reg", "contact": ["mailto: '$ACCOUNT_EMAIL'"], "agreement": "'$AGREEMENT'"}'
  291. fi
  292. _send_signed_request "$API/acme/new-reg" "$regjson"
  293. if [ "$code" == "" ] || [ "$code" == '201' ] ; then
  294. _info "Registered"
  295. echo $response > $WORKING_DIR/account.json
  296. elif [ "$code" == '409' ] ; then
  297. _info "Already registered"
  298. else
  299. _err "Register account Error."
  300. return 1
  301. fi
  302. # verify each domain
  303. _info "Verify each domain"
  304. alldomains=$(echo "$Le_Domain,$Le_Alt" | sed "s/,/ /g")
  305. for d in $alldomains
  306. do
  307. _info "Verifing domain" $d
  308. _send_signed_request "$API/acme/new-authz" "{\"resource\": \"new-authz\", \"identifier\": {\"type\": \"dns\", \"value\": \"$d\"}}"
  309. if [ ! -z "$code" ] && [ ! "$code" == '201' ] ; then
  310. _err "new-authz error: $response"
  311. return 1
  312. fi
  313. http01=$(echo $response | egrep -o '{[^{]*"type":"http-01"[^}]*')
  314. _debug http01 "$http01"
  315. token=$(echo "$http01" | sed 's/,/\n'/g| grep '"token":'| cut -d : -f 2|sed 's/"//g')
  316. _debug token $token
  317. uri=$(echo "$http01" | sed 's/,/\n'/g| grep '"uri":'| cut -d : -f 2,3|sed 's/"//g')
  318. _debug uri $uri
  319. keyauthorization="$token.$thumbprint"
  320. _debug keyauthorization "$keyauthorization"
  321. if [ "$Le_Webroot" == "no" ] ; then
  322. _info "Standalone mode server"
  323. _startserver "$keyauthorization" 2>&1 >/dev/null &
  324. serverproc="$!"
  325. sleep 2
  326. _debug serverproc $serverproc
  327. else
  328. wellknown_path="$Le_Webroot/.well-known/acme-challenge"
  329. _debug wellknown_path "$wellknown_path"
  330. mkdir -p "$wellknown_path"
  331. wellknown_path="$wellknown_path/$token"
  332. echo -n "$keyauthorization" > $wellknown_path
  333. fi
  334. wellknown_url="http://$d/.well-known/acme-challenge/$token"
  335. _debug wellknown_url "$wellknown_url"
  336. _debug challenge "$challenge"
  337. _send_signed_request $uri "{\"resource\": \"challenge\", \"keyAuthorization\": \"$keyauthorization\"}"
  338. if [ ! -z "$code" ] && [ ! "$code" == '202' ] ; then
  339. _err "challenge error: $d"
  340. _stopserver $serverproc
  341. return 1
  342. fi
  343. while [ "1" ] ; do
  344. _debug "sleep 5 secs to verify"
  345. sleep 5
  346. _debug "checking"
  347. if ! _get $uri ; then
  348. _err "Verify error:$resource"
  349. _stopserver $serverproc
  350. return 1
  351. fi
  352. status=$(echo $response | egrep -o '"status":"[^"]+"' | cut -d : -f 2 | sed 's/"//g')
  353. if [ "$status" == "valid" ] ; then
  354. _info "Success"
  355. break;
  356. fi
  357. if [ "$status" == "invalid" ] ; then
  358. error=$(echo $response | egrep -o '"error":{[^}]*}' | grep -o '"detail":"[^"]*"' | cut -d '"' -f 4)
  359. _err "Verify error:$error"
  360. _stopserver $serverproc
  361. return 1;
  362. fi
  363. if [ "$status" == "pending" ] ; then
  364. _info "Pending"
  365. else
  366. _err "Verify error:$response"
  367. _stopserver $serverproc
  368. return 1
  369. fi
  370. done
  371. _stopserver $serverproc
  372. done
  373. _info "Verify finished, start to sign."
  374. der="$(openssl req -in $CSR_PATH -outform DER | base64 -w 0 | _b64)"
  375. _send_signed_request "$API/acme/new-cert" "{\"resource\": \"new-cert\", \"csr\": \"$der\"}" "needbase64"
  376. Le_LinkCert="$(grep -i -o '^Location.*' $CURL_HEADER |sed 's/\r//g'| cut -d " " -f 2)"
  377. _setopt $DOMAIN_CONF "Le_LinkCert" "=" "$Le_LinkCert"
  378. if [ "$Le_LinkCert" ] ; then
  379. echo -----BEGIN CERTIFICATE----- > $CERT_PATH
  380. curl --silent $Le_LinkCert | base64 >> $CERT_PATH
  381. echo -----END CERTIFICATE----- >> $CERT_PATH
  382. _info "Cert success."
  383. cat $CERT_PATH
  384. _info "Your cert is in $CERT_PATH"
  385. fi
  386. _setopt $DOMAIN_CONF "Le_Domain" "=" "$Le_Domain"
  387. _setopt $DOMAIN_CONF "Le_Alt" "=" "$Le_Alt"
  388. _setopt $DOMAIN_CONF "Le_Webroot" "=" "$Le_Webroot"
  389. _setopt $DOMAIN_CONF "Le_Keylength" "=" "$Le_Keylength"
  390. _setopt $DOMAIN_CONF "Le_RealCertPath" "=" "\"$Le_RealCertPath\""
  391. _setopt $DOMAIN_CONF "Le_RealCACertPath" "=" "\"$Le_RealCACertPath\""
  392. _setopt $DOMAIN_CONF "Le_RealKeyPath" "=" "\"$Le_RealKeyPath\""
  393. _setopt $DOMAIN_CONF "Le_ReloadCmd" "=" "\"$Le_ReloadCmd\""
  394. if [ -z "$Le_LinkCert" ] ; then
  395. response="$(echo $response | base64 -d)"
  396. _info "Sign failed: $(echo "$response" | grep -o '"detail":"[^"]*"')"
  397. return 1
  398. fi
  399. Le_LinkIssuer=$(grep -i '^Link' $CURL_HEADER | cut -d " " -f 2| cut -d ';' -f 1 | sed 's/<//g' | sed 's/>//g')
  400. _setopt $DOMAIN_CONF "Le_LinkIssuer" "=" "$Le_LinkIssuer"
  401. if [ "$Le_LinkIssuer" ] ; then
  402. echo -----BEGIN CERTIFICATE----- > $CA_CERT_PATH
  403. curl --silent $Le_LinkIssuer | base64 >> $CA_CERT_PATH
  404. echo -----END CERTIFICATE----- >> $CA_CERT_PATH
  405. _info "The intermediate CA cert is in $CA_CERT_PATH"
  406. fi
  407. Le_CertCreateTime=$(date -u "+%s")
  408. _setopt $DOMAIN_CONF "Le_CertCreateTime" "=" "$Le_CertCreateTime"
  409. Le_CertCreateTimeStr=$(date -u "+%Y-%m-%d %H:%M:%S UTC")
  410. _setopt $DOMAIN_CONF "Le_CertCreateTimeStr" "=" "\"$Le_CertCreateTimeStr\""
  411. if [ ! "$Le_RenewalDays" ] ; then
  412. Le_RenewalDays=50
  413. fi
  414. _setopt $DOMAIN_CONF "Le_RenewalDays" "=" "$Le_RenewalDays"
  415. Le_NextRenewTime=$(date -u -d "+$Le_RenewalDays day" "+%s")
  416. _setopt $DOMAIN_CONF "Le_NextRenewTime" "=" "$Le_NextRenewTime"
  417. Le_NextRenewTimeStr=$(date -u -d "+$Le_RenewalDays day" "+%Y-%m-%d %H:%M:%S UTC")
  418. _setopt $DOMAIN_CONF "Le_NextRenewTimeStr" "=" "\"$Le_NextRenewTimeStr\""
  419. if [ "$Le_RealCertPath" ] ; then
  420. if [ -f "$Le_RealCertPath" ] ; then
  421. rm -f $Le_RealCertPath
  422. fi
  423. ln -s $CERT_PATH $Le_RealCertPath
  424. fi
  425. if [ "$Le_RealCACertPath" ] ; then
  426. if [ -f "$Le_RealCACertPath" ] ; then
  427. rm -f $Le_RealCACertPath
  428. fi
  429. ln -s $CA_CERT_PATH $Le_RealCACertPath
  430. fi
  431. if [ "$Le_RealKeyPath" ] ; then
  432. if [ -f "$Le_RealKeyPath" ] ; then
  433. rm -f $Le_RealKeyPath
  434. fi
  435. ln -s $CERT_KEY_PATH $Le_RealKeyPath
  436. fi
  437. if [ "$Le_ReloadCmd" ] ; then
  438. _info "Run Le_ReloadCmd: $Le_ReloadCmd"
  439. $Le_ReloadCmd
  440. fi
  441. }
  442. renew() {
  443. Le_Domain="$1"
  444. if [ -z "$Le_Domain" ] ; then
  445. echo Usage: $0 domain.com
  446. return 1
  447. fi
  448. issue $Le_Domain
  449. }
  450. renewAll() {
  451. _initpath
  452. _info "renewAll"
  453. for d in $(ls -F $WORKING_DIR | grep '/$') ; do
  454. d=$(echo $d | cut -d '/' -f 1)
  455. _info "renew $d"
  456. Le_LinkCert=""
  457. Le_Domain=""
  458. Le_Alt=""
  459. Le_Webroot=""
  460. Le_Keylength=""
  461. Le_LinkIssuer=""
  462. Le_CertCreateTime=""
  463. Le_CertCreateTimeStr=""
  464. Le_RenewalDays=""
  465. Le_NextRenewTime=""
  466. Le_NextRenewTimeStr=""
  467. Le_RealCertPath=""
  468. Le_RealKeyPath=""
  469. Le_RealCACertPath=""
  470. Le_ReloadCmd=""
  471. renew "$d"
  472. done
  473. }
  474. install() {
  475. _initpath
  476. if ! command -v "curl" > /dev/null ; then
  477. _err "Please install curl first."
  478. _err "Ubuntu: sudo apt-get install curl"
  479. _err "CentOS: yum install curl"
  480. return 1
  481. fi
  482. if ! command -v "crontab" > /dev/null ; then
  483. _err "Please install crontab first."
  484. _err "CentOs: yum -y install crontabs"
  485. return 1
  486. fi
  487. if ! command -v "openssl" > /dev/null ; then
  488. _err "Please install openssl first."
  489. _err "CentOs: yum -y install openssl"
  490. return 1
  491. fi
  492. if ! command -v "xxd" > /dev/null ; then
  493. _err "Please install xxd first."
  494. _err "CentOs: yum install vim-common"
  495. return 1
  496. fi
  497. _info "Installing to $WORKING_DIR"
  498. mkdir -p $WORKING_DIR/
  499. cp le.sh $WORKING_DIR/
  500. chmod +x $WORKING_DIR/le.sh
  501. if [ ! -f /bin/le.sh ] ; then
  502. ln -s $WORKING_DIR/le.sh /bin/le.sh
  503. ln -s $WORKING_DIR/le.sh /bin/le
  504. fi
  505. _info "Installing cron job"
  506. if ! crontab -l | grep 'le.sh renewAll' ; then
  507. crontab -l | { cat; echo "0 0 * * * le.sh renewAll"; } | crontab -
  508. if command -v crond > /dev/null ; then
  509. service crond reload 2>/dev/null
  510. else
  511. service cron reload 2>/dev/null
  512. fi
  513. fi
  514. _info OK
  515. }
  516. uninstall() {
  517. _initpath
  518. _info "Removing cron job"
  519. if crontab -l | grep 'le.sh renewAll' ; then
  520. crontab -l | sed "/le.sh renewAll/d" | crontab -
  521. if command -v crond > /dev/null ; then
  522. service crond reload 2>/dev/null
  523. else
  524. service cron reload 2>/dev/null
  525. fi
  526. fi
  527. _info "Removing /bin/le.sh"
  528. rm -f /bin/le
  529. rm -f /bin/le.sh
  530. _info "The keys and certs are in $WORKING_DIR, you can remove them by yourself."
  531. }
  532. showhelp() {
  533. echo "Usage: issue|renew|renewAll|createAccountKey|createDomainKey|createCSR|install|uninstall"
  534. }
  535. if [ -z "$1" ] ; then
  536. showhelp
  537. fi
  538. $1 $2 $3 $4 $5 $6 $7 $8