I am using JiraClient.py
see:
When I first ran it, after generating a JIRA API Token, it worked fine. However, now I am getting an error like this:
I even tried generating a brand new token, and it doesn't work with that either.
Any ideas?
Thanks,
Larry
Hi @Larry Weisberg ,
If I understand correctly you are trying to call a Jira Cloud REST API endpoint using jira_client.py and this is now returning an SSL error, while it was working fine before.
If this is correct, can you please check the following:
curl -u <EMAIL-ADDRESS>:<API-TOKEN> -D- -X GET "http://<NAME>.atlassian.net/rest/api/3/worklog/updated?since=<TIMESTAMP>"
Cheers,Dario
The SSL certificate your call is presenting to the server is not valid. You will need to change to a valid certificate.
Thanks Nic!
I am using JiraClient from https://gist.github.com/dblanchette/b8ed8cf42431f56024c1c70ed5137e0f and basically my code does this:
client = JiraClient("larry.weisberg@pragroup.com", "XYXYXYX") # Token value recent_worklogs = client.retrieve_worklogs_updated_since(datetime.now() - timedelta(days=14))
JiraClient constructor does this:
class JiraClient:def __init__( self, username: str = None, api_token: str = None, access_token: str = None, access_token_secret: str = None, consumer_key: str = None, key_cert: str = None,):self._user_url = os.getenv("JIRA_SERVER", "").rstrip("/")self._base_url = f"{self._user_url}/rest/api/3"if username and api_token: self._session = requests.Session() self._session.auth = (username, api_token) return
And retrieve worklogs :
response = self._session.get(url)
This is where failure occurs, where URL is just a REST api that does work from Browser; Also it used to work from this script.
Basically - where is the ssl Cert created, used in the code? Why/How would it have changed?
Thanks @Dario B
self._session.get(url) ...
https://company.atlassian.net/rest/api/3/worklog/updated?since=1601798047737
then it works fine; but doing curl:
curl -u my.email.address@company.com:TOKEN_XYXYXYXYX -D- -X GET "https://company.atlassian.net/rest/api/3/worklog/updated?since=1601798047737"
fails with:
curl: (60) SSL certificate problem: self signed certificate in certificate chainMore details here: https://curl.haxx.se/docs/sslcerts.htmlcurl failed to verify the legitimacy of the server and therefore could notestablish a secure connection to it. To learn more about this situation andhow to fix it, please visit the web page mentioned above.
I guess not so surprising that curl behaves same way that Python does; what is most surprising is that when I ran it the first few times, I did not get errors..
Hi @Larry Weisberg,
This is super weird and a bit concerning at the same time, since we don't have any self-signed certificate in the certificate chain for Atlassian Cloud products.
You can double check this by using the SSLShopper Certificate Checker or any other tool to check certificates:
openssl s_client -showcerts -servername XXXXXX.atlassian.net -connect XXXXX.atlassian.net:443CONNECTED(00000003)depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert High Assurance EV Root CAverify return:1depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 High Assurance Server CAverify return:1depth=0 C = US, ST = California, L = San Francisco, O = "Atlassian Network Services, Inc.", CN = *.atlassian.netverify return:1---Certificate chain0 s:C = US, ST = California, L = San Francisco, O = "Atlassian Network Services, Inc.", CN = *.atlassian.neti:C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 High Assurance Server CA......
Now, if this error is only happening from the command line but not from the browser, there are chances your OS is using some old/outdated CA store (maybe an old version of openssl was installed recently).
In order to doble-check this, please do the following:
For further details, you might want to see below links:
Thanks @Dario B - that sounds promising... Might not get to it till next week but I'll take a look, (assuming instructions on the links are clear enough :-), or maybe my IT guy can help out).
Thanks!Larry
@Dario B @Nic Brough -Adaptavist- Hi Nic and Dario,
I'm having some issues with accessing JIRA Cloud using my python script. I am using the bearer token authentication method. Previously, it also showed a 401 authentication error because of the SSL certification. Was wondering if you could help me with this. Thank you.
Hi @Ian Jia Ern Khoo ,
Please notice that adding an unrelated reply a thread from 2 years ago that is marked as resolved (answer accepted) is not the best way to get help.
However, in short:
Finally, if nothing helps, I strongly advise to create a new thread providing more details on what you are doing together with the error message as well as the same request sent using Curl (removing the sensitive data like email address and api token).
It looks like you're new here. Sign in or register to get started.