2.0.7 • Published 7 years ago

create-ssl-cert v2.0.7

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

create-ssl-cert

Command line tool to create self signed SSL certificate

Based on the following amazing GIST.

NOTE!

  1. This only works on MAC!

  2. Requires Node version 8 or higher

Create

In the folder of your project use the NPM executer:

npx create-ssl-cert

This will create a certificate for the domain: FOLDER_NAME.dev and any subdomain.

Options

Hostname

npx create-ssl-cert --hostname myproject

This will create a certificate for the domain: myproject.dev and any subdomain.

Domain

npx create-ssl-cert --hostname myproject --domain test

This will create a certificate for the domain: myproject.test and any subdomain.

Route to localhost

You choose either 1. or 2.

1. Simple setup

This setup only works for the specific hostname and no subdomains. Add the following, where you replace hostname and top level domin name to your own configuration:

127.0.0.1    myproject.dev

to your /etc/hosts file.

2. Universal setup

You can do a "one time" setup, which works on all hostnames for the given top level domain, etc. .dev. A good solution is dnsmasq. Install it via homebrew.

brew install dnsmasq

To make it start when your mac boots up:

brew services start dnsmasq

To route all top level domain lookups to localhost you will have to run these commands. Replace dev in both echo commands if you chose a different top level domain.

mkdir -pv $(brew --prefix)/etc
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir -pv /etc/resolver
echo "address=/.dev/127.0.0.1" | sudo tee -a $(brew --prefix)/etc/dnsmasq.conf
echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/dev

You usually have to restart your computer for this to take proper effect.

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago