- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2023 05:53 AM
Hi all,
We are trying to call ServiceNow via Rest Api to open an incident using the ip address (149.96.6.118, and not the hostname of the instance).
curl -v --location 'https://149.96.6.118/api/now/table/incident' \
--header 'Content-Type: application/json' \
--user 'user':'password' \
--header 'Host: devXXXXX.service-now.com' \
--data '{ "active":"true","category":"job error","short_description":"job error""urgency":"6","impact":"8"}' \
--cert _.service-now.crt
The output of the curl is a problem related to the ServiceNow certificates:
curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate
How could we solve this problem between the hostname (associated to the certificates) and the ip used for the rest call?
Thanks for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 10:45 PM
Hi @ceciliabaglion ,
The error message indicates that the hostname used in the Host header of the request does not match the hostname in the server's SSL/TLS certificate. This is a security measure to prevent man-in-the-middle attacks.
To solve this issue, you need to use the hostname associated with the SSL/TLS certificate in the Host header of your request. You cannot use an IP address in the Host header.
One possible solution is to add an entry to the /etc/hosts file on the machine where you are running the curl command to map the IP address to the hostname associated with the SSL/TLS certificate. For example:
149.96.6.118 devXXXXX.service-now.com
Once you have added this entry to your /etc/hosts file, you can modify your curl command to use the hostname in the Host header, like this:
curl -v --location 'https://devXXXXX.service-now.com/api/now/table/incident' \
--header 'Content-Type: application/json' \
--user 'user':'password' \
--header 'Host: devXXXXX.service-now.com' \
--data '{ "active":"true","category":"job error","short_description":"job error""urgency":"6","impact":"8"}' \
--cert _.service-now.crt
If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the ✅Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.
Thank you!
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 10:45 PM
Hi @ceciliabaglion ,
The error message indicates that the hostname used in the Host header of the request does not match the hostname in the server's SSL/TLS certificate. This is a security measure to prevent man-in-the-middle attacks.
To solve this issue, you need to use the hostname associated with the SSL/TLS certificate in the Host header of your request. You cannot use an IP address in the Host header.
One possible solution is to add an entry to the /etc/hosts file on the machine where you are running the curl command to map the IP address to the hostname associated with the SSL/TLS certificate. For example:
149.96.6.118 devXXXXX.service-now.com
Once you have added this entry to your /etc/hosts file, you can modify your curl command to use the hostname in the Host header, like this:
curl -v --location 'https://devXXXXX.service-now.com/api/now/table/incident' \
--header 'Content-Type: application/json' \
--user 'user':'password' \
--header 'Host: devXXXXX.service-now.com' \
--data '{ "active":"true","category":"job error","short_description":"job error""urgency":"6","impact":"8"}' \
--cert _.service-now.crt
If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the ✅Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.
Thank you!
Ratnakar