项目作者: rurumimic

项目描述 :
GOD DAMN self-signed certificates
高级语言: Shell
项目地址: git://github.com/rurumimic/no-check-certificate.git
创建时间: 2021-02-04T04:18:09Z
项目社区:https://github.com/rurumimic/no-check-certificate

开源协议:

下载


no-check-certificate

How to trust SELF SIGNED certificates


Before You Begin

  1. Create a directory named certs.
  2. Append: .gitignore
  3. Save your certificates files in certs.

Usage

  1. Add lines to Vagrantfile
  2. Run vagrant: vagrant up

Ubuntu 20.04

  1. config.vm.provision "shell" do |s|
  2. s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/ubuntu/focal64/update-certs.sh"
  3. end

CentOS 7

  1. config.vm.provision "shell" do |s|
  2. s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/centos/7/update-certs.sh"
  3. end

Configurations

args: /vagrant/certs in guest is default.

Ubuntu 20.04

  1. config.vm.provision "shell" do |s|
  2. s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/ubuntu/focal64/update-certs.sh"
  3. s.args = ["/custom/cert/path"]
  4. end
  5. config.vm.provision "shell" do |s|
  6. s.path = "update-certs.sh"
  7. end
  8. config.vm.provision "shell" do |s|
  9. s.path = "update-certs.sh"
  10. s.args = ["/custom/cert/path"]
  11. end

CentOS 7

  1. config.vm.provision "shell" do |s|
  2. s.path = "https://raw.githubusercontent.com/rurumimic/no-check-certificate/main/centos/7/update-certs.sh"
  3. s.args = ["/custom/cert/path"]
  4. end
  5. config.vm.provision "shell" do |s|
  6. s.path = "update-certs.sh"
  7. end
  8. config.vm.provision "shell" do |s|
  9. s.path = "update-certs.sh"
  10. s.args = ["/custom/cert/path"]
  11. end

Test

CURL

  1. curl -I https://example.com
  2. HTTP/1.1 200 OK

Ubuntu Snap

  1. sudo snap install hello-world
  2. hello-world
  3. Hello World!

Manual

Location of your .crt files:

  1. SOURCE_DIR=/path/to/dir
  2. # In this project:
  3. # SOURCE_DIR=/vagrant/certs

Ubuntu 20.04

Update CA certificates:

  1. sudo mkdir /usr/local/share/ca-certificates/my-certs
  2. sudo cp ${SOURCE_DIR}/*.crt /usr/local/share/ca-certificates/my-certs
  3. sudo update-ca-certificates

Output:

  1. Updating certificates in /etc/ssl/certs...
  2. 1 added, 0 removed; done.
  3. Running hooks in /etc/ca-certificates/update.d...
  4. done.

Verify:

  1. diff --unchanged-group-format='@@ %dn,%df
  2. %<' --old-group-format='' --new-group-format='' --changed-group-format='' \
  3. /etc/ssl/certs/ca-certificates.crt ${SOURCE_DIR}/*.crt

Output:

  1. @@ 21,3503
  2. -----BEGIN CERTIFICATE-----
  3. # ...
  4. -----END CERTIFICATE-----

Snap

Store certificates in Snapd’s trusted certificates pool:

  1. sudo snap set system store-certs.cert0="$(sed -e 's/\r//g' ${SOURCE_DIR}/YOUR_CERT_1.crt)"
  2. sudo snap set system store-certs.cert1="$(sed -e 's/\r//g' ${SOURCE_DIR}/YOUR_CERT_2.crt)"

CentOS 7

Update CA certificates:

  1. sudo cp ${SOURCE_DIR}/*.crt /usr/share/pki/ca-trust-source/anchors
  2. sudo update-ca-trust

Verify:

  1. trust list | tail -7

Output:

  1. pkcs11:id=%aa%94%60%f8%11%e1%bb;type=cert
  2. type: certificate
  3. label: COMPANY
  4. trust: anchor
  5. category: authority