Skip to content

Instantly share code, notes, and snippets.

@tyrannosaurusjames
Last active April 22, 2018 19:58
Show Gist options
  • Save tyrannosaurusjames/5d27913dddde5b5c92794b68a97e2309 to your computer and use it in GitHub Desktop.
Save tyrannosaurusjames/5d27913dddde5b5c92794b68a97e2309 to your computer and use it in GitHub Desktop.
Setup wildcard cert for local development
# Assumed go is already installed somewhere
# Set the Go PATH (this is where go installs binaries/packages/source code)
export GOPATH=/home/james/go
# install easypki
go get github.com/google/easypki/cmd/easypki
# Add Go bin directory to PATH
export PATH=/home/james/go/bin:$PATH
# Create a directory to hold certs
mkdir /home/james/pki
# Define some details for cert creation
export PKI_ROOT=/home/james/pki
export PKI_ORGANIZATION="James Dev Ltd."
export PKI_ORGANIZATIONAL_UNIT="Web development"
export PKI_COUNTRY=NZ
export PKI_LOCALITY="Wellington"
export PKI_PROVINCE="Wellington"
# Create a root certificate authority
easypki create --filename james-dev-root --ca "James Dev Ltd. Certificate Authority"
# Create a wildcard cert (for *.james.dev in this case) signed by our root CA
easypki create --ca-name james-dev-root --dns "james.dev" --dns "*.james.dev" "james.dev"
# Import the root CA cert (/home/james/pki/james-dev-root/certs/james-dev-root.crt) into your browser or your OS's CA store
# Use the wildcard cert & key (/home/james/pki/james-dev-root/certs/james.dev.crt & /home/james/pki/james-dev-root/keys/james.dev.key)
# as the cert for any locally setup sites
@tyrannosaurusjames
Copy link
Author

tyrannosaurusjames commented Apr 22, 2018

Add CA cert in Ubuntu: (makes curl work)

sudo mkdir /usr/share/ca-certificates/extra
sudo cp /home/james/pki/james-dev-root/certs/james-dev-root.crt /usr/share/ca-certificates/extra
sudo dpkg-reconfigure ca-certificates # follow prompts to enable james-dev-root.crt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment