자체 서명 된 SSL 인증서가 잘못되었습니다. "주체 대체 이름 누락"
최근에 Chrome이 자체 서명 된 SSL 인증서 작업을 중단하고 안전하지 않다고 생각합니다. DevTools | Security
탭 에서 인증서를 보면
주체 대체 이름 없음이 사이트의 인증서에 도메인 이름 또는 IP 주소가 포함 된 주체 대체 이름 확장이 없습니다.
인증서 오류 사이트의 인증서 체인 (net :: ERR_CERT_COMMON_NAME_INVALID)에 문제가 있습니다.
이 문제를 어떻게 해결할 수 있습니까?
이 문제를 해결하려면 openssl
기본적으로 인증서를 생성 할 때 추가 매개 변수를 제공해야합니다.
-sha256 -extfile v3.ext
경우 v3.ext
에 그렇게 같은 파일이며, %%DOMAIN%%
당신이 당신으로 사용하는 것과 동일한 이름으로 대체 Common Name
. 여기 와 여기에 더 많은 정보 가 있습니다 . 일반적으로 인증서를 생성하려는 도메인에 Common Name
및 %%DOMAIN%%
을 설정합니다 . 따라서이면 www.mysupersite.com
둘 다에 사용할 것입니다.
v3.ext
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = %%DOMAIN%%
참고 :이 문제를 해결 하고 Chrome, Safari 및 Java 클라이언트에서 사용할 완전히 신뢰할 수있는 SSL 인증서를 생성 하는 스크립트는 여기에서 찾을 수 있습니다.
또 다른 참고 사항 : 자체 서명 된 인증서를 볼 때 Chrome에서 오류가 발생하지 않도록하는 것 뿐 이라면 여기에 설명 된대로 특수한 명령 줄 옵션으로 시작하여 Chrome이 모든 사이트에 대한 모든 SSL 오류를 무시하도록 지시 할 수 있습니다. 수퍼 유저
다음 솔루션은 크롬 65 ( ref ) 에서 나를 위해 일했습니다.
OpenSSL 구성 파일 생성 (예 : req.cnf)
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
C = US
ST = VA
L = SomeCity
O = MyCompany
OU = MyDivision
CN = www.company.com
[v3_req]
keyUsage = critical, digitalSignature, keyAgreement
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = www.company.com
DNS.2 = company.com
DNS.3 = company.net
이 구성 파일을 참조하는 인증서 만들기
openssl req -x509 -nodes -days 730 -newkey rsa:2048 \
-keyout cert.key -out cert.pem -config req.cnf -sha256
내가 만든 bash는 스크립트를 쉽게 크롬에서 유효 자체 서명 된 TLS 인증서를 생성 할 수 있도록.
인증서를 설치 한 후 크롬 ( chrome://restart
) 을 다시 시작해야합니다 . 테스트되었으며 Chrome 65.x
여전히 작동 중입니다.
확인해야 할 또 다른 (훨씬 더 강력한) 도구는 CloudFlare의 cfssl
도구 키트입니다.
나는 단순히 -subj
기계 IP 주소를 추가 하는 매개 변수 를 사용한다 . 따라서 하나의 명령으로 만 해결되었습니다.
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -sha256 -subj '/CN=my-domain.com/subjectAltName=DNS.1=192.168.0.222/' -keyout my-domain.key -out my-domain.crt
C, ST, L, O, OU, emailAddress와 같은 다른 속성을 추가하여 프롬프트없이 인증서를 생성 할 수 있습니다.
I was able to get rid of (net::ERR_CERT_AUTHORITY_INVALID) by changing the DNS.1 value of v3.ext file
[alt_names] DNS.1 = domainname.com
Change domainname.com with your own domain.
on MAC starting from chrome Version 67.0.3396.99 my self-signed certificate stopped to work.
regeneration with all what written here didn't work.
UPDATE
had a chance to confirm that my approach works today :). If it doesn't work for you make sure your are using this approach
v3.ext
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = <specify-the-same-common-name-that-you-used-while-generating-csr-in-the-last-step>
$
copied from here https://ksearch.wordpress.com/2017/08/22/generate-and-import-a-self-signed-ssl-certificate-on-mac-osx-sierra/
END UPDATE
finally was able to see green Secure only when removed my cert from system, and added it to local keychain. (if there is one - drop it first). Not sure if it maters but in my case I downloaded certificate via chrome, and verified that create date is today - so it is the one I've just created.
hope it will be helpful for someone spend like a day on it.
never update chrome!
Make a copy of your OpenSSL config in your home directory:
cp /System/Library/OpenSSL/openssl.cnf ~/openssl-temp.cnf
or on Linux:
cp /etc/ssl/openssl.cnf ~/openssl-temp.cnf
Add Subject Alternative Name to
openssl-temp.cnf
, under[v3_ca]
:[ v3_ca ] subjectAltName = DNS:localhost
Replace
localhost
by the domain for which you want to generate that certificate.Generate certificate:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ -config ~/openssl-temp.cnf -keyout /path/to/your.key -out /path/to/your.crt
You can then delete openssl-temp.cnf
Here is a very simple way to create an IP certificate that Chrome will trust.
The ssl.conf file...
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
req_extensions = req_ext
prompt = no
[ req_distinguished_name ]
commonName = 192.168.1.10
[ req_ext ]
subjectAltName = IP:192.168.1.10
Where, of course 192.168.1.10 is the local network IP we want Chrome to trust.
Create the certificate:
openssl genrsa -out key1.pem
openssl req -new -key key1.pem -out csr1.pem -config ssl.conf
openssl x509 -req -days 9999 -in csr1.pem -signkey key1.pem -out cert1.pem -extensions req_ext -extfile ssl.conf
rm csr1.pem
On Windows import the certificate into the Trusted Root Certificate Store on all client machines. On Android Phone or Tablet download the certificate to install it. Now Chrome will trust the certificate on windows and Android.
On windows dev box the best place to get openssl.exe is from "c:\Program Files\Git\usr\bin\openssl.exe"
'program tip' 카테고리의 다른 글
이 모든 OpenCV Python 인터페이스의 차이점은 무엇입니까? (0) | 2020.09.22 |
---|---|
IntelliJ가 편집기 탭을 자동으로 닫지 않도록하려면 어떻게해야합니까? (0) | 2020.09.22 |
__init__.py에 코드 추가 (0) | 2020.09.22 |
setTimeout ()에 남은 시간을 찾으십니까? (0) | 2020.09.22 |
CMAKE_INSTALL_PREFIX 사용 방법 (0) | 2020.09.22 |