Jira Cloud Setup in 2023 - Help getting setup with 4.3.2 via atlassian webhooks

Started by grae, April 18, 2023, 01:44:42 AM

Previous topic - Next topic

grae

I've been trying to set up hdlink.jira and have followed what limited information is available.  I'm running the latest version 4.3.2 and found in the release notes of 4.1 that Jira Cloud is supposed to be supported. 

I've added a Webhook in Jira Cloud by going to System Settings, Webhook, creating a webhook named netxms with the URL pointing back to the 
https://netxmsserver.mydomain.com:8008/jira-webhook 
It's been given Issue, Comment, Attachment, create, updated, and deleted permissions.

However there is no way to set up authentication in Jira Cloud for webhooks, I tried creating and adding in an API key and using either netxms or my Jira [email protected] but that also failed.

Port 8008 is open to the internet 

Here are the settings I have in NetXms
 
NameValue
Jira.IssueTypeTask
Jira.Loginnetxms
Jira.Password
Jira.ProjectCodeMYPROJECT
Jira.ProjectComponent
Jira.ResolvedStatusDone
Jira.ServerURLhttps://mydomain.atlassian.net
Jira.Webhook.Path/jira-webhook
Jira.Webhook.Port8008


When running the server in Debug mode 6 I can see the following errors, 

16:24:19.419
generic
2023.04.17 21:23:43.742 *D* [hdlink.jira        ] MicroHTTPD: MHD_OPTION_EXTERNAL_LOGGER is not the first option specified for the daemon. Some messages may be printed by the standard MHD logger.
16:24:19.419
generic
2023.04.17 21:23:43.744 *I* [hdlink.jira        ] Jira webhook initialized on port 8008
16:25:35.655
generic
2023.04.17 21:25:35.607 *D* [hdlink.jira        ] Jira login failed, HTTP response code 401
16:26:14.748
generic
2023.04.17 21:26:08.165 *D* [hdlink.jira        ] Jira connection check: HTTP response code is 401
16:26:14.757
generic
2023.04.17 21:26:08.458 *D* [hdlink.jira        ] Jira login failed, HTTP response code 401
16:26:14.757
generic
2023.04.17 21:26:08.458 *D* [hdlink.jira        ] Jira login failed, HTTP response code 401
16:29:43.053
generic
2023.04.17 21:29:42.339 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.
16:29:43.110
generic
2023.04.17 21:29:42.786 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.
16:29:43.120
generic
2023.04.17 21:29:42.985 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.
16:29:44.168
generic
2023.04.17 21:29:43.405 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.
16:30:13.402
generic
2023.04.17 21:30:12.427 *D* [hdlink.jira        ] Jira connection check: HTTP response code is 401
16:30:13.412
generic
2023.04.17 21:30:12.698 *D* [hdlink.jira        ] Jira login failed, HTTP response code 401
16:36:49.659
generic
2023.04.17 21:36:49.140 *D* [hdlink.jira        ] Jira webhook request: GET /
16:36:49.659
generic
2023.04.17 21:36:49.141 *D* [hdlink.jira        ] Response code 404 to webhook call
16:38:42.772
generic
2023.04.17 21:38:42.046 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.
16:42:25.116
generic
2023.04.17 21:42:24.418 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.
16:43:08.578
generic
2023.04.17 21:43:08.464 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.
16:43:35.507
generic
2023.04.17 21:43:34.859 *D* [hdlink.jira        ] MicroHTTPD: Error processing request (HTTP response code is 400 ('<html><head><title>Request malformed</title></head><body>Your HTTP request was syntactically incorrect.</body></html>')). Closing connection.

If I run the server with Debug level 7 I get a little bit more information
2023.04.17 22:24:55.996 *D* [hdlink.jira        ] Jira webhook request: GET /jira-webhook
17:24:57.968
generic
2023.04.17 22:24:57.334 *D* [hdlink.jira        ]    Host: localhost:8008
17:24:57.968
generic
2023.04.17 22:24:57.334 *D* [hdlink.jira        ]    Connection: keep-alive
17:24:57.968
generic
2023.04.17 22:24:57.334 *D* [hdlink.jira        ]    sec-ch-ua: "Chromium";v="112", "Microsoft Edge";v="112", "Not:A-Brand";v="99"
17:24:57.968
generic
2023.04.17 22:24:57.335 *D* [hdlink.jira        ]    sec-ch-ua-mobile: ?0
17:24:57.968
generic
2023.04.17 22:24:57.336 *D* [hdlink.jira        ]    sec-ch-ua-platform: "Windows"
17:24:57.968
generic
2023.04.17 22:24:57.336 *D* [hdlink.jira        ]    DNT: 1
17:24:57.968
generic
2023.04.17 22:24:57.336 *D* [hdlink.jira        ]    Upgrade-Insecure-Requests: 1
17:24:57.969
generic
2023.04.17 22:24:57.336 *D* [hdlink.jira        ]    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.48
17:24:57.970
generic
2023.04.17 22:24:57.382 *D* [hdlink.jira        ]    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
17:24:57.970
generic
2023.04.17 22:24:57.385 *D* [hdlink.jira        ]    Sec-Fetch-Site: none
17:24:57.972
generic
2023.04.17 22:24:57.386 *D* [hdlink.jira        ]    Sec-Fetch-Mode: navigate
17:24:57.972
generic
2023.04.17 22:24:57.386 *D* [hdlink.jira        ]    Sec-Fetch-User: ?1
17:24:57.972
generic
2023.04.17 22:24:57.386 *D* [hdlink.jira        ]    Sec-Fetch-Dest: document
17:24:57.972
generic
2023.04.17 22:24:57.387 *D* [hdlink.jira        ]    Accept-Encoding: gzip, deflate, br
17:24:57.972
generic
2023.04.17 22:24:57.388 *D* [hdlink.jira        ]    Accept-Language: en-US,en;q=0.9
17:24:57.972
generic
2023.04.17 22:24:57.388 *D* [hdlink.jira        ] Response code 405 to webhook call
17:28:04.000
generic
2023.04.17 22:28:03.009 *D* [hdlink.jira        ] MicroHTTPD: MHD_OPTION_EXTERNAL_LOGGER is not the first option specified for the daemon. Some messages may be printed by the standard MHD logger.
17:28:04.000
generic
2023.04.17 22:28:03.014 *I* [hdlink.jira        ] Jira webhook initialized on port 8008

Any assistance would be greatly appreciated.  Thank you

grae

So after much research and digging I have found the problem.  
NetXMS makes requests to the following Jira Cloud Endpoints - 
https://yourdomain.atlassian.net
         /rest/auth/1/session
         /rest/api/2/myself

I was able to pull the Jira Cloud APIs into Postman and /auth/1 no longer was listed, (api/2 has also been replaced by 3.)  Apparently session is for a session cookie and Jira Deprecated this start back in 2019. So Atlassian has disabled this method and needs to be replaced by API Token (which is what I had tried before, I even tried encoding my username and password as BASE64 per the Jira docs)


Which APIs and methods will be restricted?
For the following APIs and pages, all requests using basic authentication with a non-API token credential will return 401 ( Unauthorized) after the deprecation period:
  • Jira Cloud public REST API
  • Jira Software public REST API
  • Jira Service Desk public REST API
  • All Jira Cloud web pages
The following Jira Cloud REST API endpoint will be removed:



Deprecation notice - Basic authentication with passwords and cookie-based authentication (atlassian.com)

Cookie-based auth for REST APIs (atlassian.com)


 


Hopefully, this can get on the patch list to swap those calls as it is now a broken feature.  Please let me know if there's anything I can do to help, I've spent considerable time troubleshooting this and logged all the info if needed.

Victor Kirhenshtein

Hi,

I will take a look at it in the next few days. Will you be able to run test build to verify changes to Jira connector?

Best regards,
Victor


grae

Victor,
Thank you, yes we would be happy to run the test build. @graeChris just updated us to 4.3.5 so that's our current version.

Thank you

grae

Just checking back on this if there has been any update or if you are ready for us to try a test build?


Thank you!

grae

We're still awaiting if this is on the plan for 2024 at least?

Thank you!

Victor Kirhenshtein

Finally get to check this - works fine for me (using API token). Maybe the problem was in using password instead of API token.

I changed /rest/auth/1/session to /rest/api/2/myself for checking connection for the future though, as former URL supposed to be removed in the future.

Best regards,
Victor