]> git.proxmox.com Git - mirror_acme.sh.git/blame - README.md
add example for ecc certificate
[mirror_acme.sh.git] / README.md
CommitLineData
7a894c4c 1# le: means simp`Le`
6c0ab5d2
N
2Simplest shell script for LetsEncrypt free Certificate client
3
cbb5f7ec 4Simple and Powerful, you only need 3 minutes to learn.
8b92aab7 5
cbb5f7ec 6Pure written in bash, no dependencies to python, acme-tiny or LetsEncrypt official client.
d8069cd4 7Just one script, to issue, renew your certificates automatically.
6c0ab5d2 8
cbb5f7ec 9Probably it's the smallest&easiest&smartest shell script to automatically issue & renew the free certificates from LetsEncrypt.
6c0ab5d2 10
7a894c4c 11Do NOT require to be `root/sudoer`.
6c0ab5d2 12
7a894c4c 13#Tested OS
3bfb563b
N
141. Ubuntu/Debian.
152. CentOS
4e76098b 163. Windows (cygwin with curl, openssl and crontab included)
58b13856 174. FreeBSD with bash
54f473d8 185. pfsense with bash and curl
6c0ab5d2
N
19
20
2c75b3fd 21#Supported Mode
221. Webroot mode
232. Standalone mode
243. Apache mode
52639149 254. Dns mode
2c75b3fd 26
6c0ab5d2
N
27#How to use
28
291. Clone this project: https://github.com/Neilpang/le.git
30
312. Install le:
32```
33./le.sh install
34```
d0064bc3 35You don't have to be root then, although it is recommended.
7a894c4c 36
db25a3ea
N
37Which does 3 jobs:
38* create and copy `le.sh` to your home dir: `~/.le`
6c0ab5d2 39All the certs will be placed in this folder.
9b292d58 40* create alias : `le.sh=~/.le/le.sh` and `le=~/.le/le.sh`.
db25a3ea 41* create everyday cron job to check and renew the cert if needed.
acc1e53a 42
9b292d58 43After install, you must close current terminal and reopen again to make the alias take effect.
acc1e53a 44
cbb5f7ec 45Ok, you are ready to issue cert now.
6c0ab5d2
N
46Show help message:
47```
7a894c4c
N
48root@v1:~# le.sh
49https://github.com/Neilpang/le
50v1.1.1
51Usage: le.sh [command] ...[args]....
d0064bc3 52Available commands:
7a894c4c
N
53
54install:
55 Install le.sh to your system.
56issue:
57 Issue a cert.
58installcert:
59 Install the issued cert to apache/nginx or any other server.
60renew:
61 Renew a cert.
62renewAll:
63 Renew all the certs.
64uninstall:
65 Uninstall le.sh, and uninstall the cron job.
66version:
67 Show version info.
68installcronjob:
69 Install the cron job to renew certs, you don't need to call this. The 'install' command can automatically install the cron job.
70uninstallcronjob:
71 Uninstall the cron job. The 'uninstall' command can do this automatically.
72createAccountKey:
73 Create an account private key, professional use.
74createDomainKey:
75 Create an domain private key, professional use.
76createCSR:
77 Create CSR , professional use.
78
79
80root@v1:~/le# le issue
81Usage: le issue webroot|no|apache|dns a.com [www.a.com,b.com,c.com]|no [key-length]|no
6c0ab5d2 82
6c0ab5d2
N
83
84```
4e1346dd 85
bcbb64e5
N
86Set the param value to "no" means you want to ignore it.
87
88For example, if you give "no" to "key-length", it will use default length 2048.
89
90And if you give 'no' to 'cert-file-path', it will not copy the issued cert to the "cert-file-path".
91
92In all the cases, the issued cert will be placed in "~/.le/domain.com/"
93
6c0ab5d2
N
94
95# Just issue a cert:
2400e41f
N
96Example 1:
97Only one domain:
98```
99le issue /home/wwwroot/aa.com aa.com
100```
101
102Example 2:
103Multiple domains in the same cert:
104
6c0ab5d2
N
105```
106le issue /home/wwwroot/aa.com aa.com www.aa.com,cp.aa.com
107```
2400e41f 108
617ec4e3 109First argument `/home/wwwroot/aa.com` is the web root folder, You must have `write` access to this folder.
6c0ab5d2 110
d337abca 111Second argument "aa.com" is the main domain you want to issue cert for.
6c0ab5d2 112
cbb5f7ec 113Third argument is the additional domain list you want to use. Comma separated list, which is Optional.
6c0ab5d2 114
d337abca 115You must point and bind all the domains to the same webroot dir:`/home/wwwroot/aa.com`
6c0ab5d2
N
116
117The cert will be placed in `~/.le/aa.com/`
118
7a894c4c 119The issued cert will be renewed every 80 days automatically.
6c0ab5d2 120
7a894c4c 121# Install issued cert to apache/nginx etc.
6c0ab5d2 122```
d0064bc3 123le 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"
6c0ab5d2 124```
7a894c4c
N
125
126Install the issued cert/key to the production apache or nginx path.
127
cbb5f7ec 128The 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
129
130
cbb5f7ec 131# Use Standalone server to issue cert (requires you be root/sudoer, or you have permission to listen tcp 80 port):
4e1346dd 132Same usage as all above, just give `no` as the webroot.
072290f2
N
133The tcp `80` port must be free to listen, otherwise you will be prompted to free the `80` port and try again.
134
135```
136le issue no aa.com www.aa.com,cp.aa.com
137```
138
cbb5f7ec 139# Use Apache mode (requires you be root/sudoer, since it is required to interact with apache server):
bc1c69ff 140If you are running a web server, apache or nginx, it is recommended to use the Webroot mode.
2c75b3fd 141Particularly, if you are running an apache server, you can use apache mode instead. Which doesn't write any file to your web root folder.
142
143Just set string "apache" to the first argument, it will use apache plugin automatically.
144
145```
7a894c4c 146le issue apache aa.com www.aa.com,user.aa.com
2c75b3fd 147```
148All the other arguments are the same with previous.
149
6c0ab5d2 150
a947dbc6
N
151# Use DNS mode:
152Support the latest dns-01 challenge.
153
154```
7a894c4c 155le issue dns aa.com www.aa.com,user.aa.com
a947dbc6
N
156```
157
6e89f811 158You will get the output like bellow:
a947dbc6
N
159```
160Add the following txt record:
161Domain:_acme-challenge.aa.com
162Txt value:9ihDbjYfTExAYeDs4DBUeuTo18KBzwvTEjUnSwd32-c
163
164Add the following txt record:
165Domain:_acme-challenge.www.aa.com
166Txt value:9ihDbjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
167```
168
169Please add those txt records to the domains. Waiting for the dns to take effect.
170
6e89f811 171Then just retry with 'renew' command:
a947dbc6
N
172
173```
174le renew aa.com
175```
176
177Ok, it's finished.
178
179
08094865 180#Automatic dns api integeration
6c0ab5d2 181
cbb5f7ec 182If your dns provider supports api access, we can use api to automatically issue certs.
08094865 183You don't have do anything manually.
ab497961 184
855d9499 185###Currently we support:
186
cbb5f7ec 1871. Cloudflare.com api
1882. Dnspod.cn api
1893. Cloudxns.com api
1904. AWS Route 53, see: https://github.com/Neilpang/le/issues/65
ab497961 191
7bd9a3b1 192More apis are coming soon....
ab497961 193
39c6df29 194If your dns provider is not in the supported list above, you can write your own script api easily.
ab497961 195
855d9499 196For more details: [How to use dns api](dnsapi)
ab497961 197
198
1add47a6 199# Issue ECC certificate:
200LetsEncrypt now can issue ECDSA certificate.
201And we also support it.
202
8b92aab7 203Just set the `length` parameter with a prefix `ec-`.
1add47a6 204For example:
9e6c4208
N
205
206Single domain:
207```
208le issue /home/wwwroot/aa.com aa.com no ec-256
1add47a6 209```
9e6c4208
N
210
211SAN multiple domains:
1add47a6 212```
9e6c4208
N
213le issue /home/wwwroot/aa.com aa.com www.aa.com,cp.aa.com ec-256
214```
215
1add47a6 216Please look at the last parameter above.
217
218Valid values are:
219
2201. ec-256 (prime256v1, "ECDSA P-256")
2212. ec-384 (secp384r1, "ECDSA P-384")
8b92aab7 2223. ec-521 (secp521r1, "ECDSA P-521", which is not supported by letsencrypt yet.)
1add47a6 223
224
225
6c0ab5d2
N
226#Under the Hood
227
1162f82e 228Speak ACME language with bash directly to Let's encrypt.
6c0ab5d2
N
229
230TODO:
231
232
63f04675
N
233#Acknowledgment
2341. Acme-tiny: https://github.com/diafygi/acme-tiny
2352. ACME protocol: https://github.com/ietf-wg-acme/acme
2363. letsencrypt: https://github.com/letsencrypt/letsencrypt
237
238
239
6c0ab5d2
N
240#License & Other
241
242License is GPLv3
243
1d06c947 244Please Star and Fork me.
6c0ab5d2 245
18ab2c5c 246Issues and pull requests are welcomed.
6c0ab5d2
N
247
248
249