add alias --letsencrypt-certs and option --serve-chain

This commit is contained in:
AJ ONeal 2015-07-08 01:27:14 -06:00
parent c92c02dd88
commit 0912135e57
2 changed files with 26 additions and 3 deletions

View File

@ -69,13 +69,24 @@ If you want to quickly test the certificates you installed,
you can do so like this:
```bash
serve-https -p 8443 \
sudo serve-https -p 8443 \
--letsencrypt-certs test.mooo.com \
--serve-chain true
```
which is equilavent to
```bash
sudo serve-https -p 8443 \
--servername test.mooo.com
--key /etc/letsencrypt/live/test.mooo.com/privkey.pem \
--cert /etc/letsencrypt/live/test.mooo.com/cert.pem \
--chain /etc/letsencrypt/live/test.mooo.com/chain.pem \
-c "$(cat '/etc/letsencrypt/live/test.mooo.com/chain.pem')"
-c "$(cat 'sudo /etc/letsencrypt/live/test.mooo.com/chain.pem')"
```
and can be tested like so
```bash
curl --insecure https://test.mooo.com:8443 > ./chain.pem
curl https://test.mooo.com:8843 --cacert ./chain.pem

View File

@ -70,6 +70,7 @@ function run() {
var port = argv.p || argv.port || argv._[0] || 8443;
var pubdir = path.resolve(argv.d || argv._[1] || process.cwd());
var content = argv.c;
var letsencryptHost = argv['letsencrypt-certs'];
var cert = require('localhost.daplie.com-certificates');
var opts = {
@ -82,7 +83,14 @@ function run() {
}
};
if (argv.key || argv.cert || argv.chain) {
if (letsencryptHost) {
argv.key = argv.key || '/etc/letsencrypt/live/' + letsencryptHost + '/privkey.pem';
argv.cert = argv.cert || '/etc/letsencrypt/live/' + letsencryptHost + '/cert.pem';
argv.chain = argv.chain || '/etc/letsencrypt/live/' + letsencryptHost + '/chain.pem';
argv.servername = argv.servername || letsencryptHost;
}
if (argv.key || argv.cert || argv.chain || argv['serve-chain']) {
if (!argv.key || !argv.cert || !argv.chain) {
console.error("You must specify each of --key --cert and --chain (chain may be empty)");
return;
@ -104,6 +112,10 @@ function run() {
return (ca + '-----END CERTIFICATE-----').trim();
}));
}, []);
if (argv['serve-chain']) {
content = opts.ca.join('\r\n');
}
}
opts.servername = 'localhost.daplie.com';