ssax wrote:In order to use the depracated backend API, you need to go to Admin > System Settings > Backwards Compatibility tab and turn on "Allow Insecure Logins" and click the Update Settings button.
Then you will need to login (or masquerade as the user you want to allow it from) and click their username in the top right corner, then select "Enable Insecure Login" and click the Update Settings button.
That should do it.
Capture1.JPG
Now Backend API works from browser but not from command line. Both API key and Insecure ticket works using the backend api from web browser. However when using curl I still getting the same error. Running on the same server ssh session also same issue.
The new API command below works fine from command line though.
Code: Select all
curl "http://10.104.18.193/nagiosxi/api/v1/objects/hoststatus?apikey=oqhpGMNfQbG7FU77lLTKiDOEBk7jXX9Gnp5kr8ChieoepOENPtN7mR2dc8P95YOM&pretty=1"
Please advice where else to check on this.
Code: Select all
[nagios@nagiosprodxi1 scripts]$ curl -v "http://10.104.18.193/nagiosxi/backend/?cmd=getstatehistory&search=&reportperiod=last24hours&startdate=&enddate=&hostgroup=&servicegroup=&statetype=both&mode=csv&username=rajasegar&ticket=oqhpGMNfQbG7FU77lLTKiDOEBk7jXX9Gnp5kr8ChieoepOENPtN7mR2dc8P95YOM"
* About to connect() to 10.104.18.193 port 80 (#0)
* Trying 10.104.18.193... connected
* Connected to 10.104.18.193 (10.104.18.193) port 80 (#0)
> GET /nagiosxi/backend/?cmd=getstatehistory&search=&reportperiod=last24hours&startdate=&enddate=&hostgroup=&servicegroup=&statetype=both&mode=csv&username=rajasegar&ticket=oqhpGMNfQbG7FU77lLTKiDOEBk7jXX9Gnp5kr8ChieoepOENPtN7mR2dc8P95YOM HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.104.18.193
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 27 Apr 2020 02:33:51 GMT
< Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips PHP/5.4.16
< X-Powered-By: PHP/5.4.16
< Set-Cookie: nagiosxi=7c8lqnio9bjvh5engh2t2c6tf3; expires=Mon, 27-Apr-2020 03:03:51 GMT; path=/; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: frame-ancestors 'self'
< Access-Control-Allow-Origin: *
< Content-Length: 108
< Content-Type: text/xml
<
<?xml version="1.0" encoding="utf-8"?>
<error>
<errormessage>Authentication Failure</errormessage>
</error>
* Connection #0 to host 10.104.18.193 left intact
* Closing connection #0
Code: Select all
[nagios@nagiosprodxi1 scripts]$ curl -v "http://10.104.18.193/nagiosxi/backend/?cmd=getstatehistory&search=&reportperiod=last24hours&startdate=&enddate=&hostgroup=&servicegroup=&statetype=both&mode=csv&username=rajasegar&ticket=Z50PJXaeufi0HockAVtkKnptYG65sX7ri7A0kJv9YQpVuEf4PLnAoPjGrILXF8IX"
* About to connect() to 10.104.18.193 port 80 (#0)
* Trying 10.104.18.193... connected
* Connected to 10.104.18.193 (10.104.18.193) port 80 (#0)
> GET /nagiosxi/backend/?cmd=getstatehistory&search=&reportperiod=last24hours&startdate=&enddate=&hostgroup=&servicegroup=&statetype=both&mode=csv&username=rajasegar&ticket=Z50PJXaeufi0HockAVtkKnptYG65sX7ri7A0kJv9YQpVuEf4PLnAoPjGrILXF8IX HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.104.18.193
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 27 Apr 2020 02:36:05 GMT
< Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips PHP/5.4.16
< X-Powered-By: PHP/5.4.16
< Set-Cookie: nagiosxi=s3okqa0rjv90516nep55fkq1g7; expires=Mon, 27-Apr-2020 03:06:06 GMT; path=/; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: frame-ancestors 'self'
< Access-Control-Allow-Origin: *
< Content-Length: 108
< Content-Type: text/xml
<
<?xml version="1.0" encoding="utf-8"?>
<error>
<errormessage>Authentication Failure</errormessage>
</error>
* Connection #0 to host 10.104.18.193 left intact
* Closing connection #0
You do not have the required permissions to view the files attached to this post.