openssl生成cert

1
2
3
4
openssl genrsa -des3 -out server.key 2048
openssl rsa -in server.key -out server.key
openssl req -sha256 -new -key server.key -out server.csr -subj '/CN=localhost'
openssl x509 -req -sha256 -days 36500 -in server.csr -signkey server.key -out server.crt

https://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ cat cert.pem
-----BEGIN CERTIFICATE-----
MIIDJDCCAgwCCQDIHbBXyn2dyDANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJD
TjERMA8GA1UEBwwIc2hhbmdoYWkxEDAOBgNVBAoMB3F6c3RlY2gxHzAdBgNVBAMM
FmdpdGxhYi5pbmMucXpzdGVjaC5uZXQwIBcNMTcwODAxMDk1OTA0WhgPMjExNzA3
MDgwOTU5MDRaMFMxCzAJBgNVBAYTAkNOMREwDwYDVQQHDAhzaGFuZ2hhaTEQMA4G
A1UECgwHcXpzdGVjaDEfMB0GA1UEAwwWZ2l0bGFiLmluYy5xenN0ZWNoLm5ldDCC
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKaAZnlgevlhWR3djmFxZgcX
Pwy2PiWpgr4kXQGAbCMTS2ouiTYvSW6rr9ofRv39G7yxSc7Rah6N1f9y6y9/itR7
C2vMSM/GHMX8zvLt49PFNjhIYv1Nd38VBoXSxz72yp+iagCKooYC9Zn+mEQlmAbJ
/zv9T8UiYTeV9FMHYO3HoTlet/tYeBmWr5ukEncBt5fxfM3yGuipR721qUCD0Hub
mXx3r/YJ5LerSjS6SBug2i8lusSkF6mRJUNyF58ouNAqnj4RFGgmwdwuRZn0TVF7
SWL9kDIB9dxi/pu1AFPBpxq/T7fgxuR6EdCO5Gu/QTZdGDpWoKqN5UgfWQwvzcEC
AwEAATANBgkqhkiG9w0BAQsFAAOCAQEAKivEQXuW3KfxeucuCE2ovCuHgzd5RP6k
RRUTDpufPmD8JH3b1vn0r4lq+u2WppwkFhlx99O89zygzuT19UtefUQ5Fgll0dbQ
vfgICiRvQFoYw427QWUS29Z4wNZM384TkCkWPoh7zzsIz8EBzAbv8a/OcTIcsYYu
QCrozqhqMnetHqhz7D9ShWAxP7rKGgf3lTC0ehpax8b6P24Q1Yuk3BsB6ErrAMCD
FXoIW/a9jy9lgm1oIeBvGSWZCaoVE+4x3JYhtozpx1WlapdRxEYvNxzpcF7o35MS
Ff9AHyLdYUqN4Q4IdwYOmpQnfN/dZhx5aAGjvcs/iQms/Ed92CKs4g==
-----END CERTIFICATE-----
1
2
$ git config --local http.sslCAInfo /path/cert.pem
$ git config --local --unset http.sslCAInfo
1
2
$ git config --local http.sslVerify false #NO NEED TO USE THIS
$ git config --local --unset http.sslverify
  • Copy CA cert to /usr/local/share/ca-certificates.
    1
    2
    sudo update-ca-certificates
    sudo service docker restart