SSL certificates with mkcert
Introâ
Remove SSL sign signed certificate warning with local CA(Certificate Authority) with mkcert.
Prerequisitesâ
minica written in go
Goâ
Install go
by following instructions here.
certutilâ
sudo apt install libnss3-tools # Debian
sudo yum install nss-tools # rhel/fedora
sudo pacman -S nss # Arch
sudo zypper install mozilla-nss-tools # openSUSE
Install mkcertâ
mkcert
is cross-platform tool so, it can be installed on most of the boxes.
Homebrewâ
mkcert can be install on Mac OS
and Linux
using homebrew
brew install mkcert
Choice of browser on mac is Firefox
, install nss
brew install nss # for Firefox
from sourceâ
Building from source requires Go 1.13+
git clone https://github.com/FiloSottile/mkcert && cd mkcert
go build -ldflags "-X main.Version=$(git describe --tags)"
Linuxâ
for Arch linux
sudo pacman -Syu mkcert
for Debian/Ubuntu
sudo apt install mkcert
Windowsâ
Using WinGet
winget install FiloSottile.mkcert
Using Chocolatey
choco install mkcert
Using Scoop
scoop bucket add extras
scoop install mkcert
Generate Certificateâ
CA Root Certificateâ
First root certificates needs to be generated,
mkcert -install
This will generate and install certificate in system root store.
The local CA is now installed in the system trust store! âĄī¸
To check the location of CA, run
mkcert -CAROOT
Defaults are
$env:LOCALAPPDATA # Windows
~/.local/share/mkcert # Linux
~/Library/Application Support/mkcert # Mac OS
Certificate for Controllerâ
To generate certificate, run
mkcert -key-file key.pem -cert-file cert.pem 192.168.0.2
Here 192.168.0.2
is the ip address of the controller.
Created a new certificate valid for the following names đ
- "192.168.0.2"
The certificate is at "cert.pem" and the key at "key.pem" â
It will expire on 18 January 2025 đ
PKCSâ
mkcert -pkcs12 192.168.0.2
Output should be something similar
Created a new certificate valid for the following names đ
- "192.168.0.2"
The PKCS#12 bundle is at "./192.168.0.2.p12" â
The legacy PKCS#12 encryption password is the often hardcoded default "changeit" âšī¸
It will expire on 18 January 2025 đ
Default password for pkcs
certificate is changeit
.
Install certificateâ
To install freshly generated certificate,
- go to
Controller Settings
>>Controller
>>HTTPS Certificate
- Change
File Format
toPEM
- Select
SSL Certificate
andSSL Key
and Click save.
Install CA Certificateâ
mkcert installs root Certs in proper store depending on the operating system but does not install in Firefox in Windows, in that case install it manually
Firefoxâ
Firefox manages it's own store for certificates. To add certificates
- Go to
about:preferences#privacy
. - Scroll down to
Certificates
. - Select
View Certificates
. - Select
Import
. - Select
PKCS
file192.168.0.2.p12
. - Enter the password or leave it empty if not applicable.
Reboot the controller/PC/Browser to update and changes to take effect.