Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client certificate not being passed #558

Closed
el-pablo opened this issue Apr 27, 2018 · 11 comments
Closed

Client certificate not being passed #558

el-pablo opened this issue Apr 27, 2018 · 11 comments
Labels
bug help wanted stale Ticket that is likely to go nowhere and that will be closed soon

Comments

@el-pablo
Copy link

My company is using mutual certificate authentication for our Jira instance. There's an option in the API to specify a client_cert parameter, but when I use it is ignored.

This is how I'm doing it:

from jira import JIRA
jira = JIRA({"server":'https://jirahostname.co.uk', "client_cert":'/path/to/mycert.pem'})

Which gives me an SSL handshake error.

I've tried adding this at line 453 of client.py:

self._session.cert = self._options['client_cert']
and it fixes the issue, but I'm a complete novice with Python and wondered whether this is just a hack and that there is something that I'm doing wrong.

If I've genuinely found a bug I'm happy to raise a pull request, but given my complete amateur status I thought I'd ask here first!

Thanks

@hdost
Copy link
Member

hdost commented May 6, 2018

Hey @el-pablo I believe you may just be having an issue with syntax.
Try:

from jira import JIRA
jira = JIRA('https://jirahostname.co.uk', options={'client_cert':'/path/to/mycert.pem'})

@el-pablo
Copy link
Author

el-pablo commented May 8, 2018

Thanks for the response @hdost - I just tried that and it doesn't seem to have helped....

@hdost
Copy link
Member

hdost commented May 8, 2018

What error does it seem to be giving you?

@el-pablo
Copy link
Author

el-pablo commented May 8, 2018

I get the following, which I believe is because it is not sending a certificate.

WARNING:root:Got ConnectionError [HTTPSConnectionPool(host='jirahostname.co.uk', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:833)'),))] errno:None on GET https://jirahostname.co.uk/rest/api/2/serverInfo
{'response': None, 'request': <PreparedRequest [GET]>}\{'response': None, 'request': <PreparedRequest [GET]>}

@hdost
Copy link
Member

hdost commented May 8, 2018

This may be something we need to fix https://stackoverflow.com/a/18579484/1966876

@el-pablo
Copy link
Author

el-pablo commented May 8, 2018

I went down that little rabbit hole, but in the end adding the line:

self._session.cert = self._options['client_cert']

in the client.py init function seems to fix it just fine...

@el-pablo
Copy link
Author

el-pablo commented May 8, 2018

I can send a pull request if it helps?

@hdost
Copy link
Member

hdost commented May 8, 2018 via email

el-pablo pushed a commit to el-pablo/jira that referenced this issue May 8, 2018
The certificate was not being passed through to ResilientSession. This change makes sure that it's always passed through, no matter which options are given. If the client_cert option is not given, then it will be set to None, which is the same effect as it not being passed.
@j5awry
Copy link

j5awry commented Aug 12, 2019

would this also fix:

#311

@fdcds
Copy link

fdcds commented Sep 5, 2019

Duplicate of #637 and #311?

@stale
Copy link

stale bot commented Dec 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You way want to consider using the Sponsor button in order to persuade someone to address it.

@stale stale bot added the stale Ticket that is likely to go nowhere and that will be closed soon label Dec 4, 2019
@stale stale bot closed this as completed Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted stale Ticket that is likely to go nowhere and that will be closed soon
Projects
None yet
Development

No branches or pull requests

4 participants