8

I'm trying to use Insomnia with Client Certificates. I followed this document from the Insomnia documentation. I added my certificate pem files and password.

The problem is that I'm still getting this error:

Error: Couldn't connect to server.

Do you have any idea why? Thanks.

Krisztián Balla
  • 19,223
  • 13
  • 68
  • 84
eli
  • 205
  • 2
  • 5
  • 12

3 Answers3

10

Insomnia seems rather strict in the rules to apply the client certificate. For example, if you connect to localhost:5050 you should put localhost:5050 as the host. Localhost as such does not work in this case.

Key + Certificate is also the safest way to get working results. I've noticed a number of cases where the encapsulated certificates (PFX) didn't work but the key + certificate file did. I assume that this is related to the way the pfx-certificates are created because it also applies for the browsers I test with.

fvanrysselberghe
  • 351
  • 3
  • 10
  • 1
    I can confirm that I cannot get Insomnia to work correctly with self signed certificates. See [this](https://github.com/getinsomnia/insomnia/issues/1284) issue and [this](https://github.com/getinsomnia/insomnia/issues/675) feature request. – GrayedFox Nov 29 '18 at 16:58
  • Thanks! After putting a port number into the Host field of the Client Certificate dialog on Mac I'm able to send requests to my server. – esmirnov Feb 10 '22 at 15:12
2

I was able to consume an extremely and rare service using insomnia version 2021.4.1. I could not consume it with Soapui nor Postman.

I followed these easy steps. It worked at first attempt :D, just the p12 file was enough on my case.

certificate-client-on-insomnia

Importing Certificates with Insomnia

I will put here the official documentation, in case the link disappears:

Insomnia supports PFX (Mac), and PEM (Windows and Linux) certificates. To import a new certificate, open the Document/Collection Settings dialog – accessible from the top-left menu – and click on the Client Certificates tab. From here, you can add new certificates and view existing ones.

Now lets walk through how to import one.

If you’re familiar with client certificates, the only field needing explanation should be the Host field.

  • Host: certificate will be sent when the host (and port if specified) matches
  • PFX: certificate in PFX or PKCS12 format (Only supported on Mac)
  • CRT File + Key File: certificate and key pair (only supported on Windows and Linux)
  • Passphrase: An optional passphrase for the certificate if required

After importing a certificate, it will show up in the main certificates list. From here, it can be enabled/disabled or deleted.

JRichardsz
  • 14,356
  • 6
  • 59
  • 94
  • Will this method of adding certificates in the collection settings of Insomnia, also help to resolve the issue when using SSL certificates (self-signed CA) ? – humbleCodes Apr 12 '23 at 17:03
  • What is you error? – JRichardsz Apr 13 '23 at 05:21
  • I have used java `keytool` command for creating SSL certificate and then using it for establishing HTTPS connection in my springBoot app, with the help of this SO answer - https://stackoverflow.com/a/62798750. And This SO post - https://stackoverflow.com/q/72417847/14106566 discusses the same error which I m getting. – humbleCodes Apr 17 '23 at 20:14
0

Insomnia is very strict about self-signed certificates.

I had a similar issue on a Windows environment with Insomnia version 2022.2.1.

My solution was to add the intermediate and root certificates as well to the client certificate (.crt) file with the following order:

-----BEGIN CERTIFICATE-----
client cert
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
intermediate cert
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
root cert
-----END CERTIFICATE-----

Then I imported the client certificate .crt file and .key file for the host and it worked.

Mert Can Ilis
  • 2,923
  • 2
  • 21
  • 18