Browse Source

rename to acme.sh

neil 9 years ago
parent
commit
6cc11ffb7d
2 changed files with 81 additions and 49 deletions
  1. 41 36
      README.md
  2. 40 13
      acme.sh

+ 41 - 36
README.md

@@ -1,16 +1,17 @@
-# le: means simp`Le`
-Simplest shell script for LetsEncrypt free Certificate client
-
-Simple and Powerful, you only need 3 minutes to learn.
+# A acme Shell script: acme.sh
+A acme protocol client in pure bash language.
+Fully ACME protocol implementation. 
+Simple, Powerful and very easy to use, you only need 3 minutes to learn.
 
-Pure written in bash, no dependencies to python, acme-tiny or LetsEncrypt official client.
+Simplest shell script for LetsEncrypt free Certificate client
+Pure written in bash, no dependencies to python or LetsEncrypt official client.
 Just one script, to issue, renew your certificates automatically.
 
 Probably it's the smallest&easiest&smartest shell script to automatically issue & renew the free certificates from LetsEncrypt.
 
 NOT require to be `root/sudoer`.
 
-Wiki: https://github.com/Neilpang/le/wiki
+Wiki: https://github.com/Neilpang/acme.sh/wiki
 
 #Tested OS
 1. Ubuntu [![](https://cdn.rawgit.com/Neilpang/letest/master/status/ubuntu-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
@@ -31,7 +32,7 @@ Wiki: https://github.com/Neilpang/le/wiki
 
 For all the build status, check our daily build project: 
 
-https://github.com/Neilpang/letest.git
+https://github.com/Neilpang/acmetest
 
 #Supported Mode
 1. Webroot mode
@@ -39,22 +40,26 @@ https://github.com/Neilpang/letest.git
 3. Apache mode
 4. Dns mode
 
-#Upgrade from 1.x to 2.x
+# Upgrade from 1.x to 2.x
 You can simply uninstall 1.x and re-install 2.x.
 2.x is 100% compatible to 1.x.  You will feel nothing changed.
 
+# le.sh renamed to acme.sh NOW!
+All configurations are 100% compatible. You just need to uninstall `le.sh` and re-install `acme.sh` again.
+Nothing broken.
+
 #How to install
 
 ### 1. Install online:
 
 ```
-curl https://raw.githubusercontent.com/Neilpang/le/master/le.sh | INSTALLONLINE=1  bash
+curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1  bash
 
 ```
 
 Or:
 ```
-wget -O -  https://raw.githubusercontent.com/Neilpang/le/master/le.sh | INSTALLONLINE=1  bash
+wget -O -  https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1  bash
 
 ```
 
@@ -62,17 +67,17 @@ wget -O -  https://raw.githubusercontent.com/Neilpang/le/master/le.sh | INSTALLO
 ### 2. Or, Install from git:
 Clone this project: 
 ```
-git clone https://github.com/Neilpang/le.git
-cd le
-./le.sh --install
+git clone https://github.com/Neilpang/acme.sh.git
+cd acme.sh
+./acme.sh --install
 ```
 
 You don't have to be root then, although it is recommended.
 
 Which does 3 jobs:
-* create and copy `le.sh` to your home dir:  `~/.le`
+* create and copy `acme.sh` to your home dir:  `~/.acme.sh/`
 All the certs will be placed in this folder.
-* create alias : `le.sh=~/.le/le.sh` and `le=~/.le/le.sh`. 
+* create alias : `acme.sh=~/.acme.sh/acme.sh`. 
 * create everyday cron job to check and renew the cert if needed.
 
 After install, you must close current terminal and reopen again to make the alias take effect.
@@ -80,15 +85,15 @@ After install, you must close current terminal and reopen again to make the alia
 Ok, you are ready to issue cert now.
 Show help message:
 ```
-root@v1:~# le.sh
-https://github.com/Neilpang/le
-v2.0.2
-Usage: le.sh  command ...[parameters]....
+root@v1:~# acme.sh
+https://github.com/Neilpang/acme.sh
+v2.1.0
+Usage: acme.sh  command ...[parameters]....
 Commands:
   --help, -h               Show this help message.
   --version, -v            Show version info.
-  --install                Install le.sh to your system.
-  --uninstall              Uninstall le.sh, and uninstall the cron job.
+  --install                Install acme.sh to your system.
+  --uninstall              Uninstall acme.sh, and uninstall the cron job.
   --issue                  Issue a cert.
   --installcert            Install the issued cert to apache/nginx or any other server.
   --renew, -r              Renew a cert.
@@ -126,7 +131,7 @@ Parameters:
   --reloadcmd "service nginx reload" After issue/renew, it's used to reload the server.
 
   --accountconf                     Specifies a customized account config file.
-  --home                            Specifies the home dir for le.sh
+  --home                            Specifies the home dir for acme.sh
 
 
 
@@ -136,14 +141,14 @@ Parameters:
 Example 1:
 Only one domain:
 ```
-le --issue   -d aa.com  -w /home/wwwroot/aa.com   
+acme.sh --issue   -d aa.com  -w /home/wwwroot/aa.com   
 ```
 
 Example 2:
 Multiple domains in the same cert:
 
 ```
-le --issue   -d aa.com   -d www.aa.com -d cp.aa.com  -w  /home/wwwroot/aa.com 
+acme.sh --issue   -d aa.com   -d www.aa.com -d cp.aa.com  -w  /home/wwwroot/aa.com 
 ```
 
 The parameter `/home/wwwroot/aa.com` is the web root folder, You must have `write` access to this folder.
@@ -153,19 +158,19 @@ You must have at least domain there.
 
 You must point and bind all the domains to the same webroot dir:`/home/wwwroot/aa.com`
 
-The cert will be placed in `~/.le/aa.com/`
+The cert will be placed in `~/.acme.sh/aa.com/`
 
 The issued cert will be renewed every 80 days automatically.
 
 
-More examples: https://github.com/Neilpang/le/wiki/How-to-issue-a-cert
+More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
 
 
 # Install issued cert to apache/nginx etc.
 After you issue a cert, you probably want to install the cert to your nginx/apache or other servers to use.
 
 ```
-le --installcert  -d aa.com \
+acme.sh --installcert  -d aa.com \
 --certpath /path/to/certfile/in/apache/nginx  \
 --keypath  /path/to/keyfile/in/apache/nginx  \
 --capath   /path/to/ca/certfile/apache/nginx   \
@@ -186,10 +191,10 @@ Same usage as all above,  just give `no` as the webroot.
 The tcp `80` port must be free to listen, otherwise you will be prompted to free the `80` port and try again.
 
 ```
-le --issue  --standalone    -d aa.com  -d www.aa.com  -d  cp.aa.com
+acme.sh --issue  --standalone    -d aa.com  -d www.aa.com  -d  cp.aa.com
 ```
 
-More examples: https://github.com/Neilpang/le/wiki/How-to-issue-a-cert
+More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
 
 
 # Use Apache mode 
@@ -200,17 +205,17 @@ Particularly,  if you are running an apache server, you can use apache mode inst
 Just set string "apache" to the first argument, it will use apache plugin automatically.
 
 ```
-le  --issue  --apache  -d aa.com   -d www.aa.com -d user.aa.com
+acme.sh  --issue  --apache  -d aa.com   -d www.aa.com -d user.aa.com
 ```
 
-More examples: https://github.com/Neilpang/le/wiki/How-to-issue-a-cert
+More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
 
 
 # Use DNS mode:
 Support the dns-01 challenge.
 
 ```
-le  --issue   --dns   -d aa.com  -d www.aa.com -d user.aa.com
+acme.sh  --issue   --dns   -d aa.com  -d www.aa.com -d user.aa.com
 ```
 
 You will get the output like bellow:
@@ -229,7 +234,7 @@ Please add those txt records to the domains. Waiting for the dns to take effect.
 Then just retry with 'renew' command:
 
 ```
-le --renew  -d aa.com
+acme.sh --renew  -d aa.com
 ```
 
 Ok, it's finished.
@@ -245,7 +250,7 @@ You don't have do anything manually.
 1. Cloudflare.com api
 2. Dnspod.cn api
 3. Cloudxns.com api
-4. AWS Route 53, see: https://github.com/Neilpang/le/issues/65
+4. AWS Route 53, see: https://github.com/Neilpang/acme.sh/issues/65
 
 More apis are coming soon....
 
@@ -263,12 +268,12 @@ For example:
 
 Single domain:
 ```
-le --issue  -w /home/wwwroot/aa.com   -d aa.com   --keylength  ec-256
+acme.sh --issue  -w /home/wwwroot/aa.com   -d aa.com   --keylength  ec-256
 ```
 
 SAN multiple domains:
 ```
-le --issue  -w /home/wwwroot/aa.com   -d aa.com  -d www.aa.com  --keylength  ec-256
+acme.sh --issue  -w /home/wwwroot/aa.com   -d aa.com  -d www.aa.com  --keylength  ec-256
 ```
 
 Please look at the last parameter above.

+ 40 - 13
le.sh → acme.sh

@@ -1,10 +1,11 @@
 #!/usr/bin/env bash
-VER=2.0.2
+VER=2.1.0
 
-PROJECT_NAME="le.sh"
-PROJECT_ENTRY="le.sh"
+PROJECT_NAME="acme.sh"
 
-PROJECT="https://github.com/Neilpang/le"
+PROJECT_ENTRY="acme.sh"
+
+PROJECT="https://github.com/Neilpang/$PROJECT_NAME"
 
 DEFAULT_CA="https://acme-v01.api.letsencrypt.org"
 DEFAULT_AGREEMENT="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
@@ -679,7 +680,7 @@ _stopserver(){
 _initpath() {
 
   if [[ -z "$LE_WORKING_DIR" ]] ; then
-    LE_WORKING_DIR=$HOME/.le
+    LE_WORKING_DIR=$HOME/.$PROJECT_NAME
   fi
   
   _DEFAULT_ACCOUNT_CONF_PATH="$LE_WORKING_DIR/account.conf"
@@ -1734,6 +1735,23 @@ install() {
     return 1
   fi
   
+  #convert from le
+  if [[ -d "$HOME/.le" ]] ; then
+    for envfile in "le.env" "le.sh.env"
+    do
+      if [[ -f "$HOME/.le/$envfile" ]] ; then
+        if grep "le.sh" "$HOME/.le/$envfile" >/dev/null ; then
+            _upgrading="1"
+            _info "You are upgrading from le.sh"
+            _info "Renaming \"$HOME/.le\" to $LE_WORKING_DIR"
+            mv "$HOME/.le" "$LE_WORKING_DIR"
+            mv "$LE_WORKING_DIR/$envfile" "$LE_WORKING_DIR/$PROJECT_ENTRY.env"
+          break;
+        fi
+      fi
+    done
+  fi
+
   _info "Installing to $LE_WORKING_DIR"
   
   if ! mkdir -p "$LE_WORKING_DIR" ; then
@@ -1754,10 +1772,16 @@ install() {
   if [[ "$_profile" ]] ; then
     _debug "Found profile: $_profile"
     
-    echo "LE_WORKING_DIR=$LE_WORKING_DIR
-alias le=\"$LE_WORKING_DIR/$PROJECT_ENTRY\"
-alias $PROJECT_ENTRY=\"$LE_WORKING_DIR/$PROJECT_ENTRY\"
-    " > "$LE_WORKING_DIR/$PROJECT_ENTRY.env"
+    _envfile="$LE_WORKING_DIR/$PROJECT_ENTRY.env"
+    if [[ "$_upgrading" == "1" ]] ; then
+      echo "$(cat $_envfile)" | sed "s|^LE_WORKING_DIR.*$||" > "$_envfile"
+      echo "$(cat $_envfile)" | sed "s|^alias le.*$||" > "$_envfile"
+      echo "$(cat $_envfile)" | sed "s|^alias le.sh.*$||" > "$_envfile"
+    fi
+    
+    _setopt "$_envfile" "LE_WORKING_DIR" "=" "\"$LE_WORKING_DIR\""
+    _setopt "$_envfile" "alias $PROJECT_ENTRY" "=" "\"$LE_WORKING_DIR/$PROJECT_ENTRY\""
+    
     echo "" >> "$_profile"
     _setopt "$_profile" "source \"$LE_WORKING_DIR/$PROJECT_NAME.env\""
     _info "OK, Close and reopen your terminal to start using $PROJECT_NAME"
@@ -1778,8 +1802,11 @@ alias $PROJECT_ENTRY=\"$LE_WORKING_DIR/$PROJECT_ENTRY\"
   fi
   
   _setopt "$_DEFAULT_ACCOUNT_CONF_PATH" "ACCOUNT_CONF_PATH" "=" "\"$ACCOUNT_CONF_PATH\""
-  _setopt "$ACCOUNT_CONF_PATH" "ACCOUNT_CONF_PATH" "=" "\"$ACCOUNT_CONF_PATH\""
-  
+
+  if [[ "$_DEFAULT_ACCOUNT_CONF_PATH" != "$ACCOUNT_CONF_PATH" ]] ; then
+    _setopt "$ACCOUNT_CONF_PATH" "ACCOUNT_CONF_PATH" "=" "\"$ACCOUNT_CONF_PATH\""
+  fi
+
   installcronjob
   
   _info OK
@@ -1876,14 +1903,14 @@ _installOnline() {
   fi
   _info "Extracting $localname"
   tar xzf $localname
-  cd "le-$BRANCH"
+  cd "$PROJECT_NAME-$BRANCH"
   chmod +x $PROJECT_ENTRY
   if ./$PROJECT_ENTRY install ; then
     _info "Install success!"
   fi
   
   cd ..
-  rm -rf "le-$BRANCH"
+  rm -rf "$PROJECT_NAME-$BRANCH"
   rm -f "$localname"
 }