Skip to content

barretlee/autocreate-ca

Repository files navigation

autocreate-ca

Autocreate cetificate authority, detail in Chinese.

Usage

Download shell:

git clone https://github.com/barretlee/autocreate-ca.git;
cd autocreate-ca;
chmod +x *.sh;

Defatult install path: /root/ca, you can replace it in the files below.

sh ./install-rootCA.sh
sh ./install-intermediateCA.sh
# fg. www.barretlee.com 
sh ./install-websiteConfig.sh

check

Dblclick /root/ca/intermediate/certs/ca-chain.cert.pem and install the certs.

Add one line to /etc/hostswww.barretlee.com is the Common Name setted in file install-websiteConfig.sh, you can change it.

127.0.0.1 www.barretlee.com

Then run the code below:

// https-server.js
var https = require('https');
var fs = require('fs');

var options = {
  key: fs.readFileSync('/root/ca/intermediate/private/www.barretlee.com.key.pem'),
  cert: fs.readFileSync('/root/ca/intermediate/certs/www.barretlee.com.cert.pem'),
  passphrase: 'passoword' // 如果生成证书的时候设置了密码,请添加改参数和密码
};

https.createServer(options, function(req, res) {
  res.writeHead(200);
  res.end('hello world');
}).listen(8000, function(){
  console.log('Open URL: https://www.barretlee.com:8000');
});

And you will see:

The detail of cert:

LICENSE & Thanks

MIT.

Thanks for https://jamielinux.com/docs/openssl-certificate-authority/index.html.

About

autocreate cetificate authority

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages