내용
Overview
Let 's Encrypt는 다음을 사용하는 개방형 자동화 인증 기관입니다. 절정 (자동 인증서 관리 환경) 프로토콜을 사용하여 모든 호환 클라이언트에 무료 TLS / SSL 인증서를 제공합니다. 이 인증서는 웹 서버와 사용자 간의 통신을 암호화하는 데 사용할 수 있습니다.
이 자습서에서는 인증 기관과 Zevenet 통합이 Let 's Encrypt와 작동하는 방식에 대해 간략히 논의한 다음 Zevenet이 certbot (ACME 클라이언트) Let 's encrypt 인프라 스트럭처와 통신하기 위해.
Zevenet Load Balancer 6.0.3 이상의 버전에는 작은 certbot 래퍼가 포함되어 있습니다. letsencryptz Certbot Webroot 기능을 사용하려면 다음 줄에서이 래퍼가 작동하는 방식을 설명하고 프로덕션 환경에서 작동하게하려면이 모든 것을 고려하십시오.
Let 's encrypt 유효성 검사는 어떻게 작동합니까?
간단한 webroot 기능 설명으로 webroot 플러그인은 Zevenet 파일 경로에서 요청한 도메인 각각에 대한 임시 파일을 만들어 작동합니다 /usr/local/zevenet/app/letsencryptz/webroot/.well-known/acme-challenge/. 그런 다음 Let 's Encrypt 유효성 검사 서버는 요청 된 각 도메인의 DNS가 letsencryptz 래퍼를 실행하는 서버로 확인되고 유효성 검사를위한 임시 파일에 액세스 할 수 있는지 확인하기 위해 HTTP 요청을 수행합니다. 다음 다이어그램은 실제 예를 설명합니다.
이전 다이어그램에서 Zevenet로드 밸런서는 공용 IP 주소가있는 라우터 / 방화벽 뒤에 있습니다. 185.79.20.147 (예를 들어) HTTP 및 HTTPS 트래픽은로드 균형 조정기가 192.168.101.31 서로 다른 팜으로 구성된 VIP 2 (예)를 사용하여 내부 부하 분산 장치에 고정되어 있습니다.
HTTPS 팜 이름 WebHosting 를 통해 192.168.101.31:443. 이 농장은 웹 호스팅 서비스를 제공하며 다른 웹 서버는 인터넷과 함께 게시됩니다. 예를 들어, test1.zevenet.es, test2.zevenet.es, test3.zevenet.es 이 가상 서비스에 게시 된 웹 페이지를 다른 사람들과 함께 테스트하고 있습니다.
HTTP 팜 이름 웹 호스팅 리디렉션 를 통해 192.168.101.31:80. 이 팜은 리디렉션 목적으로 만 사용되며 HTTP에서 HTTPS 로의 모든 트래픽을 강제로 전달합니다.
이전 다이어그램은 도메인에 대한 SSL Let 's Encrypt Certificate 요청을 설명합니다. test1.zevenet.es 다음과 같이 :
1. 로드 밸런서 자체에서 Let 's Encrypt 인프라로 인증서 요청이 전송됩니다.
2. 암호화는 새로운 SSL 인증서 요청을 감지합니다. test1.zevenet.es
3. 요청 된 호스트에 대한 DNS IP 확인을 암호화하여 실행 해 보겠습니다. test1.zevenet.es 그 결과가 요청을 시작한 동일한 출발지 IP 인 공용 IP인지를 확인한다.
4. 이 시점에서 암호화하자 letsencryptz 스크립트 (webroot cerbot)를 사용하여 파일을 생성해야합니다. 해시시 공공 길에서 http://test1.zevenet.es/.well-know/acme-challenge/ (80 TCP 포트), 로컬 디렉토리 /usr/local/zevenet/app/letsencryptz/webroot/.well-known/acme-challenge/. 그때, letsencryptz 이 파일을 인터넷에서 액세스 가능하게 만들기 위해 임시 서비스를 구성합니다 (팜 웹 호스팅 리디렉션 이 목적으로 수정 될 것입니다. 이미 구성된 팜이없는 경우 letsencryptz 이 VIP와 항구에서 임시적인 것을 만들 것입니다.)
6. 자마자 letsencryptz 임시 서비스 생성을 확인하고, 암호화 서버가 임시 유효성 검증 파일이 작성되었는지와 해시시 내용이 정확합니다.
7. 마지막으로 Let 's Encrypt 서버는 이미 생성 된 인증서로 첫 번째 요청에 응답합니다. 공통 이름 (CN) test1.zevenet.es.
8. Zevenet은 이미 생성 된 인증서를 로컬 경로에 저장합니다. / usr / local / zevenet / config / 팜에서 구성 할 준비가되었습니다. WebHosting.
이 단계에서 새로운 Let 's Encrypt 인증서가 HTTPS 가상 서비스에 사용됩니다.
자동화 명령을 암호화하자
기술 된 바와 같이, letsencryptz 스크립트는 작성, 갱신, 삭제 또는 나열과 같은 SSL 인증서를 관리하기 위해 필요한 조치를 자동화합니다. 사용 가능한 명령을 아래에서 찾으십시오.
root@zva6k:~# letsencryptz letsencryptz description: letsencryptz is a let's encrypt (certbot) wrapper with minimal parameters ready to manage Let's Encrypt certificates for ZEVENET https profiles. Take into account that this wrapper uses certbot webroot feature so the public Let's encrypt architecture requires to connect with a local Virtual IP and port (TCP 80 by default) in order to do a request validation for the requested domain, so as soon as the "obtain" param is used, this script will configure an HTTP farm which will be accessed by Let's encrypt for verification purpose, this configuration is done automatically by this script itself, only ensure that the used Virtual IP and HTTP port 80 is not used by any another load balanced farm, and also ensure that the DNS resolution for the requested domain is reachable from let's encrypt system. usage: /usr/local/zevenet/bin/letsencryptz <action> <commands> action: --obtain | --destroy | --renew | --list | --listconf | --help --obtain: Request new Certificates using webroot cert-bot module. commands: --vip <Virtual IP> --farm <Farm Name> --domain <domain1> --domain <domain2> --domain <domainN> --test --vip: The Virtual IP already configured were to publish a temporal web server, this will be connected by let's encrypt public servers to verify the certificate request. The Virtual IP has to be free on the 80 port in order to be bound by a local process, if it isn't free then use --farm instead. --farm: The farm name which configures a temporal Service called "letsencryptz", if no farm is used a temporal farm called "letsencryptZevenet" will be configured in the selected Virtual IP. --domain: The domain which requests the Certificate for, i.e. www.mycompany.com. --test: Optional parameter, if used the certificate is requested for test purpose. --destroy: Revoke and delete the indicated Certificate Name, the action is rejected if the given certificate is in use by a farm. commands: --certname <Certificate Name> --certname: Certificate Name, this value can be obtained from the action --list. --renew: Renew the certificates near to expiry, no commands needed commands: --test --forcerestart --vip <Virtual IP> --farm <Farm Name> --test: Optional parameter, if used a dry-run is executed, the renew of the certificates is simulated. --forcerestart: Optional parameter, if used the farms that are using the renewed certificates will be restarted in order to apply the changes. --vip: The Virtual IP already configured where to publish a temporal web server, this will be connected by let's encrypt public servers to verify the certificate renew. The Virtual IP has to be free on the 80 port in order to be bound by a local process, if it isn't free then use --farm instead. --farm: The farm name which configures a temporal Service called "letsencryptz", if no farm is used a temporal farm called "letsencryptZevenet" will be configured in the selected Virtual IP. --list: List all the local certificates managed by let's encrypt and the status, no commands needed. --listconf: List the Zevenet let's encrypt configuration module (check global.conf file), no commands needed. --help: Obtain this help.
시스템이 해결되지 않은 종속성을 자동으로 설치하고 사용을 시작하기 전에 구성 검토가 수행되기 때문에 letsencryptz가 처음 실행되는 데 시간이 걸립니다. Let 's Encrypt는 인증서와 관련된 이메일 계정 또는 연락 목적을 요청합니다. 이 이메일 계정은 Let 's Encrypt 시스템에 대해 수행되는 모든 작업과 함께 사용됩니다.이 이메일은 기본 구성 파일에서 구성 할 수 있습니다. /usr/local/zevenet/config/global.conf, 지시어 $ le_email.
몇 가지 사용 예가 아래에 나와 있습니다.
Zevenet Let 's Encrypt 인증서 생성
이 명령은 도메인에 대한 새 인증서를 요청합니다. test2.zevenet.es. 주어진 VIP가 내부 IP가 될 것이며, 공용 IP에서 내부 IP로 트래픽이 생성되어야한다는 점을 고려하십시오. Let 's Encrypt가이 서비스에 연결할 수없는 경우 요청이 거부됩니다.
root@zva6k:~# letsencryptz --obtain --vip 192.168.101.31 --domain test2.zevenet.es WARNING: No farm name specified, a temporal farm with name letsencryptZevenet will be created in VIP 192.168.101.31 port 80. Configuring farm for let's encrypt Certificate Name verification Obtaining Certificate for domains test2.zevenet.es... Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None Obtaining a new certificate Non-standard path(s), might not work with crontab installed by your operating system package manager Certificate Request for the domain(s) test2.zevenet.es OK Created Certificate name test2.zevenet.es in PEM format ready for HTTPS profile Destroying webroot configuration for the farm letsencryptZevenet Deleting already configuration for letsencryptZevenet, service letsencryptz Restarting farms using renewed certificates:
Zevenet Let 's Encrypt 인증서 목록
이 명령을 실행하면 Zevenet Let 's Encrypt 시스템에서 관리하는 현재 인증서가 표시됩니다.
root@zva6k:~# letsencryptz --list Listing all available certificates for the current configuration in config dir /usr/local/zevenet/config/letsencrypt/ Saving debug log to /var/log/letsencrypt/letsencrypt.log Certificate Name: test1.zevenet.es Domain(s): test1.zevenet.es Expiry Date: 2019-09-19 10:48:02+00:00 (VALID: 77 days) Pem Certificate file: /usr/local/zevenet/config/test1_zevenet_es.pem Certificate Name: test3.zevenet.es Domain(s): test3.zevenet.es Expiry Date: 2019-09-26 06:32:52+00:00 (VALID: 83 days) Pem Certificate file: /usr/local/zevenet/config/test3_zevenet_es.pem
현장 고려하기 인증서 이름이 필드는 다음과 같이 letsencryptz 래퍼에 의해 인식됩니다. – 인증서 이름.
Zevenet Let 's Encrypt 인증서 갱신
위의 명령은 이미 생성 된 인증서에 갱신이 필요한지 여부를 확인합니다.이 경우 갱신은 자동으로 수행됩니다. 갱신 된 인증이 사용 중이면 변경을 적용하기 위해 팜 다시 시작이 필요할 것임을 고려하여 옵션을 사용하십시오. – 강제 재시작 당신이 원하는 경우 letsencryptz 변경 내용을 적용하기 위해 필요한 모든 팜을 다시 시작합니다.
root@zva6k:~# letsencryptz --renew --vip 192.168.101.31 Renewing all the required certificates Saving debug log to /var/log/letsencrypt/letsencrypt.log Cert not yet due for renewal Cert not yet due for renewal
Zevenet Let 's Encrypt 인증서 삭제
이 명령은 주어진 인증서를 취소하고 삭제합니다. 시스템이 선택한 인증서가 현재 HTTPS 팜에서 사용되고 있음을 감지하면 작업이 거부됩니다. 위 예제에서 팜에서 인증서를 사용 중이므로 삭제 작업이 거부됩니다. 테스트.
root@zva6k:~# letsencryptz --destroy --certname test3.zevenet.es Revoking and deleting certificate(s) test3.zevenet.es for the current configuration... This file can't be deleted because is used by the farm(s): testhttps
인증서가 팜에서 할당 해제되면 작업이 완료됩니다.
root@zva6k:~# letsencryptz --destroy --certname test3.zevenet.es Revoking and deleting certificate(s) test3.zevenet.es for the current configuration... Saving debug log to /var/log/letsencrypt/letsencrypt.log Deleted certificate(s) test3.zevenet.es in path /usr/local/zevenet/config/test3_zevenet_es.pem
Let 's Encrypt 인증서를 Zevenet으로 마이그레이션
Zevenet로드 밸런서는 다음의 모든 구성 파일을 저장합니다. certbot 로컬 경로에 있음 / usr / local / zevenet / config / letsencrypt /. 기존 certbot 구성 파일을 이동하려면 (기본적으로 / etc / letsencrypt) 다른 서버의 Zevenet에 대해 서버에있는 기존 구성 디렉토리의 tarball (tar.gz 파일)을 만들고 Zevenet Let 's Encrypt 구성 경로의 콘텐츠 압축을 풀면됩니다. 마지막으로 변수 수정을 고려하십시오. $ le_email 파일에 global.conf 이전 요청에 사용 된 것과 동일한 이메일로 전송됩니다.
Let 's Encrypt Certificates Clustering 지원
Zevenet Let 's Encrypt 플러그인은 Zevenet Cluster 서비스에서 완전히 지원됩니다. 모든 Let 's Encrypt 작업은 Zevenet Cluster Service에 의해 복제 된 구성 파일에 저장되므로 모든 작업은 MASTER 노드가 노예 노드에서 자동으로 실행되지만 노예 동기화 해제를 피하기 위해 Let 's Encrypt와 관련된 노드는 삭제됩니다.
Let 's Encrypt 인증서 자동 갱신
Zevenet Let 's Encrypt 플러그인은 일부 인증서를 갱신해야하는지 매일 확인하도록 구성 할 수 있습니다. 시스템이 지정된 인증서를 자동으로 갱신하고 일부 팜에서 사용중인 경우 해당 인증서를 적용하기 위해 팜이 자동으로 다시 시작됩니다. 인증서 변경.
자동 갱신을 구성하려면 다음을 수행하십시오.
다음 cron 파일 만들기 /etc/cron.d/letsencryptz 다음 내용으로
root@zva6k:~# cat /etc/cron.d/letsencryptz 00 00 * * * root /usr/local/zevenet/bin/letsencryptz --renew --forcerestart --vip 192.168.101.31
이 구성을 사용하면 갱신 확인이 매일 00:00 (자정)에 실행됩니다. 그리고 VIP 192.168.101.31은 Let 's Encrypt System의 확인 목적으로 포트 80에서 사용됩니다.
참조
이 기사에서 사용 된 참조는 다음과 같습니다.