diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-16 12:10:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-16 12:10:45 +0300 |
commit | 554bb1eb1f1aa5aa45b5e4a1ee1557da0ccc59c0 (patch) | |
tree | 29a8009abef0ac5ecce6b8b608d5af2381a9663f /app/services/pages_domains | |
parent | 3e4c70d0708bdbf27edf4bbd3f01b85a921f759e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/pages_domains')
-rw-r--r-- | app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb b/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb index 1733021cbb5..c11b019cee5 100644 --- a/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb +++ b/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb @@ -10,6 +10,9 @@ module PagesDomains # no particular SLA, usually takes 10-15 seconds CERTIFICATE_PROCESSING_DELAY = 1.minute.freeze + # Maximum domain length for Let's Encrypt + MAX_DOMAIN_LENGTH = 64 + attr_reader :pages_domain def initialize(pages_domain) @@ -17,6 +20,11 @@ module PagesDomains end def execute + if pages_domain.domain.bytesize > MAX_DOMAIN_LENGTH + log_domain_length_error + return + end + pages_domain.acme_orders.expired.delete_all acme_order = pages_domain.acme_orders.first @@ -59,6 +67,16 @@ module PagesDomains NotificationService.new.pages_domain_auto_ssl_failed(pages_domain) end + def log_domain_length_error + Gitlab::AppLogger.error( + message: "Domain name too long for Let's Encrypt certificate", + pages_domain: pages_domain.domain, + pages_domain_bytesize: pages_domain.domain.bytesize, + max_allowed_bytesize: MAX_DOMAIN_LENGTH, + project_id: pages_domain.project_id + ) + end + def log_error(api_order) Gitlab::AppLogger.error( message: "Failed to obtain Let's Encrypt certificate", |