nginx: a verificação de SSL falhou + redirecionamento errado

1

Esta é a minha configuração atual do nginx:

$ cat /etc/nginx/sites-enabled/bitbucket

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        server_name git.itextsupport.com bitbucket.itextsupport.com gitlab.itextsupport.com;

        return 302 https://git.itextsupport.com$request_uri;
}

server {
        listen 443 ssl default_server;

        server_name git.itextsupport.com;
        server_tokens off;
        add_header Strict-Transport-Security "max-age=31536000";

        access_log  /var/log/nginx/bitbucket_access.log;
        error_log   /var/log/nginx/bitbucket_error.log;

        ssl on;
        ssl_certificate /etc/ssl/private/ssl-itextsupport.pem;
        ssl_certificate_key /etc/ssl/private/ssl-itextsupport.key;

        location / {
                proxy_pass http://localhost:7990/;
                proxy_set_header        Host $host;
                proxy_set_header        X-Forwarded-Host $host;
                proxy_set_header        X-Forwarded-Server $host;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header        X-Real-IP $remote_addr;
                proxy_redirect          off;
        }
}

link redirecionar para git está OK em um console:

$ curl -I http://git.itextsupport.com                                                                                                                                                                                                    10:09  amedee@iTextQA
HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Tue, 15 Nov 2016 13:15:50 GMT
Content-Type: text/html
Content-Length: 154
Connection: keep-alive
Location: https://git.itextsupport.com/

Mas no Chrome, ele redireciona para https://gitlab.itextsupport.com/ . O cache do navegador já está desmarcado e desabilitado enquanto o DevTools está aberto. Sugestões para NUKE o cache de redirecionamento do Chrome são bem-vindas, mas essa não é a minha pergunta.

O redirecionamento acima também está correto para http://bitbucket.itextsupport.com e http://gitlab.itextsupport.com . Mais uma vez, não funciona no Chrome, mas essa não é a minha pergunta.

Próximo passo: testando o redirecionamento link .

$ curl -I https://bitbucket.itextsupport.com                                                                                                                                                                                                 curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

Eu adiciono -k como sugerido:

$ curl -I https://bitbucket.itextsupport.com -k                                                                                                                                                                                              HTTP/1.1 302 Found
Server: nginx
Date: Tue, 15 Nov 2016 13:31:56 GMT
Connection: keep-alive
X-AREQUESTID: @PT467Wx871x701860x0
X-ASEN: SEN-L8781032
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Cache-Control: no-store
Location: https://gitlab.itextsupport.com/dashboard
Content-Language: en-US
Strict-Transport-Security: max-age=31536000

Minhas duas perguntas:

  1. Por que a verificação SSL falha? Eu verifiquei /etc/ssl/private/ssl-itextsupport.{pem,key} , eles são os arquivos exatos fornecidos pela nossa empresa de hospedagem e como eles são usados em outros servidores, onde o https funciona. Ele falha no console e no navegador.
  2. Por que os https são redirecionados para o subdomínio gitlab em vez do subdomínio git ? Eu usei todo o servidor, e não consigo encontrar nenhuma configuração nginx relevante que possa ser responsável.
por Amedee Van Gasse 15.11.2016 / 14:51

1 resposta

1

Seu aplicativo da web enviou o segundo redirecionamento. Verifique sua configuração para se certificar de que sabe qual domínio ela deve estar atendendo.

Curl não gosta do certificado SSL porque você não instalou o certificado certificado intermediário .

    
por 15.11.2016 / 16:02