DiUS / pact_broker-docker

'Dockerised' pact broker
http://pact.io
MIT License
76 stars 102 forks source link

Pact Broker SSL Certificates for Webhooks #74

Closed davidkgp closed 6 years ago

davidkgp commented 6 years ago

Pre issue-raising checklist

I have already (please mark the applicable with an x):

I am facing issues with triggering webhooks from inside the broker.Currently the weebhook link has a corporate certificate,so if I try with config config.disable_ssl_verification = true it gives me HTTP 400.

and if I try to trigger the webhook with config.disable_ssl_verification = false Error executing webhook OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 state=error: certificate verify failed.

I have the corporate certificates,But I am not sure where should I add the certificates.

A curl from inside the docker to the webhook is successful,but when triggered from within the pact broker fails on pact publish

mefellows commented 6 years ago

In the first scenario (verification disabled), an HTTP 400 is unrelated to certificates, are you sure it's not another issue? What does the response contain?

Also see the section in https://github.com/pact-foundation/pact_broker/wiki/Configuration#webhook-whitelists for how to add custom certs to the system.

bethesque commented 6 years ago

Closing due to lack of response - please feel free to reopen with more information if you are still facing this issue @davidkgp

davidkgp commented 6 years ago

@bethesque the issue is solved.The script was not working for me,but would work for a lot of people as I was lacking in few dependencies for the script.But I would like to point out for few users who may have faced a similar issue,the certificate chain(PEM format) for the webhook(in case using a corporate CI) have to be put into the content column of the certificates table in the pact broker database. Before execution of the webhook these certificates are loaded into the trust store by the broker and the webhook executed.It would be really nice if this can be part of the documentation because most people will be working in a corporate SSL env.

bethesque commented 6 years ago

Thanks @davidkgp. I assume the script did not work for you because you ran it on an environment that did not have ruby or mysql?

I will update the docs to make this clearer, and explain how to add it without the script.

I really need to create an endpoint for adding the certificates - it just hasn't gotten to the top of the priority list yet.

bethesque commented 6 years ago

I've just added a brief section here @davidkgp https://github.com/pact-foundation/pact_broker/wiki/Configuration#webhook-ssl-certificates

davidkgp commented 6 years ago

Two points I like to be highlighted in the documentation if possible

bethesque commented 6 years ago

What is a better term for the type of certificate @davidkgp? I will add the info about the table.

mefellows commented 6 years ago

That's the very definition of a self-signed certificate. You have your own CA, which you use to sign and then issue your own certificates.