Compare commits

..
0 Commits
7 changed files with 479 additions and 752 deletions

No files matched your search

+61 -82
View File
@@ -39,13 +39,9 @@ https://github.com/Neilpang/letest.git
3. Apache mode
4. Dns mode
#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.
#How to install
### 1. Install online:
1. Install online:
```
curl https://raw.githubusercontent.com/Neilpang/le/master/le.sh | INSTALLONLINE=1 bash
@@ -59,12 +55,12 @@ wget -O - https://raw.githubusercontent.com/Neilpang/le/master/le.sh | INSTALLO
```
### 2. Or, Install from git:
2. Or, Install from git:
Clone this project:
```
git clone https://github.com/Neilpang/le.git
cd le
./le.sh --install
./le.sh install
```
You don't have to be root then, although it is recommended.
@@ -82,74 +78,76 @@ Show help message:
```
root@v1:~# le.sh
https://github.com/Neilpang/le
v2.0.2
Usage: le.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.
--issue Issue a cert.
--installcert Install the issued cert to apache/nginx or any other server.
--renew, -r Renew a cert.
--renewAll Renew all the certs
--revoke Revoke a cert.
--installcronjob Install the cron job to renew certs, you don't need to call this. The 'install' command can automatically install the cron job.
--uninstallcronjob Uninstall the cron job. The 'uninstall' command can do this automatically.
--cron Run cron job to renew all the certs.
--toPkcs Export the certificate and key to a pfx file.
--createAccountKey, -cak Create an account private key, professional use.
--createDomainKey, -cdk Create an domain private key, professional use.
--createCSR, -ccsr Create CSR , professional use.
v1.2.3
Usage: le.sh [command] ...[args]....
Available commands:
Parameters:
--domain, -d domain.tld Specifies a domain, used to issue, renew or revoke etc.
--force, -f Used to force to install or force to renew a cert immediately.
--staging, --test Use staging server, just for test.
--debug Output debug info.
install:
Install le.sh to your system.
issue:
Issue a cert.
installcert:
Install the issued cert to apache/nginx or any other server.
renew:
Renew a cert.
renewAll:
Renew all the certs.
uninstall:
Uninstall le.sh, and uninstall the cron job.
revoke:
Revoke a cert.
version:
Show version info.
installcronjob:
Install the cron job to renew certs, you don't need to call this. The 'install' command can automatically install the cron job.
uninstallcronjob:
Uninstall the cron job. The 'uninstall' command can do this automatically.
toPkcs:
Export the certificate and key to a pfx file.
createAccountKey:
Create an account private key, professional use.
createDomainKey:
Create an domain private key, professional use.
createCSR:
Create CSR , professional use.
--webroot, -w /path/to/webroot Specifies the web root folder for web root mode.
--standalone Use standalone mode.
--apache Use apache mode.
--dns [dns-cf|dns-dp|dns-cx|/path/to/api/file] Use dns mode or dns api.
--keylength, -k [2048] Specifies the domain key length: 2048, 3072, 4096, 8192 or ec-256, ec-384.
--accountkeylength, -ak [2048] Specifies the account key length.
These parameters are to install the cert to nginx/apache or anyother server after issue/renew a cert:
--certpath /path/to/real/cert/file After issue/renew, the cert will be copied to this path.
--keypath /path/to/real/key/file After issue/renew, the key will be copied to this path.
--capath /path/to/real/ca/file After issue/renew, the intermediate cert will be copied to this path.
--fullchainpath /path/to/fullchain/file After issue/renew, the fullchain cert will be copied to this path.
--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
root@v1:~/le# le issue
Usage: le issue webroot|no|apache|dns a.com [www.a.com,b.com,c.com]|no [key-length]|no
```
Set the param value to "no" means you want to ignore it.
For example, if you give "no" to "key-length", it will use default length 2048.
And if you give 'no' to 'cert-file-path', it will not copy the issued cert to the "cert-file-path".
In all the cases, the issued cert will be placed in "~/.le/domain.com/"
# Just issue a cert:
Example 1:
Only one domain:
```
le --issue -d aa.com -w /home/wwwroot/aa.com
le issue /home/wwwroot/aa.com 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
le issue /home/wwwroot/aa.com aa.com www.aa.com,cp.aa.com
```
The parameter `/home/wwwroot/aa.com` is the web root folder, You must have `write` access to this folder.
First argument `/home/wwwroot/aa.com` is the web root folder, You must have `write` access to this folder.
Second argument "aa.com" is the main domain you want to issue cert for.
You must have at least domain there.
Third argument is the additional domain list you want to use. Comma separated list, which is Optional.
You must point and bind all the domains to the same webroot dir:`/home/wwwroot/aa.com`
@@ -157,60 +155,41 @@ The cert will be placed in `~/.le/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
# 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 \
--certpath /path/to/certfile/in/apache/nginx \
--keypath /path/to/keyfile/in/apache/nginx \
--capath /path/to/ca/certfile/apache/nginx \
--fullchainpath path/to/fullchain/certfile/apache/nginx \
--reloadcmd "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"
```
Only the domain is required, all the other parameters are optional.
Install the issued cert/key to the production apache or nginx path.
The cert will be renewed every 80 days by default (which is configurable), Once the cert is renewed, the apache/nginx will be automatically reloaded by the command: `service apache2 reload` or `service nginx reload`
# Use Standalone server to issue cert
(requires you be root/sudoer, or you have permission to listen tcp 80 port):
# Use Standalone server to issue cert (requires you be root/sudoer, or you have permission to listen tcp 80 port):
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
le issue no aa.com www.aa.com,cp.aa.com
```
More examples: https://github.com/Neilpang/le/wiki/How-to-issue-a-cert
# Use Apache mode
(requires you be root/sudoer, since it is required to interact with apache server):
# Use Apache mode (requires you be root/sudoer, since it is required to interact with apache server):
If you are running a web server, apache or nginx, it is recommended to use the Webroot mode.
Particularly, if you are running an apache server, you can use apache mode instead. Which doesn't write any file to your web root folder.
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
le issue apache aa.com www.aa.com,user.aa.com
```
More examples: https://github.com/Neilpang/le/wiki/How-to-issue-a-cert
All the other arguments are the same with previous.
# Use DNS mode:
Support the dns-01 challenge.
Support the latest dns-01 challenge.
```
le --issue --dns -d aa.com -d www.aa.com -d user.aa.com
le issue dns aa.com www.aa.com,user.aa.com
```
You will get the output like bellow:
@@ -229,7 +208,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
le renew aa.com
```
Ok, it's finished.
@@ -263,12 +242,12 @@ For example:
Single domain:
```
le --issue -w /home/wwwroot/aa.com -d aa.com --keylength ec-256
le issue /home/wwwroot/aa.com aa.com no ec-256
```
SAN multiple domains:
```
le --issue -w /home/wwwroot/aa.com -d aa.com -d www.aa.com --keylength ec-256
le issue /home/wwwroot/aa.com aa.com www.aa.com,cp.aa.com ec-256
```
Please look at the last parameter above.
+4 -4
View File
@@ -15,7 +15,7 @@ export CF_Email="xxxx@sss.com"
Ok, let's issue cert now:
```
le.sh --issue --dns dns-cf -d aa.com -d www.aa.com
le.sh issue dns-cf aa.com www.aa.com
```
The `CF_Key` and `CF_Email` will be saved in `~/.le/account.conf`, when next time you use cloudflare api, it will reuse this key.
@@ -37,7 +37,7 @@ export DP_Key="sADDsdasdgdsf"
Ok, let's issue cert now:
```
le.sh --issue --dns dns-dp -d aa.com -d www.aa.com
le.sh issue dns-dp aa.com www.aa.com
```
The `DP_Id` and `DP_Key` will be saved in `~/.le/account.conf`, when next time you use dnspod.cn api, it will reuse this key.
@@ -58,7 +58,7 @@ export CX_Secret="sADDsdasdgdsf"
Ok, let's issue cert now:
```
le.sh --issue --dns dns-cx -d aa.com -d www.aa.com
le.sh issue dns-cx aa.com www.aa.com
```
The `CX_Key` and `CX_Secret` will be saved in `~/.le/account.conf`, when next time you use Cloudxns.com api, it will reuse this key.
@@ -76,7 +76,7 @@ Let's assume you want to name it 'myapi',
3. Then you can use your api to issue cert like:
```
le.sh --issue --dns dns-myapi -d aa.com -d www.aa.com
le.sh issue dns-myapi aa.com www.aa.com
```
For more details, please check our sample script: [dns-myapi.sh](dns-myapi.sh)
+31 -1
View File
@@ -134,8 +134,38 @@ _cf_rest() {
_err "error $ep"
return 1
fi
_debug2 response "$response"
_debug response "$response"
return 0
}
_debug() {
if [ -z "$DEBUG" ] ; then
return
fi
if [ -z "$2" ] ; then
echo $1
else
echo "$1"="$2"
fi
}
_info() {
if [ -z "$2" ] ; then
echo "$1"
else
echo "$1"="$2"
fi
}
_err() {
if [ -z "$2" ] ; then
echo "$1" >&2
else
echo "$1"="$2" >&2
fi
}
+31 -1
View File
@@ -194,7 +194,7 @@ _rest() {
_err "error $ep"
return 1
fi
_debug2 response "$response"
_debug response "$response"
if ! printf "$response" | grep '"message":"success"' > /dev/null ; then
return 1
fi
@@ -202,3 +202,33 @@ _rest() {
}
_debug() {
if [ -z "$DEBUG" ] ; then
return
fi
if [ -z "$2" ] ; then
echo $1
else
echo "$1"="$2"
fi
}
_info() {
if [ -z "$2" ] ; then
echo "$1"
else
echo "$1"="$2"
fi
}
_err() {
if [ -z "$2" ] ; then
echo "$1" >&2
else
echo "$1"="$2" >&2
fi
}
+32 -2
View File
@@ -182,7 +182,7 @@ _rest() {
if [ "$3" ] ; then
data="$3"
_debug2 data "$data"
_debug data "$data"
response="$(curl --silent -X $m "$url" -d $data)"
else
response="$(curl --silent -X $m "$url" )"
@@ -192,8 +192,38 @@ _rest() {
_err "error $ep"
return 1
fi
_debug2 response "$response"
_debug response "$response"
return 0
}
_debug() {
if [ -z "$DEBUG" ] ; then
return
fi
if [ -z "$2" ] ; then
echo $1
else
echo "$1"="$2"
fi
}
_info() {
if [ -z "$2" ] ; then
echo "$1"
else
echo "$1"="$2"
fi
}
_err() {
if [ -z "$2" ] ; then
echo "$1" >&2
else
echo "$1"="$2" >&2
fi
}
+23 -24
View File
@@ -25,38 +25,37 @@ dns-myapi-add() {
#################### Private functions bellow ##################################
_info() {
if [[ -z "$2" ]] ; then
echo "[$(date)] $1"
_debug() {
if [ -z "$DEBUG" ] ; then
return
fi
if [ -z "$2" ] ; then
echo $1
else
echo "[$(date)] $1"="'$2'"
echo "$1"="$2"
fi
}
_info() {
if [ -z "$2" ] ; then
echo "$1"
else
echo "$1"="$2"
fi
}
_err() {
_info "$@" >&2
return 1
}
_debug() {
if [[ -z "$DEBUG" ]] ; then
return
if [ -z "$2" ] ; then
echo "$1" >&2
else
echo "$1"="$2" >&2
fi
_err "$@"
return 0
}
_debug2() {
if [[ "$DEBUG" -ge "2" ]] ; then
_debug "$@"
fi
return
}
#################### Private functions bellow ##################################
+297 -638
View File
File diff suppressed because it is too large. Load diff
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.