jenkinsci / office-365-connector-plugin

Office 365 Connector plugin sends jobs status notifications to Microsoft Teams or Outlook
https://plugins.jenkins.io/Office-365-Connector/
Apache License 2.0
89 stars 84 forks source link

Failed to post data to webhook: hostname in certificate didn't match #247

Open cprato79 opened 3 years ago

cprato79 commented 3 years ago

Version report

Jenkins and plugins versions report:

    Jenkins: 2.254
    Plugin: 4.14.0
    jdk: 8

Reproduction steps

Results

Expected result: a notify on Microsoft Teams side

Actual result:

[Office365connector] Failed to post data to webhook - https://dedalusspa.webhook.office.com/webhookb2/cd5d0f2b-c3a0-404d-91de-5ef4abeba9bd@9ffff5c3-bdfa-4a9d-b595-ff68329945ef/JenkinsCI/f7660493bed54d349e6dc6bb51bfae9a/fb16f452-f0f9-4f4c-89b0-88913bdef5d8
javax.net.ssl.SSLException: hostname in certificate didn't match: <dedalusspa.webhook.office.com> != </*.internal.outlook.com/*.outlook.com/outlook.com/office365.com/*.office365.com/*.outlook.office365.com/*.office.com/outlook.office.com/substrate.office.com/attachment.outlook.live.net/attachment.outlook.office.net/attachment.outlook.officeppe.net/attachments.office.net/*.clo.footprintdns.com/*.nrb.footprintdns.com/ccs.login.microsoftonline.com/ccs-sdf.login.microsoftonline.com/substrate-sdf.office.com/attachments-sdf.office.net/*.live.com/mail.services.live.com/hotmail.com/*.hotmail.com/outlook.com>

Test

running by curl it gets the notification as well:

sh("curl -k -X POST -H 'Content-type:application/json' --data '{\"text\":\"Message sent by jenkins\"}' ${WEB_HOOK_URL}")

where the variable: WEB_HOOK_URL is replaced by the full URL got by Microsoft Teams Connector

cprato79 commented 3 years ago

I found the following: link

The webook url has changed !

jishwin13 commented 3 years ago

Is it working now for you? i have a web-hook URL which was created recently and includes the tenant's name as mentioned in the link you posted above but office 365 connector still fails to send notification with this error as well. Any updates?

cprato79 commented 3 years ago

The notification has begun to works only after i restored the previous url as microsoft teams had generated it.

This is a temporary workaround working until Microsoft will not disable this behavior definitively!

sostrich commented 3 years ago

The fix outlined in https://github.com/jenkinsci/office-365-connector-plugin/issues/240#issuecomment-796637120 worked, we upgraded from Oracle Java 8 to OpenJdk 11 as described here https://stackoverflow.com/a/55244659, and our new connector started working.

cprato79 commented 3 years ago

The fix outlined in #240 (comment) worked, we upgraded from Oracle Java 8 to OpenJdk 11 as described here https://stackoverflow.com/a/55244659, and our new connector started working.

Thank you ! I will try.

jishwin13 commented 3 years ago

My issue was actually a table-to-divs migration issue after an update to Jenkins 2.277.1. Some of the plugins were causing the configure UI to be broken. Once these plugins were disabled, the notifications started getting posted using incoming webhooks and office 365 connector plugin.