dell / patches

Apache License 2.0
3 stars 2 forks source link

DOMAIN variable is incorrect in nginx when using a subdomain #6

Closed grantcurell closed 12 months ago

grantcurell commented 12 months ago

This is a bug but currently does not have any operational impact on the server. It primarily matters for this portion of the nginx config:

    listen 443 ssl;
        listen [::]:443 ssl;
        {% if dns_1 or dns_2 or ip_1 or ip_2 %}
        server_name {% if dns_1 %}{{ dns_1 }} {% endif %}{% if dns_2 and dns_2 != dns_1 %}{{ dns_2 }} {% endif %}{% if ip_1 and ip_1 != dns_1 and ip_1 != dns_2 %}{{ ip_1 }} {% endif %}{% if ip_2 and ip_2 != dns_1 and ip_2 != dns_2 and ip_2 != ip_1 %}{{ ip_2 }} {% endif %};
        {% endif %}

The server_name directive in an NGINX configuration is used to specify the domain names or IP addresses that should match the incoming HTTP requests for a specific server block (virtual host). It defines the hostnames or IP addresses that NGINX should consider when determining which server block should handle a particular request.

Update

This causes problem on key import in nginx:

When you import a server with name subdomain179.31005-domain.com and the CA has name subdomain399.29940-domain.com it causes nginx to look for /patches/server_certs/root_certs/subdomain399.31005-domain.com.crt instead of the correct CA subdomain.

2023/08/08 17:40:38 [emerg] 1#1: SSL_CTX_load_verify_locations("/patches/server_certs/root_certs/subdomain399.31005-domain.com.crt") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/patches/server_certs/root_certs/subdomain399.31005-domain.com.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib)
nginx: [emerg] SSL_CTX_load_verify_locations("/patches/server_certs/root_certs/subdomain399.31005-domain.com.crt") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/patches/server_certs/root_certs/subdomain399.31005-domain.com.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib)