Page 1 of 2

ERROR: The NRDP Server said NO TOKENS

Posted: Wed Jun 16, 2021 9:45 am
by optionstechnology
I am setting up an NRDP forwarder between two nagios servers, however, nothing is showing up in Unconfigured Objects.

I have tested locally on the box using:

Code: Select all

/usr/local/nrdp/clients/send_nrdp.sh -u https://127.0.0.1/nrdp -t MYTOKEN -H "testfromlocal" -S 0 -o "This is test 1"
This works - I can see "testfromlocal" show up in the unconfigured objects


When I try from the remote server using:

Code: Select all

 /usr/local/nrdp/clients/send_nrdp.sh -u https://OTHERSERVERIP/nrdp -t MYTOKEN -H "testfromremote" -S 0 -o "This is test 1"
I get:

ERROR: The NRDP Server said NO TOKENS

This is a very strange error..... because if it was an incorrect token it would say BAD TOKEN, and if I didn't supply a token as it is suggesting then it would fail locally and not even execute.

So it seems like it has the TOKEN when it first runs the script locally, but by the time it gets to the remote side the token is gone....

Any idea what could be causing this?

I can telnet on port 443 fine, no issues there

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Thu Jun 17, 2021 10:53 am
by dchurch
If your token contains shell meta-characters such as $ [ ] ( ) { } | ` ~ & # * ! ' " \ < > ?, try enclosing it in quotes:

Code: Select all

    /usr/local/nrdp/clients/send_nrdp.sh -u https://127.0.0.1/nrdp -t 'MYTOKEN' -H "testfromlocal" -S 0 -o "This is test 1"
If it contains a single-quote, you'll want to replace it with '\'' (four characters), e.g. foo's bar => 'foo'\''s bar'.

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Fri Jun 18, 2021 4:32 am
by optionstechnology
It has no special characters in it

I've also tried double quotes around it but no luck

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Fri Jun 18, 2021 3:26 pm
by dchurch
Try editing /usr/local/nrdp/server/config.inc.php and adding array entries to the $cfg['authorized_tokens'] array.

For example:

Code: Select all

$cfg['authorized_tokens'] = array("Token_here", "another_token_here", "yet_another_token");

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Mon Jun 21, 2021 3:04 am
by optionstechnology
Its accepting the token, I know this because it accepts the token when i run it locally

the issue is that the token does not even get passed

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Mon Jun 21, 2021 3:27 pm
by dchurch
Can you please modify /usr/local/nrdp/server/config.inc.php on the NRPE machine and change

Code: Select all

$cfg["debug"] = false;
to

Code: Select all

$cfg["debug"] = true;
Then please run this command from the remote server (i.e. the one not running nrpe) and give back the result?

Code: Select all

curl -f --silent --insecure -d "token=MYTOKEN&cmd=submitcheck&xml=<?xml version='1.0'?><checkresults><checkresult type='host' checktype='1'><hostname>testfromremote</hostname><state>0</state><output><![CDATA[This is test 1]]></output></checkresult></checkresults>" 'https://OTHERSERVERIP/nrdp/'
(of course replacing OTHERSERVERIP and MYTOKEN)

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Thu Jun 24, 2021 8:15 am
by optionstechnology
This is the reply I get-

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<result>
    <status>-1</status>
    <message>NO TOKENS</message>
</result>

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Thu Jun 24, 2021 9:36 am
by dchurch
What is the output from the following command?

Code: Select all

grep -rF "\$cfg['authorized_tokens']" /usr/local

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Fri Jun 25, 2021 10:00 am
by optionstechnology

Code: Select all

/usr/local/nrdp/server/includes/utils.inc.php:        _debug(" * token ($user_token) not in \$cfg['authorized_tokens'], denying token");
/usr/local/nrdp/server/config.inc.php:$cfg['authorized_tokens'] = array("MYTOKEN",);
/usr/local/nagiosxi/html/includes/components/nrdsconfigmanager/nrdsconfigmanager.php:    if (!isset($cfg['authorized_tokens'][0])) {
/usr/local/nagiosxi/html/includes/components/nrdsconfigmanager/nrdsconfigmanager.php:    if (!isset($cfg['authorized_tokens'][0])) {
/usr/local/nagiosxi/html/includes/components/nrdsconfigmanager/nrdsconfigmanager.php:                        foreach ($cfg['authorized_tokens'] as $token) {
/usr/local/nagiosxi/html/admin/dtinbound.php:    $replace = "\\\$cfg['authorized_tokens'] = $token_str";

Re: ERROR: The NRDP Server said NO TOKENS

Posted: Fri Jun 25, 2021 2:44 pm
by gsmith
Hi,

Please provide us with this file: /usr/local/nrdp/server/config.inc.php

Thanks