Matthias Huber
Matthias Huber

Reputation: 269

Send HTTP GET/POST via a reverse proxy that requires client certificates

I am trying to send http GET/POST requests to applications that are hidden behind a reverse proxy. Communication with the reverse proxy is via https and the proxy requires a client certificate.

It looks like that the keystore certificate (gatling.http.ssl.keyStore.file) is not used to authenticate with the reverse proxy. I assume this because:

I haven't found a hint how I can specify that the client certificate is used for authentication with the reverse proxy. Maybe the client certificate is already used to authenticate with the reverse proxy and something else is not configured correctly. I don't know how to analyze further...

Hope that someone else already faced the same issue and know the solution. Also hints so that I can dig deeper are more than welcome!

Thanks

Upvotes: 4

Views: 1053

Answers (1)

Łukasz
Łukasz

Reputation: 643

I was doing that with Gatling 2.x on OSX. It requires a few steps more. Setting cert path in gatling.conf is not enough.

I received CRT.pem and KEY.pem files. I created p12 cert based on the key pair.

openssl pkcs12 -export -in client1-crt.pem -inkey client1-key.pem -out cert.p12

Then I created store and imported the cert to keystore.

keytool -importkeystore -deststorepass mycert -destkeystore filename-new-keystore.jks -srckeystore cert.p12 -srcstoretype PKCS12

The next step is to set correct path in gatling.conf (it depends on OS)

my gatling conf:

gatling {
  http {
    ssl {
      keyStore {
        type = "PKCS12"
        file = "/Users/lukasz/cert.p12"
        password = ""
      }
      trustStore {
        type = ""
        file = "/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/security/cacerts"
        password = "changeit"
      }
    }
  }
}

This way I was able to use custom certificate with Gatling. I'm not sure if this is a workaround or this is a proper way to handle custom certificate by JVM.

Upvotes: 0

Related Questions