]> git.proxmox.com Git - mirror_acme.sh.git/blame - README.md
rename to acme.sh
[mirror_acme.sh.git] / README.md
CommitLineData
6cc11ffb 1# A acme Shell script: acme.sh
2A acme protocol client in pure bash language.
3Fully ACME protocol implementation.
4Simple, Powerful and very easy to use, you only need 3 minutes to learn.
8b92aab7 5
6cc11ffb 6Simplest shell script for LetsEncrypt free Certificate client
7Pure written in bash, no dependencies to python or LetsEncrypt official client.
d8069cd4 8Just one script, to issue, renew your certificates automatically.
6c0ab5d2 9
cbb5f7ec 10Probably it's the smallest&easiest&smartest shell script to automatically issue & renew the free certificates from LetsEncrypt.
6c0ab5d2 11
90dda23f 12NOT require to be `root/sudoer`.
6c0ab5d2 13
6cc11ffb 14Wiki: https://github.com/Neilpang/acme.sh/wiki
de9fd54e 15
7a894c4c 16#Tested OS
04eb75a1 171. Ubuntu [![](https://cdn.rawgit.com/Neilpang/letest/master/status/ubuntu-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
182. Debian [![](https://cdn.rawgit.com/Neilpang/letest/master/status/debian-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
193. CentOS [![](https://cdn.rawgit.com/Neilpang/letest/master/status/centos-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
779e7ea0 204. Windows (cygwin with curl, openssl and crontab included) [![](https://cdn.rawgit.com/Neilpang/letest/master/status/windows.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
215. FreeBSD with bash [![](https://cdn.rawgit.com/Neilpang/letest/master/status/freebsd.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
387c2eab 226. pfsense with bash and curl
04eb75a1 237. openSUSE [![](https://cdn.rawgit.com/Neilpang/letest/master/status/opensuse-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
248. Alpine Linux [![](https://cdn.rawgit.com/Neilpang/letest/master/status/alpine-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status) (with bash, curl. https://github.com/Neilpang/le/issues/94)
2f06c850 259. Archlinux [![](https://cdn.rawgit.com/Neilpang/letest/master/status/base-archlinux.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
04eb75a1 2610. fedora [![](https://cdn.rawgit.com/Neilpang/letest/master/status/fedora-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
d3d884c1 2711. Kali Linux [![](https://cdn.rawgit.com/Neilpang/letest/master/status/kalilinux-kali-linux-docker.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
a34bd89f 2812. Oracle Linux [![](https://cdn.rawgit.com/Neilpang/letest/master/status/oraclelinux-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)
ddc04a75 2913. Cloud Linux https://github.com/Neilpang/le/issues/111
b7604c06 3014. Proxmox https://pve.proxmox.com/wiki/HTTPSCertificateConfiguration#Let.27s_Encrypt_using_le.sh
31
6c0ab5d2 32
387c2eab 33For all the build status, check our daily build project:
6c0ab5d2 34
6cc11ffb 35https://github.com/Neilpang/acmetest
07f4ec4f 36
2c75b3fd 37#Supported Mode
381. Webroot mode
392. Standalone mode
403. Apache mode
52639149 414. Dns mode
2c75b3fd 42
6cc11ffb 43# Upgrade from 1.x to 2.x
e8cce73a 44You can simply uninstall 1.x and re-install 2.x.
452.x is 100% compatible to 1.x. You will feel nothing changed.
46
6cc11ffb 47# le.sh renamed to acme.sh NOW!
48All configurations are 100% compatible. You just need to uninstall `le.sh` and re-install `acme.sh` again.
49Nothing broken.
50
90dda23f 51#How to install
6c0ab5d2 52
65938b73 53### 1. Install online:
6c0ab5d2 54
6c0ab5d2 55```
6cc11ffb 56curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 bash
90dda23f 57
58```
59
60Or:
61```
6cc11ffb 62wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 bash
90dda23f 63
64```
65
66
65938b73 67### 2. Or, Install from git:
90dda23f 68Clone this project:
69```
6cc11ffb 70git clone https://github.com/Neilpang/acme.sh.git
71cd acme.sh
72./acme.sh --install
6c0ab5d2 73```
90dda23f 74
d0064bc3 75You don't have to be root then, although it is recommended.
7a894c4c 76
db25a3ea 77Which does 3 jobs:
6cc11ffb 78* create and copy `acme.sh` to your home dir: `~/.acme.sh/`
6c0ab5d2 79All the certs will be placed in this folder.
6cc11ffb 80* create alias : `acme.sh=~/.acme.sh/acme.sh`.
db25a3ea 81* create everyday cron job to check and renew the cert if needed.
acc1e53a 82
9b292d58 83After install, you must close current terminal and reopen again to make the alias take effect.
acc1e53a 84
cbb5f7ec 85Ok, you are ready to issue cert now.
6c0ab5d2
N
86Show help message:
87```
6cc11ffb 88root@v1:~# acme.sh
89https://github.com/Neilpang/acme.sh
90v2.1.0
91Usage: acme.sh command ...[parameters]....
a63b05a9 92Commands:
93 --help, -h Show this help message.
94 --version, -v Show version info.
6cc11ffb 95 --install Install acme.sh to your system.
96 --uninstall Uninstall acme.sh, and uninstall the cron job.
a63b05a9 97 --issue Issue a cert.
98 --installcert Install the issued cert to apache/nginx or any other server.
99 --renew, -r Renew a cert.
100 --renewAll Renew all the certs
101 --revoke Revoke a cert.
102 --installcronjob Install the cron job to renew certs, you don't need to call this. The 'install' command can automatically install the cron job.
103 --uninstallcronjob Uninstall the cron job. The 'uninstall' command can do this automatically.
104 --cron Run cron job to renew all the certs.
105 --toPkcs Export the certificate and key to a pfx file.
106 --createAccountKey, -cak Create an account private key, professional use.
107 --createDomainKey, -cdk Create an domain private key, professional use.
108 --createCSR, -ccsr Create CSR , professional use.
109
110Parameters:
111 --domain, -d domain.tld Specifies a domain, used to issue, renew or revoke etc.
112 --force, -f Used to force to install or force to renew a cert immediately.
113 --staging, --test Use staging server, just for test.
114 --debug Output debug info.
115
116 --webroot, -w /path/to/webroot Specifies the web root folder for web root mode.
117 --standalone Use standalone mode.
118 --apache Use apache mode.
119 --dns [dns-cf|dns-dp|dns-cx|/path/to/api/file] Use dns mode or dns api.
120
121 --keylength, -k [2048] Specifies the domain key length: 2048, 3072, 4096, 8192 or ec-256, ec-384.
122 --accountkeylength, -ak [2048] Specifies the account key length.
123
124 These parameters are to install the cert to nginx/apache or anyother server after issue/renew a cert:
125
126 --certpath /path/to/real/cert/file After issue/renew, the cert will be copied to this path.
127 --keypath /path/to/real/key/file After issue/renew, the key will be copied to this path.
128 --capath /path/to/real/ca/file After issue/renew, the intermediate cert will be copied to this path.
129 --fullchainpath /path/to/fullchain/file After issue/renew, the fullchain cert will be copied to this path.
130
131 --reloadcmd "service nginx reload" After issue/renew, it's used to reload the server.
132
133 --accountconf Specifies a customized account config file.
6cc11ffb 134 --home Specifies the home dir for acme.sh
65938b73 135
6c0ab5d2 136
6c0ab5d2
N
137
138```
139
140# Just issue a cert:
2400e41f
N
141Example 1:
142Only one domain:
143```
6cc11ffb 144acme.sh --issue -d aa.com -w /home/wwwroot/aa.com
2400e41f
N
145```
146
147Example 2:
148Multiple domains in the same cert:
149
6c0ab5d2 150```
6cc11ffb 151acme.sh --issue -d aa.com -d www.aa.com -d cp.aa.com -w /home/wwwroot/aa.com
6c0ab5d2 152```
2400e41f 153
a63b05a9 154The parameter `/home/wwwroot/aa.com` is the web root folder, You must have `write` access to this folder.
6c0ab5d2 155
d337abca 156Second argument "aa.com" is the main domain you want to issue cert for.
a63b05a9 157You must have at least domain there.
6c0ab5d2 158
d337abca 159You must point and bind all the domains to the same webroot dir:`/home/wwwroot/aa.com`
6c0ab5d2 160
6cc11ffb 161The cert will be placed in `~/.acme.sh/aa.com/`
6c0ab5d2 162
7a894c4c 163The issued cert will be renewed every 80 days automatically.
6c0ab5d2 164
a63b05a9 165
6cc11ffb 166More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
a63b05a9 167
168
7a894c4c 169# Install issued cert to apache/nginx etc.
e8cce73a 170After you issue a cert, you probably want to install the cert to your nginx/apache or other servers to use.
a63b05a9 171
6c0ab5d2 172```
6cc11ffb 173acme.sh --installcert -d aa.com \
a63b05a9 174--certpath /path/to/certfile/in/apache/nginx \
175--keypath /path/to/keyfile/in/apache/nginx \
176--capath /path/to/ca/certfile/apache/nginx \
177--fullchainpath path/to/fullchain/certfile/apache/nginx \
178--reloadcmd "service apache2|nginx reload"
6c0ab5d2 179```
7a894c4c 180
a63b05a9 181Only the domain is required, all the other parameters are optional.
182
7a894c4c
N
183Install the issued cert/key to the production apache or nginx path.
184
cbb5f7ec 185The 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`
6c0ab5d2
N
186
187
a63b05a9 188# Use Standalone server to issue cert
189(requires you be root/sudoer, or you have permission to listen tcp 80 port):
4e1346dd 190Same usage as all above, just give `no` as the webroot.
072290f2
N
191The tcp `80` port must be free to listen, otherwise you will be prompted to free the `80` port and try again.
192
193```
6cc11ffb 194acme.sh --issue --standalone -d aa.com -d www.aa.com -d cp.aa.com
072290f2
N
195```
196
6cc11ffb 197More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
a63b05a9 198
199
200# Use Apache mode
201(requires you be root/sudoer, since it is required to interact with apache server):
bc1c69ff 202If you are running a web server, apache or nginx, it is recommended to use the Webroot mode.
2c75b3fd 203Particularly, if you are running an apache server, you can use apache mode instead. Which doesn't write any file to your web root folder.
204
205Just set string "apache" to the first argument, it will use apache plugin automatically.
206
207```
6cc11ffb 208acme.sh --issue --apache -d aa.com -d www.aa.com -d user.aa.com
2c75b3fd 209```
a63b05a9 210
6cc11ffb 211More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
2c75b3fd 212
6c0ab5d2 213
a947dbc6 214# Use DNS mode:
a63b05a9 215Support the dns-01 challenge.
a947dbc6
N
216
217```
6cc11ffb 218acme.sh --issue --dns -d aa.com -d www.aa.com -d user.aa.com
a947dbc6
N
219```
220
6e89f811 221You will get the output like bellow:
a947dbc6
N
222```
223Add the following txt record:
224Domain:_acme-challenge.aa.com
225Txt value:9ihDbjYfTExAYeDs4DBUeuTo18KBzwvTEjUnSwd32-c
226
227Add the following txt record:
228Domain:_acme-challenge.www.aa.com
229Txt value:9ihDbjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
230```
231
232Please add those txt records to the domains. Waiting for the dns to take effect.
233
6e89f811 234Then just retry with 'renew' command:
a947dbc6
N
235
236```
6cc11ffb 237acme.sh --renew -d aa.com
a947dbc6
N
238```
239
240Ok, it's finished.
241
242
08094865 243#Automatic dns api integeration
6c0ab5d2 244
cbb5f7ec 245If your dns provider supports api access, we can use api to automatically issue certs.
08094865 246You don't have do anything manually.
ab497961 247
855d9499 248###Currently we support:
249
cbb5f7ec 2501. Cloudflare.com api
2512. Dnspod.cn api
2523. Cloudxns.com api
6cc11ffb 2534. AWS Route 53, see: https://github.com/Neilpang/acme.sh/issues/65
ab497961 254
7bd9a3b1 255More apis are coming soon....
ab497961 256
39c6df29 257If your dns provider is not in the supported list above, you can write your own script api easily.
ab497961 258
855d9499 259For more details: [How to use dns api](dnsapi)
ab497961 260
261
1add47a6 262# Issue ECC certificate:
263LetsEncrypt now can issue ECDSA certificate.
264And we also support it.
265
8b92aab7 266Just set the `length` parameter with a prefix `ec-`.
1add47a6 267For example:
9e6c4208
N
268
269Single domain:
270```
6cc11ffb 271acme.sh --issue -w /home/wwwroot/aa.com -d aa.com --keylength ec-256
1add47a6 272```
9e6c4208
N
273
274SAN multiple domains:
1add47a6 275```
6cc11ffb 276acme.sh --issue -w /home/wwwroot/aa.com -d aa.com -d www.aa.com --keylength ec-256
9e6c4208
N
277```
278
1add47a6 279Please look at the last parameter above.
280
281Valid values are:
282
2831. ec-256 (prime256v1, "ECDSA P-256")
2842. ec-384 (secp384r1, "ECDSA P-384")
8b92aab7 2853. ec-521 (secp521r1, "ECDSA P-521", which is not supported by letsencrypt yet.)
1add47a6 286
287
288
6c0ab5d2
N
289#Under the Hood
290
1162f82e 291Speak ACME language with bash directly to Let's encrypt.
6c0ab5d2
N
292
293TODO:
294
295
63f04675
N
296#Acknowledgment
2971. Acme-tiny: https://github.com/diafygi/acme-tiny
2982. ACME protocol: https://github.com/ietf-wg-acme/acme
2993. letsencrypt: https://github.com/letsencrypt/letsencrypt
300
301
302
6c0ab5d2
N
303#License & Other
304
305License is GPLv3
306
1d06c947 307Please Star and Fork me.
6c0ab5d2 308
18ab2c5c 309Issues and pull requests are welcomed.
6c0ab5d2
N
310
311
312