Skip to content

snaptortoise/ssloca

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSLoca

Generate trusted local SSL certificates for macOS

This is a bash script that removes (some of) the headache when generating and trusting SSL certificates for localhost projects in macOS. Instead of jumping between ~5 different commands, 6+ prompts and manually opening Keychain Access to trust your locally generated certificates, you can simply run this script and be done with it.

To do so, clone the project and run:

./create-local-certificates.sh

You will be prompted to enter your user password for the final steps that add the certificates to your keychain. When finished you will have these files in your certs folder ready to use:

rootCA.key
rootCA.pem
server.crt
server.csr
server.key

How and where you use these will depend on your project.

If you're using Express it might look something like this:

const https = require('https');
const fs = require('fs');

const options = {
  key: fs.readFileSync('certs/server.key'),
  cert: fs.readFileSync('certs/server.crt'),
};

https.createServer(options, (req, res) => {
  res.writeHead(200);
  res.end("hello world\n");
}).listen(8080);

Caveats

Do not use this in any kind of production! The password generated for the root certificate is just password.

Kudos

About

Bash script that removes the headache of generating and trusting SSL certificates for localhost projects in macOS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages