]> git.proxmox.com Git - mirror_acme.sh.git/blame - README.md
Merge pull request #862 from Neilpang/master
[mirror_acme.sh.git] / README.md
CommitLineData
a2e62f8e 1# An ACME Shell script: acme.sh [![Build Status](https://travis-ci.org/Neilpang/acme.sh.svg?branch=master)](https://travis-ci.org/Neilpang/acme.sh)
319d49dd
TGB
2
3[![Join the chat at https://gitter.im/acme-sh/Lobby](https://badges.gitter.im/acme-sh/Lobby.svg)](https://gitter.im/acme-sh/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
99dc89c0 4- An ACME protocol client written purely in Shell (Unix shell) language.
1bb90298
AL
5- Full ACME protocol implementation.
6- Simple, powerful and very easy to use. You only need 3 minutes to learn it.
7- Bash, dash and sh compatible.
2b45dba5 8- Simplest shell script for Let's Encrypt free certificate client.
1bb90298
AL
9- Purely written in Shell with no dependencies on python or the official Let's Encrypt client.
10- Just one script to issue, renew and install your certificates automatically.
1f60d2bb 11- DOES NOT require `root/sudoer` access.
f3b43439 12- Docker friendly
0f48b156 13- IPv6 support
6c0ab5d2 14
9cf65e31 15It's probably the `easiest & smartest` shell script to automatically issue & renew the free certificates from Let's Encrypt.
6c0ab5d2 16
6cc11ffb 17Wiki: https://github.com/Neilpang/acme.sh/wiki
de9fd54e 18
f3b43439 19For Docker Fans: [acme.sh :two_hearts: Docker ](https://github.com/Neilpang/acme.sh/wiki/Run-acme.sh-in-docker)
1bb90298 20
08998032 21Twitter: [@neilpangxa](https://twitter.com/neilpangxa)
22
23
fe04faf6 24# [中文说明](https://github.com/Neilpang/acme.sh/wiki/%E8%AF%B4%E6%98%8E)
25
6f1c72f5 26# Who are using **acme.sh**
27- [FreeBSD.org](https://blog.crashed.org/letsencrypt-in-freebsd-org/)
28- [ruby-china.org](https://ruby-china.org/topics/31983)
29- [Proxmox](https://pve.proxmox.com/wiki/HTTPS_Certificate_Configuration_(Version_4.x_and_newer))
30- [pfsense](https://github.com/pfsense/FreeBSD-ports/pull/89)
31- [webfaction](https://community.webfaction.com/questions/19988/using-letsencrypt)
32- [Loadbalancer.org](https://www.loadbalancer.org/blog/loadbalancer-org-with-lets-encrypt-quick-and-dirty)
33- [discourse.org](https://meta.discourse.org/t/setting-up-lets-encrypt/40709)
34- [Centminmod](http://centminmod.com/letsencrypt-acmetool-https.html)
35- [splynx](https://forum.splynx.com/t/free-ssl-cert-for-splynx-lets-encrypt/297)
36- [archlinux](https://aur.archlinux.org/packages/acme.sh-git/)
9cf65e31 37- [opnsense.org](https://github.com/opnsense/plugins/tree/master/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient)
63ec05a6 38- [more...](https://github.com/Neilpang/acme.sh/wiki/Blogs-and-tutorials)
1bb90298
AL
39
40# Tested OS
41
daf56504 42| NO | Status| Platform|
43|----|-------|---------|
620f8613 44|1|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/ubuntu-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)| Ubuntu
45|2|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/debian-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)| Debian
46|3|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/centos-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|CentOS
990d46d6 47|4|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/windows-cygwin.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|Windows (cygwin with curl, openssl and crontab included)
620f8613 48|5|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/freebsd.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|FreeBSD
49|6|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/pfsense.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|pfsense
50|7|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/opensuse-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|openSUSE
51|8|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/alpine-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|Alpine Linux (with curl)
52|9|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/base-archlinux.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|Archlinux
53|10|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/fedora-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|fedora
54|11|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/kalilinux-kali-linux-docker.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|Kali Linux
55|12|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/oraclelinux-latest.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|Oracle Linux
56|13|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/proxmox.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)| Proxmox https://pve.proxmox.com/wiki/HTTPSCertificateConfiguration#Let.27s_Encrypt_using_acme.sh
63c6a3b0 57|14|-----| Cloud Linux https://github.com/Neilpang/le/issues/111
620f8613 58|15|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/openbsd.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|OpenBSD
199067e8 59|16|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/mageia.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|Mageia
3ad08e95 60|17|-----| OpenWRT: Tested and working. See [wiki page](https://github.com/Neilpang/acme.sh/wiki/How-to-run-on-OpenWRT)
527dd31c 61|18|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/solaris.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|SunOS/Solaris
5961d443 62|19|[![](https://cdn.rawgit.com/Neilpang/acmetest/master/status/gentoo-stage3-amd64.svg)](https://github.com/Neilpang/letest#here-are-the-latest-status)|Gentoo Linux
b28a3db3 63|20|[![Build Status](https://travis-ci.org/Neilpang/acme.sh.svg?branch=master)](https://travis-ci.org/Neilpang/acme.sh)|Mac OSX
6c0ab5d2 64
1bb90298 65For all build statuses, check our [daily build project](https://github.com/Neilpang/acmetest):
6c0ab5d2 66
6cc11ffb 67https://github.com/Neilpang/acmetest
07f4ec4f 68
2b45dba5 69
1bb90298 70# Supported modes
2c75b3fd 71
1bb90298
AL
72- Webroot mode
73- Standalone mode
74- Apache mode
7db28745 75- Nginx mode ( Beta )
1bb90298 76- DNS mode
7c488b59 77- [Stateless mode](https://github.com/Neilpang/acme.sh/wiki/Stateless-Mode)
2b45dba5 78
e8cce73a 79
df1c9d88 80# 1. How to install
6c0ab5d2 81
1bb90298 82### 1. Install online
6c0ab5d2 83
5bdad844 84Check this project: https://github.com/Neilpang/get.acme.sh
b0515cf8 85
2b45dba5 86```bash
99dc89c0 87curl https://get.acme.sh | sh
90dda23f 88```
89
90Or:
2b45dba5
SF
91
92```bash
99dc89c0 93wget -O - https://get.acme.sh | sh
90dda23f 94```
95
96
1bb90298 97### 2. Or, Install from git
2b45dba5 98
1bb90298 99Clone this project and launch installation:
2b45dba5
SF
100
101```bash
6cc11ffb 102git clone https://github.com/Neilpang/acme.sh.git
2b45dba5 103cd ./acme.sh
6cc11ffb 104./acme.sh --install
6c0ab5d2 105```
90dda23f 106
2b45dba5
SF
107You `don't have to be root` then, although `it is recommended`.
108
1bb90298 109Advanced Installation: https://github.com/Neilpang/acme.sh/wiki/How-to-install
d9ded9f3 110
2b45dba5 111The installer will perform 3 actions:
7a894c4c 112
1bb90298
AL
1131. Create and copy `acme.sh` to your home dir (`$HOME`): `~/.acme.sh/`.
114All certs will be placed in this folder too.
1152. Create alias for: `acme.sh=~/.acme.sh/acme.sh`.
1163. Create daily cron job to check and renew the certs if needed.
2b45dba5
SF
117
118Cron entry example:
119
120```bash
1210 0 * * * "/home/user/.acme.sh"/acme.sh --cron --home "/home/user/.acme.sh" > /dev/null
122```
acc1e53a 123
1bb90298
AL
124After the installation, you must close the current terminal and reopen it to make the alias take effect.
125
126Ok, you are ready to issue certs now.
acc1e53a 127
6c0ab5d2 128Show help message:
2b45dba5 129
6c0ab5d2 130```
39c8f79f 131root@v1:~# acme.sh -h
6c0ab5d2 132```
1bb90298
AL
133
134# 2. Just issue a cert
2400e41f 135
2b45dba5 136**Example 1:** Single domain.
2400e41f 137
2b45dba5 138```bash
caa2e45a 139acme.sh --issue -d example.com -w /home/wwwroot/example.com
6c0ab5d2 140```
2b45dba5 141
4c38fec3 142or:
143
144```bash
145acme.sh --issue -d example.com -w /home/username/public_html
146```
147
148or:
149
150```bash
151acme.sh --issue -d example.com -w /var/www/html
152```
153
2b45dba5
SF
154**Example 2:** Multiple domains in the same cert.
155
156```bash
1bb90298 157acme.sh --issue -d example.com -d www.example.com -d cp.example.com -w /home/wwwroot/example.com
6c0ab5d2 158```
2400e41f 159
4c38fec3 160The parameter `/home/wwwroot/example.com` or `/home/username/public_html` or `/var/www/html` is the web root folder where you host your website files. You **MUST** have `write access` to this folder.
6c0ab5d2 161
1bb90298
AL
162Second argument **"example.com"** is the main domain you want to issue the cert for.
163You must have at least one domain there.
6c0ab5d2 164
caa2e45a 165You must point and bind all the domains to the same webroot dir: `/home/wwwroot/example.com`.
6c0ab5d2 166
1bb90298 167Generated/issued certs will be placed in `~/.acme.sh/example.com/`
6c0ab5d2 168
1bb90298 169The issued cert will be renewed automatically every **60** days.
6c0ab5d2 170
6cc11ffb 171More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
a63b05a9 172
173
1bb90298 174# 3. Install the issued cert to Apache/Nginx etc.
a63b05a9 175
1bb90298
AL
176After you issue a cert, you probably want to install/copy the cert to your Apache/Nginx or other servers.
177You **MUST** use this command to copy the certs to the target files, **DO NOT** use the certs files in **~/.acme.sh/** folder, they are for internal use only, the folder structure may change in the future.
2b45dba5 178
1bb90298 179**Apache** example:
2b45dba5 180```bash
cd9c3a79 181acme.sh --install-cert -d example.com \
5c539af7 182--cert-file /path/to/certfile/in/apache/cert.pem \
183--key-file /path/to/keyfile/in/apache/key.pem \
184--fullchain-file /path/to/fullchain/certfile/apache/fullchain.pem \
4743171b 185--reloadcmd "service apache2 force-reload"
3c33cdfa 186```
187
1bb90298 188**Nginx** example:
3c33cdfa 189```bash
cd9c3a79 190acme.sh --install-cert -d example.com \
5c539af7 191--key-file /path/to/keyfile/in/nginx/key.pem \
192--fullchain-file /path/to/fullchain/nginx/cert.pem \
4743171b 193--reloadcmd "service nginx force-reload"
6c0ab5d2 194```
7a894c4c 195
a63b05a9 196Only the domain is required, all the other parameters are optional.
197
fe600441
GL
198The ownership and permission info of existing files are preserved. You may want to precreate the files to have defined ownership and permission.
199
1bb90298
AL
200Install/copy the issued cert/key to the production Apache or Nginx path.
201
202The cert will be `renewed every **60** days by default` (which is configurable). Once the cert is renewed, the Apache/Nginx service will be restarted automatically by the command: `service apache2 restart` or `service nginx restart`.
7a894c4c 203
6c0ab5d2 204
df1c9d88 205# 4. Use Standalone server to issue cert
6c0ab5d2 206
1bb90298 207**(requires you to be root/sudoer or have permission to listen on port 80 (TCP))**
072290f2 208
1bb90298 209Port `80` (TCP) **MUST** be free to listen on, otherwise you will be prompted to free it and try again.
2b45dba5
SF
210
211```bash
caa2e45a 212acme.sh --issue --standalone -d example.com -d www.example.com -d cp.example.com
072290f2
N
213```
214
6cc11ffb 215More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
a63b05a9 216
e22bcf7c 217
1bb90298
AL
218# 5. Use Standalone TLS server to issue cert
219
220**(requires you to be root/sudoer or have permission to listen on port 443 (TCP))**
e22bcf7c 221
222acme.sh supports `tls-sni-01` validation.
223
1bb90298 224Port `443` (TCP) **MUST** be free to listen on, otherwise you will be prompted to free it and try again.
e22bcf7c 225
226```bash
caa2e45a 227acme.sh --issue --tls -d example.com -d www.example.com -d cp.example.com
e22bcf7c 228```
229
230More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
231
1bb90298 232
df1c9d88 233# 6. Use Apache mode
2b45dba5 234
1bb90298 235**(requires you to be root/sudoer, since it is required to interact with Apache server)**
2b45dba5 236
1bb90298 237If you are running a web server, Apache or Nginx, it is recommended to use the `Webroot mode`.
a63b05a9 238
1bb90298 239Particularly, if you are running an Apache server, you should use Apache mode instead. This mode doesn't write any files to your web root folder.
2c75b3fd 240
1bb90298 241Just set string "apache" as the second argument and it will force use of apache plugin automatically.
2c75b3fd 242
243```
1bb90298 244acme.sh --issue --apache -d example.com -d www.example.com -d cp.example.com
2c75b3fd 245```
a63b05a9 246
6cc11ffb 247More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
2c75b3fd 248
9d725af6 249# 7. Use Nginx mode
1bb90298 250
9d725af6 251**(requires you to be root/sudoer, since it is required to interact with Nginx server)**
252
253If you are running a web server, Apache or Nginx, it is recommended to use the `Webroot mode`.
254
255Particularly, if you are running an nginx server, you can use nginx mode instead. This mode doesn't write any files to your web root folder.
256
257Just set string "nginx" as the second argument.
258
259It will configure nginx server automatically to verify the domain and then restore the nginx config to the original version.
260
261So, the config is not changed.
262
263```
264acme.sh --issue --nginx -d example.com -d www.example.com -d cp.example.com
265```
266
267More examples: https://github.com/Neilpang/acme.sh/wiki/How-to-issue-a-cert
268
269# 8. Use DNS mode:
a947dbc6 270
2b45dba5
SF
271Support the `dns-01` challenge.
272
273```bash
1bb90298 274acme.sh --issue --dns -d example.com -d www.example.com -d cp.example.com
a947dbc6
N
275```
276
1bb90298 277You should get an output like below:
2b45dba5 278
a947dbc6
N
279```
280Add the following txt record:
caa2e45a 281Domain:_acme-challenge.example.com
a947dbc6
N
282Txt value:9ihDbjYfTExAYeDs4DBUeuTo18KBzwvTEjUnSwd32-c
283
284Add the following txt record:
caa2e45a 285Domain:_acme-challenge.www.example.com
a947dbc6 286Txt value:9ihDbjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
a947dbc6
N
287
288Please add those txt records to the domains. Waiting for the dns to take effect.
a947dbc6 289```
2b45dba5
SF
290
291Then just rerun with `renew` argument:
292
293```bash
caa2e45a 294acme.sh --renew -d example.com
a947dbc6
N
295```
296
297Ok, it's finished.
298
1bb90298 299
9d725af6 300# 9. Automatic DNS API integration
a947dbc6 301
1bb90298 302If your DNS provider supports API access, we can use that API to automatically issue the certs.
6c0ab5d2 303
1bb90298 304You don't have to do anything manually!
ab497961 305
2b45dba5 306### Currently acme.sh supports:
855d9499 307
9c174758 3081. CloudFlare.com API
3091. DNSPod.cn API
3101. CloudXNS.com API
3111. GoDaddy.com API
9c174758 3121. PowerDNS.com API
9bc5f686 3131. OVH, kimsufi, soyoustart and runabove API
3141. nsupdate API
9c174758 3151. LuaDNS.com API
3161. DNSMadeEasy.com API
9bc5f686 3171. AWS Route 53
be39ab32 3181. aliyun.com(阿里云) API
192ede5e 3191. ISPConfig 3.1 API
b2686e5b 3201. Alwaysdata.com API
38f23343 3211. Linode.com API
e6b940e2 3221. FreeDNS (https://freedns.afraid.org/)
edfefb67 3231. cyon.ch
3d6a125b 3241. Domain-Offensive/Resellerinterface/Domainrobot API
fab2d9dc 3251. Gandi LiveDNS API
9c87a589 3261. Knot DNS API
ac690fce 3271. DigitalOcean API (native)
3e9478b5 3281. ClouDNS.net API
4ddafb8e 3291. Infoblox NIOS API (https://www.infoblox.com/)
9cf65e31 3301. VSCALE (https://vscale.io/)
66e38ae6 3311. Dynu API (https://www.dynu.com)
9bc5f686 3321. DNSimple API
5e3a5f62 3331. NS1.com API
1bb90298 334
1bb90298 335
9bc5f686 336
337And:
338
3391. lexicon DNS API: https://github.com/Neilpang/acme.sh/wiki/How-to-use-lexicon-dns-api
340 (DigitalOcean, DNSimple, DNSMadeEasy, DNSPark, EasyDNS, Namesilo, NS1, PointHQ, Rage4 and Vultr etc.)
341
342
343
1bb90298 344**More APIs coming soon...**
ab497961 345
1bb90298 346If your DNS provider is not on the supported list above, you can write your own DNS API script easily. If you do, please consider submitting a [Pull Request](https://github.com/Neilpang/acme.sh/pulls) and contribute it to the project.
ab497961 347
1bb90298 348For more details: [How to use DNS API](dnsapi)
ab497961 349
350
9d725af6 351# 10. Issue ECC certificates
2b45dba5 352
1bb90298 353`Let's Encrypt` can now issue **ECDSA** certificates.
2b45dba5 354
1bb90298 355And we support them too!
1add47a6 356
8b92aab7 357Just set the `length` parameter with a prefix `ec-`.
2b45dba5 358
1add47a6 359For example:
9e6c4208 360
bcbecff6 361### Single domain ECC certificate
9e6c4208 362
2b45dba5 363```bash
1bb90298 364acme.sh --issue -w /home/wwwroot/example.com -d example.com --keylength ec-256
1add47a6 365```
2b45dba5 366
1bb90298 367### SAN multi domain ECC certificate
2b45dba5
SF
368
369```bash
1bb90298 370acme.sh --issue -w /home/wwwroot/example.com -d example.com -d www.example.com --keylength ec-256
9e6c4208
N
371```
372
1add47a6 373Please look at the last parameter above.
374
375Valid values are:
376
2b45dba5
SF
3771. **ec-256 (prime256v1, "ECDSA P-256")**
3782. **ec-384 (secp384r1, "ECDSA P-384")**
3793. **ec-521 (secp521r1, "ECDSA P-521", which is not supported by Let's Encrypt yet.)**
1add47a6 380
df1c9d88 381
9d725af6 382# 11. How to renew the issued certs
df1c9d88 383
1bb90298 384No, you don't need to renew the certs manually. All the certs will be renewed automatically every **60** days.
df1c9d88 385
386However, you can also force to renew any cert:
387
388```
1bb90298 389acme.sh --renew -d example.com --force
df1c9d88 390```
391
392or, for ECC cert:
1bb90298 393
df1c9d88 394```
1bb90298 395acme.sh --renew -d example.com --force --ecc
df1c9d88 396```
397
1bb90298 398
9d725af6 399# 12. How to upgrade `acme.sh`
1bb90298 400
329174b6 401acme.sh is in constant development, so it's strongly recommended to use the latest code.
df1c9d88 402
403You can update acme.sh to the latest code:
1bb90298 404
df1c9d88 405```
406acme.sh --upgrade
407```
408
1bb90298
AL
409You can also enable auto upgrade:
410
59649e9b 411```
1bb90298 412acme.sh --upgrade --auto-upgrade
59649e9b 413```
1bb90298
AL
414
415Then **acme.sh** will be kept up to date automatically.
59649e9b 416
417Disable auto upgrade:
1bb90298 418
59649e9b 419```
1bb90298 420acme.sh --upgrade --auto-upgrade 0
59649e9b 421```
422
1bb90298 423
9d725af6 424# 13. Issue a cert from an existing CSR
8371b030 425
426https://github.com/Neilpang/acme.sh/wiki/Issue-a-cert-from-existing-CSR
427
428
cb6f6229 429# 14. Under the Hood
6c0ab5d2 430
99dc89c0 431Speak ACME language using shell, directly to "Let's Encrypt".
6c0ab5d2
N
432
433TODO:
434
1bb90298 435
cb6f6229 436# 15. Acknowledgments
1bb90298 437
63f04675
N
4381. Acme-tiny: https://github.com/diafygi/acme-tiny
4392. ACME protocol: https://github.com/ietf-wg-acme/acme
4e1f39cd 4403. Certbot: https://github.com/certbot/certbot
63f04675 441
1bb90298 442
cb6f6229 443# 16. License & Others
6c0ab5d2
N
444
445License is GPLv3
446
1d06c947 447Please Star and Fork me.
6c0ab5d2 448
1bb90298 449[Issues](https://github.com/Neilpang/acme.sh/issues) and [pull requests](https://github.com/Neilpang/acme.sh/pulls) are welcome.
6c0ab5d2
N
450
451
cb6f6229 452# 17. Donate
453Your donation makes **acme.sh** better:
6c0ab5d2 454
43d3b51b 4551. PayPal/Alipay(支付宝)/Wechat(微信): [https://donate.acme.sh/](https://donate.acme.sh/)
456
1bb90298 457[Donate List](https://github.com/Neilpang/acme.sh/wiki/Donate-list)