CLOUD/CICD
gitlab 설치시SSL configuration (Lets encrypt ::: The ACME server can not issue a certificate for an IP address) + CloudFlare
헐리
2021. 7. 6. 14:40
https 로 url을 정하고 설치시
gitlab-ctl 가동작되는 동안 에러가 있다는 메세지가 뜨며 설치가 완료되지 않는다
letsencrypt 설치하기
apt-get install -y letsencrypt
letsencrypt --version #certbot 0.40.0
인증에 사용 할 설정 추가하기
vim /etc/gitlab/gitlab.rb
letsencrypt['enable'] = true # GitLab 10.5 and 10.6 require this option
external_url "https://gitlab.example.com" # Must use https protocol
letsencrypt['contact_emails'] = ['foo@email.com'] # Optional
letsencrypt['auto_renew_hour'] = "12"
letsencrypt['auto_renew_minute'] = "30"
letsencrypt['auto_renew_day_of_month'] = "*/7"
Let's Encrypt 리뉴얼
sudo gitlab-ctl reconfigure
이랬는데도 에러가 난다.
찾아보니 Let;s Encrypt SSL 인증서를 발급받기 위해서는 4가지 방법이 있다고 한다
1.webroot
2.웹서버
3.standalone
4.DNS
지금부터 사용해볼 방법은 4번이다. 도메인을 쿼리해 확인되는 TXT 레코드로 사이트 유효성을 확인하는 방법으로 와일드 카드 방식으로 인증서를 발급 가능하다.
외부에서 TXT 레코드를 입력할 수 있도록 DNS 가 API를 제공하는 경우만 갱신 과정을 자동으로 처리한다
이를 위해 CloudFlare API를 사용한다
CloudFlare
패키지 설치
sudo apt-get install python3-certbot-dns-cloudflare
회원가입 후 홈페이지 등록
API key
Global API key 조회해서 복사
cd /root
mkdir .secret
vim /root/.secret/cloudflare_api.ini
dns_cloudflare_email = "이메일 주소 입력"
dns_cloudflare_api_key = "Global API Key 입력"
chmod 700 /root/.secret
chmod 400 /root/.secret/cloudflare_api.ini
인증서 생성하기
certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secret/cloudflare_api.ini -d <도메인이름> --preferred-challenges dns-01
여기서 개인적인 문제가 발생함
letsencrypt, cloudflare (ACME server)에서 IP주소에 SSL을 발급해주지 않는다는 것
다른 유료인 방법이 있다고 나왔지만 결국 http를 쓰기로 했다