Skip to content

Instantly share code, notes, and snippets.

@prafull01
Created June 15, 2018 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prafull01/b8d6b45c511b39e14ff637503f8caa51 to your computer and use it in GitHub Desktop.
Save prafull01/b8d6b45c511b39e14ff637503f8caa51 to your computer and use it in GitHub Desktop.
$ export PEER_NAME=$(hostname)
$ export PRIVATE_IP=$(ip addr show eth0 | grep -Po 'inet \K[\d.]+')
$ cfssl print-defaults csr > config.json
$ sed -i 's/www\.example\.net/'"$PRIVATE_IP"'/' config.json
$ sed -i 's/example\.net/'"$PEER_NAME"'/' config.json
$ sed -i '0,/CN/{s/example\.net/'"$PEER_NAME"'/}' config.json
$ cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server config.json | cfssljson -bare server
$ cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=peer config.json | cfssljson -bare peer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment