$ mkcert --install # to generate and install your root ca
$ mkcert myserver.local # to generate certificate
Then to enable https in jupyter use this snipped (it assumes your pem and key.pem files are in ~/.jupyter)
from pathlib import Path
c.NotebookApp.keyfile, c.NotebookApp.certfile = sorted(map(str,Path.home().glob('.jupyter/*.pem')))
I don't like the fact that mkcert keeps the rootCA unencrypted so I've put it to 1password and I'm using mkcert with a wrapper that brings the key back only when mycert is being used.
Here is a zsh snipped to get this working:
function mkcert_wrapped () {
MKCERT=$(which -p mkcert)
F=$("$MKCERT" --CAROOT)/rootCA-key.pem
op read -o "$F" -f -n op://Personal/mkcert/rootCA-key.pem >/dev/null
"$MKCERT" $@
rm "$F"
}
if command -v mkcert &> /dev/null
then
alias mkcert='mkcert_wrapped'
fi
Doing this second time, I have a few tips to get it. up and running.
brew install mkcert