BTemplates.com

최근 글

이 블로그 검색

Powered by Blogger.

2017년 4월 14일 금요일


부록 A. SSL/TLS 인증서 구성


public endpoint를 통한 통신에 SSL/TLS를 사용하도록 Undercloud를 구성 할 수 있습니다. 그러나, 자체 인증 기관으로 SSL 인증서를 사용하는경우, 그 인증서는 다음 장에서 구성 단계가 필요합니다.
NOTE
overcloud SSL/TLS 인증서 생성을 위해, Advanced Overcloud Customization guide에 "Enabling SSL/TLS on the Overcloud"를 참조하십시오.

A.1. 서명 호스트 초기화하기

서명 호스트는 새 인증서를 생성하고 CA(certificate authority)로 그 인증서를 서명하는 호스트입니다. 선택한 서명 호스트에서 SSL 인증서를 생성한 적이 없는 경우, 서명 호스트가 새 인증서를 서명할수 있도록 호스트를 초기화할 필요가 있습니다.
/etc/pki/CA/index.txt 파일은 모든 서명된 인증서레코드들이 저장됩니다.이 파일이 존재하는지 확인하십시오. 파일이 없다면, 빈파일을 생성하십시오:
$ sudo touch /etc/pki/CA/index.txt
/etc/pki/CA/serial 파일은 서명한 다음 인증서용으로 사용할 다음 시리얼 번호를 식별합니다.이 파일이 없는경우,신규 시작값으로 새 파일을 생성하십시오:
$ sudo echo '1000' > /etc/pki/CA/serial

A.2. 인증기관(CERTIFICATE AUTHORITY) 생성하기

일반적으로 외부 인증 기관을 통해 SSL/TLS 인증서에 서명합니다. 어떤 상황에선, 자가 인증 기관을 사용하는 것이 목표일수 있습니다. 예를들어, 내부-전용-인증기관을 가질 수 있습니다.
예를들어, 인증기관 역할을 수행 할 키와 인증서 쌍을 생성합니다.
$ openssl genrsa -out ca.key.pem 4096
$ openssl req  -key ca.key.pem -new -x509 -days 7300 -extensions v3_ca -out ca.crt.pem
openssl req 명령은 권한에 대한 특정 세부 사항을 묻습니다. 이 세부사항들을 입력합니다.
그러면 ca.crt.pem 이라는 인증 기관 파일이 생성됩니다.

A.3. 인증 기관(CA)를 클라이언트들에 추가하기

SSL/TLS를 사용하여 통신하려는 외부 클라이언트의 경우, Red Hat OpenStack Platform 환경에 접근하려는 각 클라이언트에 인증 기관(CA) 파일을 복사하십시오. Once copied to the client, run the following command on the client to add it to the certificate authority trust bundle:
$ sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/
$ sudo update-ca-trust extract

A.4. SSL/TLS KEY 생성하기

undercloud 또는 overcloud 인증서를 생성하기 위해 사용하는, SSL/TLS 키(server.key.pem)를 생성하기 위해 다음 명령을 실행하십시오.
$ openssl genrsa -out server.key.pem 2048

A.5. SSL/TLS 인증서 서명 요청 만들기

이 단계는 undercloud 또는 overcloud에 대한 인증서 서명 요청(서)를 생성합니다. 사용자정의를 위해 기본 OpenSSL 구성파일을 복사합니다.
사용자가 정의 구성파일을 만들기 위해 기본 OpenSSL 구성 파일을 복사하십시오.
$ cp /etc/pki/tls/openssl.cnf .
복사한 openssl.cnf 파일을 편집하고 director용으로 사용할 SSL 파라미터를 설정하십시오. 다음은 수정할 파라미터들의 종류들의 예를 입니다.
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req

[req_distinguished_name]
countryName = Country Name (2 letter code)
countryName_default = AU
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = Queensland
localityName = Locality Name (eg, city)
localityName_default = Brisbane
organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = Red Hat
commonName = Common Name
commonName_default = 192.168.0.1
commonName_max = 64

[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[alt_names]
IP.1 = 192.168.0.1
DNS.1 = 192.168.0.1
DNS.2 = instack.localdomain
DNS.3 = vip.localdomain
Set the commonName_default to one of the following:
  • If using an IP address to access over SSL/TLS, use the undercloud_public_vipparameter in undercloud.conf.
  • If using a fully qualified domain name to access over SSL/TLS, use the domain name instead.
Include the same Public API IP address as an IP entry and a DNS entry in thealt_names section. If also using DNS, include the hostname for the server as DNS entries in the same section. For more information about openssl.cnf, run man openssl.cnf.
다음 명령을 실행하여 인증서 서명 요청(server.csr.pem)를 생성합니다:
$ openssl req -config openssl.cnf -key server.key.pem -new -out server.csr.pem
Make sure to include the SSL/TLS key you created in Section A.4, “Creating an SSL/TLS Key” for the -key option.
다음 섹션에서 SSL/TLS 인증서를 생성하기 위해 server.csr.pem 파일을 사용하십시오.

A.6. SSL/TLS 인증서 생성하기

다음 명령은 undercloud 또는 overcloud에 대한 인증서를 생성합니다:
$ openssl ca -config openssl.cnf -extensions v3_req -days 3650 -in server.csr.pem -out server.crt.pem -cert ca.crt.pem -keyfile ca.key.pem
This command uses:
This results in a certificate named server.crt.pem. Use this certificate in conjunction with the SSL/TLS key from Section A.4, “Creating an SSL/TLS Key” to enable SSL/TLS.

A.7. UNDERCLOUD에서 인증서 사용하기

다음 명령을 실행하여 인증서와 키를 결합합니다.
$ cat server.crt.pem server.key.pem > undercloud.pem
undercloud.pem 파일을 생성합니다. undercloud.conf 파일에 udercloud_service_certificate 옵션에 이 파일(undercloud.pem)에 위치를 지정합니다. 이 파일은 HAProxy가 파일을 읽을수 있도록 SELinux context가 필요합니다. 다음 예제를 지침으로 사용합시오.
$ sudo mkdir /etc/pki/instack-certs
$ sudo cp ~/undercloud.pem /etc/pki/instack-certs/.
$ sudo semanage fcontext -a -t etc_t "/etc/pki/instack-certs(/.*)?"
$ sudo restorecon -R /etc/pki/instack-certs
undercloud.conf 파일에 undercloud_service_certificate 옵션에  undercloud.pem파일의 위치를 추가 하십시오. 예를들어:
undercloud_service_certificate = /etc/pki/instack-certs/undercloud.pem
In addition, make sure to add your certificate authority from Section A.2, “Creating a Certificate Authority” to the undercloud’s list of trusted Certificate Authorities so that different services within the undercloud have access to the certificate authority:
$ sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/
$ sudo update-ca-trust extract
Continue installing the undercloud as per the instructions in Section 4.6, “Configuring the Director”.

인증서 관련 개념 정리
http://m.blog.naver.com/nttkak/20130245553

0 개의 댓글:

댓글 쓰기