use letsencrypt naming convention, and more recent localhost.daplie.com
This commit is contained in:
parent
2141fae373
commit
305692ce9e
13
README.md
13
README.md
|
@ -6,7 +6,7 @@ The end off all your self-signed certificate woes (in node.js at least)
|
||||||
This is an easy-as-git-clone example that will get you on your way without
|
This is an easy-as-git-clone example that will get you on your way without
|
||||||
any `DEPTH_ZERO_SELF_SIGNED_CERT` or `SSL certificate problem: Invalid certificate chain` headaches.
|
any `DEPTH_ZERO_SELF_SIGNED_CERT` or `SSL certificate problem: Invalid certificate chain` headaches.
|
||||||
|
|
||||||
See
|
See
|
||||||
[the explanation](https://github.com/coolaj86/node-ssl-root-cas/wiki/Painless-Self-Signed-Certificates-in-node.js) for
|
[the explanation](https://github.com/coolaj86/node-ssl-root-cas/wiki/Painless-Self-Signed-Certificates-in-node.js) for
|
||||||
the many details.
|
the many details.
|
||||||
|
|
||||||
|
@ -85,13 +85,16 @@ node ./request-without-warnings.js 8043
|
||||||
Test (warning free) with cURL
|
Test (warning free) with cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -v https://localhost.daplie.com \
|
curl -v https://localhost.daplie.com:8043 \
|
||||||
--cacert client/chain.pem
|
--cacert certs/client/chain.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: on macOS curl's `--cacert` option may not work properly
|
||||||
|
and so you may need to add the cert to the system keychain (described below)
|
||||||
|
|
||||||
Visit in a web browser
|
Visit in a web browser
|
||||||
|
|
||||||
<https://localhost.daplie.com>
|
<https://localhost.daplie.com:8043>
|
||||||
|
|
||||||
To get rid of the warnings, simply add the certificate in the `client` folder
|
To get rid of the warnings, simply add the certificate in the `client` folder
|
||||||
to your list of certificates by alt-clicking "Open With => Keychain Access"
|
to your list of certificates by alt-clicking "Open With => Keychain Access"
|
||||||
|
@ -103,7 +106,7 @@ You do have to set `Always Trust` a few times
|
||||||
Now season to taste
|
Now season to taste
|
||||||
---
|
---
|
||||||
|
|
||||||
You can poke around in the files for generating the certificates,
|
You can poke around in the files for generating the certificates,
|
||||||
but all you really have to do is replace `localhost.daplie.com`
|
but all you really have to do is replace `localhost.daplie.com`
|
||||||
with your very own domain name.
|
with your very own domain name.
|
||||||
|
|
||||||
|
|
29
serve.js
29
serve.js
|
@ -1,26 +1,15 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var https = require('https')
|
var https = require('https');
|
||||||
, port = process.argv[2] || 8043
|
var port = process.argv[2] || 8043;
|
||||||
, fs = require('fs')
|
var fs = require('fs');
|
||||||
, path = require('path')
|
var path = require('path');
|
||||||
, server
|
var server;
|
||||||
, options
|
var options = {
|
||||||
;
|
key: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'privkey.pem'))
|
||||||
|
, cert: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'fullchain.pem'))
|
||||||
require('ssl-root-cas')
|
};
|
||||||
.inject()
|
|
||||||
.addFile(path.join(__dirname, 'certs', 'server', 'my-root-ca.crt.pem'))
|
|
||||||
;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
key: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'privkey.pem'))
|
|
||||||
// You don't need to specify `ca`, it's done by `ssl-root-cas`
|
|
||||||
//, ca: [ fs.readFileSync(path.join(__dirname, 'certs', 'server', 'my-root-ca.crt.pem'))]
|
|
||||||
, cert: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'fullchain.pem'))
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function app(req, res) {
|
function app(req, res) {
|
||||||
res.setHeader('Content-Type', 'text/plain');
|
res.setHeader('Content-Type', 'text/plain');
|
||||||
|
|
Loading…
Reference in New Issue