Como fazer o curl ignorar certificado SSL inválido
Dica publicada em Linux / Comandos
Como fazer o curl ignorar certificado SSL inválido
Muitas vezes você pode estar testando APIs em ambiente de desenvolvimento e o certificado utilizado é inválido, requerendo que você ignore a mensagem de erro e proceda com o teste.
Exemplo:
curl https://localhost:3000
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Para resolvermos o problema iremos usar o curl com o parâmetro -k:
curl -k https://localhost:3000
Até a próxima!
Exemplo:
curl https://localhost:3000
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Para resolvermos o problema iremos usar o curl com o parâmetro -k:
-k, --insecureSendo assim basta executar:
(TLS) By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even for server connections otherwise considered insecure.
The server connection is verified by making sure the server's certificate contains the right name and verifies successfully using the cert store.
See this online resource for further details: https://curl.haxx.se/docs/sslcerts.html
See also --proxy-insecure and --cacert.
curl -k https://localhost:3000
Até a próxima!
Nem sabia que rolava esse problema com o SSL. É bom saber.
___________________________________
Conhecimento não se Leva para o Túmulo.