How to trust SELF SIGNED certificates
- Before You Begin
- Usage: Ubuntu, CentOS
- Configurations: Change a directory
- Test
- curl
- snap
- Manual
- Ubuntu 20.04
- CentOS 7
- Other
- Create a directory named
certs
. - Append: .gitignore
- Save your certificates files in
certs
.
- Add lines to
Vagrantfile
- Run vagrant:
vagrant up
config.vm.provision "shell" do |s|
s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/ubuntu/focal64/update-certs.sh"
end
config.vm.provision "shell" do |s|
s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/centos/7/update-certs.sh"
end
args
: /vagrant/certs
in guest is default.
config.vm.provision "shell" do |s|
s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/ubuntu/focal64/update-certs.sh"
s.args = ["/custom/cert/path"]
end
config.vm.provision "shell" do |s|
s.path = "update-certs.sh"
end
config.vm.provision "shell" do |s|
s.path = "update-certs.sh"
s.args = ["/custom/cert/path"]
end
config.vm.provision "shell" do |s|
s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/centos/7/update-certs.sh"
s.args = ["/custom/cert/path"]
end
config.vm.provision "shell" do |s|
s.path = "update-certs.sh"
end
config.vm.provision "shell" do |s|
s.path = "update-certs.sh"
s.args = ["/custom/cert/path"]
end
curl -I https://example.com
HTTP/1.1 200 OK
sudo snap install hello-world
hello-world
Hello World!
Location of your .crt
files:
SOURCE_DIR=/path/to/dir
# In this project:
# SOURCE_DIR=/vagrant/certs
Update CA certificates:
sudo mkdir /usr/local/share/ca-certificates/my-certs
sudo cp ${SOURCE_DIR}/*.crt /usr/local/share/ca-certificates/my-certs
sudo update-ca-certificates
Output:
Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Verify:
diff --unchanged-group-format='@@ %dn,%df
%<' --old-group-format='' --new-group-format='' --changed-group-format='' \
/etc/ssl/certs/ca-certificates.crt ${SOURCE_DIR}/*.crt
Output:
@@ 21,3503
-----BEGIN CERTIFICATE-----
# ...
-----END CERTIFICATE-----
Store certificates in Snapd’s trusted certificates pool:
sudo snap set system store-certs.cert0="$(sed -e 's/\r//g' ${SOURCE_DIR}/YOUR_CERT_1.crt)"
sudo snap set system store-certs.cert1="$(sed -e 's/\r//g' ${SOURCE_DIR}/YOUR_CERT_2.crt)"
Update CA certificates:
sudo cp ${SOURCE_DIR}/*.crt /usr/share/pki/ca-trust-source/anchors
sudo update-ca-trust
Verify:
trust list | tail -7
Output:
pkcs11:id=%aa%94%60%f8%11%e1%bb;type=cert
type: certificate
label: COMPANY
trust: anchor
category: authority