This commit is contained in:
neil 2016-02-02 23:55:23 +08:00
commit 876df8567a
3 changed files with 22 additions and 19 deletions

View File

@ -11,6 +11,7 @@ Do NOT require to be `root/sudoer`.
#Tested OS #Tested OS
1. Ubuntu/Debian. 1. Ubuntu/Debian.
2. CentOS 2. CentOS
3. Windows (cygwin with curl, openssl and crontab included)
#Supported Mode #Supported Mode
@ -27,7 +28,7 @@ Do NOT require to be `root/sudoer`.
``` ```
./le.sh install ./le.sh install
``` ```
You don't have to be root then, altough it is recommended. You don't have to be root then, although it is recommended.
Which does 3 jobs: Which does 3 jobs:
* create and copy `le.sh` to your home dir: `~/.le` * create and copy `le.sh` to your home dir: `~/.le`
@ -44,7 +45,7 @@ root@v1:~# le.sh
https://github.com/Neilpang/le https://github.com/Neilpang/le
v1.1.1 v1.1.1
Usage: le.sh [command] ...[args].... Usage: le.sh [command] ...[args]....
Avalible commands: Available commands:
install: install:
Install le.sh to your system. Install le.sh to your system.
@ -105,7 +106,7 @@ The issued cert will be renewed every 80 days automatically.
# Install issued cert to apache/nginx etc. # Install issued cert to apache/nginx etc.
``` ```
le installcert aa.com /path/to/certfile/in/apache/nginx /path/to/keyfile/in/apache/nginx /path/to/ca/certfile/apahce/nginx "service apache2|nginx reload" le installcert aa.com /path/to/certfile/in/apache/nginx /path/to/keyfile/in/apache/nginx /path/to/ca/certfile/apache/nginx "service apache2|nginx reload"
``` ```
Install the issued cert/key to the production apache or nginx path. Install the issued cert/key to the production apache or nginx path.
@ -226,7 +227,7 @@ License is GPLv3
Please Star and Fork me. Please Star and Fork me.
Issues and pullrequests are welcomed. Issues and pull requests are welcomed.

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
#Here is a sample custom api script. #Here is a sample custom api script.
#This file name is "dhs-myapi.sh" #This file name is "dns-myapi.sh"
#So, here must be a method dhs-myapi-add() #So, here must be a method dns-myapi-add()
#Which will be called by le.sh to add the txt record to your api system. #Which will be called by le.sh to add the txt record to your api system.
#returns 0 meanst success, otherwise error. #returns 0 meanst success, otherwise error.

28
le.sh
View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
VER=1.1.3 VER=1.1.4
PROJECT="https://github.com/Neilpang/le" PROJECT="https://github.com/Neilpang/le"
DEFAULT_CA="https://acme-v01.api.letsencrypt.org" DEFAULT_CA="https://acme-v01.api.letsencrypt.org"
@ -293,6 +293,18 @@ _initpath() {
SUDO=sudo SUDO=sudo
fi fi
fi fi
if [ -z "$LE_WORKING_DIR" ]; then
LE_WORKING_DIR=$HOME/.le
fi
if [ -z "$ACCOUNT_CONF_PATH" ] ; then
ACCOUNT_CONF_PATH="$LE_WORKING_DIR/account.conf"
fi
if [ -f "$ACCOUNT_CONF_PATH" ] ; then
source "$ACCOUNT_CONF_PATH"
fi
if [ -z "$API" ] ; then if [ -z "$API" ] ; then
if [ -z "$STAGE" ] ; then if [ -z "$STAGE" ] ; then
@ -303,10 +315,6 @@ _initpath() {
fi fi
fi fi
if [ -z "$LE_WORKING_DIR" ]; then
LE_WORKING_DIR=$HOME/.le
fi
if [ -z "$ACME_DIR" ] ; then if [ -z "$ACME_DIR" ] ; then
ACME_DIR="/home/.acme" ACME_DIR="/home/.acme"
fi fi
@ -322,13 +330,7 @@ _initpath() {
ACCOUNT_KEY_PATH="$LE_WORKING_DIR/account.key" ACCOUNT_KEY_PATH="$LE_WORKING_DIR/account.key"
fi fi
if [ -z "$ACCOUNT_CONF_PATH" ] ; then
ACCOUNT_CONF_PATH="$LE_WORKING_DIR/account.conf"
fi
if [ -f "$ACCOUNT_CONF_PATH" ] ; then
source "$ACCOUNT_CONF_PATH"
fi
if [ -z "$domain" ] ; then if [ -z "$domain" ] ; then
return 0 return 0
@ -829,7 +831,7 @@ issue() {
if [ -z "$Le_LinkCert" ] ; then if [ -z "$Le_LinkCert" ] ; then
response="$(echo $response | openssl base64 -d)" response="$(echo $response | openssl base64 -d)"
_err "Sign failed: $(echo "$response" | grep -o '"detail":"[^"]*"')" _err "Sign failed: $response"
return 1 return 1
fi fi