루트 SSL 인증서 설치

루트 SSL 인증서 설치

루트 및 서버 인증서를 생성하고 루트로 서명했습니다. 신뢰할 수 없는 연결에 대한 경고를 제거하기 위해 루트 인증서를 설치하려면 어떻게 해야 합니까?업데이트, dpkg 재구성작동 안함. Kali Linux v.1.1.0에서 OpenSSL, Iceweasel 브라우저를 사용하고 있습니다.

편집하다

단계: 루트 CA의 키를 생성합니다.

dd if=/dev/random of=.rnd count=64 bs=32
openssl genrsa -rand .rnd -out org.key 2048

인증서 요청을 생성합니다:

openssl req  -new -key org.key -config org.cnf -out org.csr

그리고:

org.cnf
[ req ] 
default_bits = 2048 
distinguished_name = req_distinguished_name 
extensions = v3_req 
x509_extensions = usr_cert 
[ req_distinguished_name ] 
countryName = US 
countryName_default = US 
stateOrProvinceName  = City
stateOrProvinceName_default = City
localityName = City
localityName_default = City 
organizationName = Company
organizationName_default = Company
organizationalUnitName = CA 
organizationalUnitName_default = CA 
commonName = CAuthority 
commonName_default = CAuthority 
emailAddress = [email protected]
emailAddress_default = [email protected]
[ v3_req ] 
basicConstraints = CA:TRUE 
nsComment = "CA certificate of PTI" 
nsCertType = sslCA 
[ usr_cert ]
# These extensions are added when 'ca' signs a request.
basicConstraints=critical,CA:TRUE

루트 CA를 만듭니다.

openssl  x509 -req -signkey org.key -in org.csr -extfile org.cnf -out org.crt -days 1830

루트에 대한 내용은 이것이 전부입니다. 이제 서버 인증서를 생성하여 Apache에 설치해야 합니다. 키 생성:

dd if=/dev/urandom of=.rnd count=64 bs=32;
openssl genrsa -rand .rnd -out httpd.key 2048; 

인증서 요청을 생성합니다:

openssl req  -new -key httpd.key -config httpd.cnf -out httpd.csr

그리고:

httpd.cnf
[ req ] 
default_bits = 2048 
distinguished_name = req_distinguished_name 
extensions = v3_req 
x509_extensions = usr_cert 
[ req_distinguished_name ] 
countryName = country [US] 
countryName_default = US 
stateOrProvinceName  = province [City] 
stateOrProvinceName_default = City 
localityName = locality [City] 
localityName_default = City
organizationName = organization [Company] 
organizationName_default = Company
organizationalUnitName = OU_name 
organizationalUnitName_default = Webserver 
commonName = commonName 
commonName_default = "localhost" 
emailAddress = email 
emailAddress_default = [email protected]
[ v3_req ] 
basicConstraints = CA:false 
nsComment = "Apache Server Certificate" 
nsCertType = server
[ usr_cert ]
# These extensions are added when 'ca' signs a request.
basicConstraints=critical,CA:TRUE

결국 나는 서명했다.httpd.csr다음 명령을 사용하십시오.

openssl ca -notext -in httpd.csr -cert org.crt -keyfile org.key -out httpd.crt -md sha1 -days 90 -verbose;

그런 다음 내 설치httpd.crt그리고httpd.key아파치에 접근하려고 하면https 로컬호스트, "연결을 신뢰할 수 없습니다"라고 표시됩니다. 다음에 추가httpd.crtIceweasel 당국에게는 아무런 결과도 없었습니다. 여전히 "신뢰할 수 없는 연결"입니다.

답변1

CA:True으로 설정 해야 합니다 root.crt.

브라우저에서는 CA가 아닌 인증서를 Authorities목록에 추가하는 것을 허용하지 않으므로 오류 메시지가 표시됩니다.

다음 명령을 사용하여 이 확장이 인증서에 있는지 확인할 수 있습니다.

openssl x509 -noout -text -in root.crt

그러면 인증서의 텍스트 표현이 인쇄되며 다음 발췌문을 검색할 수 있습니다.

X509v3 Basic Constraints: critical
    CA:TRUE

존재하지 않는 경우 openssl구성 파일을 수정하고 지정된 블록에 다음을 추가 해야 합니다 x509_extensions.

basicConstraints = critical, CA:TRUE

manx509v3_configopenssl.cnf모든 세부 정보가 제공되지만 다음은 Fedora 23 시스템에 있는 파일의 예입니다.

####################################################################
[ ca ]
default_ca  = CA_default        # The default ca section

####################################################################
[ CA_default ]

dir     = /etc/pki/CA       # Where everything is kept
certs       = $dir/certs        # Where the issued certs are kept
crl_dir     = $dir/crl      # Where the issued crl are kept
database    = $dir/index.txt    # database index file.
#unique_subject = no            # Set to 'no' to allow creation of
                    # several ctificates with same subject.
new_certs_dir   = $dir/newcerts     # default place for new certs.

certificate = $dir/cacert.pem   # The CA certificate
serial      = $dir/serial       # The current serial number
crlnumber   = $dir/crlnumber    # the current crl number
                    # must be commented out to leave a V1 CRL
crl     = $dir/crl.pem      # The current CRL
private_key = $dir/private/cakey.pem# The private key
RANDFILE    = $dir/private/.rand    # private random number file

x509_extensions = usr_cert      # The extentions to add to the cert

이는 다음 내용을 포함하는 x509_extensions파일 이름의 아래쪽 섹션을 가리키는 것을 알 수 있습니다 .usr_cert

[ usr_cert ]

# These extensions are added when 'ca' signs a request.

basicConstraints=CA:TRUE

이름은 user_cert단지 이름일 뿐이므로 인증서가 CA 인증서라는 사실은 중요하지 않습니다. OCD가 있는 경우 usr_cert두 가지를 모두 변경할 수 있습니다 CA_cert.

위의 내용을 사용 중인 구성 파일에 추가해야 합니다. 즉, 명령 -config에 옵션을 추가하지 않으면 배포판의 기본 프로필이 사용됩니다. openssl이는 일반적으로 OpenSSL의 기본 디렉터리에 있으며 다음을 통해 찾을 수 있습니다.

openssl version -d

관련 정보