Page 1 of 2

Nagios 5.5: This rapid response URL has expired

Posted: Thu Jul 05, 2018 11:59 pm
by duhd
After upgrade to 5.5, I have this error when click to a rapid response URL in email alert:

Code: Select all

SQL Error [nagiosxi] : ERROR:  function unix_timestamp(timestamp without time zone) does not exist
LINE 1: SELECT *, UNIX_TIMESTAMP(auth_valid_until) as valid_until_ts...
                  ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
And

Code: Select all

Rapid Response
Error: This rapid response URL has alread been used.
You must login to view this object.

Re: Nagios 5.5: This rapid response URL has expired

Posted: Fri Jul 06, 2018 11:00 am
by lmiltchev
What was the Nagios XI version that you upgraded from? OS/distro/architecture? Was this rapid response URL already used? Do you see errors when you click on a new rapid response link?

Run the following command from the CLI and show the output:

Code: Select all

grep response /usr/local/nagiosxi/html/config.inc.php
Also, go to Admin > System Settings > Security, and show a screenshot of this page. Thank you!

Re: Nagios 5.5: This rapid response URL has expired

Posted: Sun Jul 08, 2018 5:31 am
by duhd
I'm upgrade from 5.4.13

Code: Select all

[root@nagios ~]# grep response /usr/local/nagiosxi/html/config.inc.php
// Secure notification %responseurl%
// setting this to 1 will force users to login in the response URL
// $cfg['secure_response_url']=1;
lmiltchev wrote:What was the Nagios XI version that you upgraded from? OS/distro/architecture? Was this rapid response URL already used? Do you see errors when you click on a new rapid response link?

Run the following command from the CLI and show the output:

Code: Select all

grep response /usr/local/nagiosxi/html/config.inc.php

Also, go to Admin > System Settings > Security, and show a screenshot of this page. Thank you!

Re: Nagios 5.5: This rapid response URL has expired

Posted: Mon Jul 09, 2018 4:21 pm
by lmiltchev
The issue will be fixed in the Nagios XI 5.5.1. Meanwhile, if you need an immediate "workaround", you can try the following:

1. Make a backup of your original "/usr/local/nagiosxi/html/includes/utils-users.inc.php" file.

Code: Select all

cp -p /usr/local/nagiosxi/html/includes/utils-users.inc.php /usr/local/nagiosxi/html/includes/utils-users.inc.php.original
2. Download the zip file below:
utils-users.inc.php.zip
unzip it, and copy the new "utils-users.inc.php" file over to the "/usr/local/nagiosxi/html/includes/" directory, overwriting the original "utils-users.inc.php" file.

3. Test the RR URL functionality to see if the issue has been resolved.

Re: Nagios 5.5: This rapid response URL has expired

Posted: Mon Jul 09, 2018 9:20 pm
by duhd
Thanks lmiltchev,

I'm cp that file and test again, received message with any new RR URL:

Code: Select all

Rapid Response
Error: This rapid response URL has alread been used.
You must login to view this object.

Why am I getting this error?
Verify the rapid response URL is the exact same as in the notifiction. Possible reasons for error include:
The single use URL has already been used
The URL has expired
Invalid or no auth token given in URL
lmiltchev wrote:The issue will be fixed in the Nagios XI 5.5.1. Meanwhile, if you need an immediate "workaround", you can try the following:

1. Make a backup of your original "/usr/local/nagiosxi/html/includes/utils-users.inc.php" file.

Code: Select all

cp -p /usr/local/nagiosxi/html/includes/utils-users.inc.php /usr/local/nagiosxi/html/includes/utils-users.inc.php.original
2. Download the zip file below:
utils-users.inc.php.zip
unzip it, and copy the new "utils-users.inc.php" file over to the "/usr/local/nagiosxi/html/includes/" directory, overwriting the original "utils-users.inc.php" file.

3. Test the RR URL functionality to see if the issue has been resolved.

Re: Nagios 5.5: This rapid response URL has expired

Posted: Tue Jul 10, 2018 1:32 pm
by lmiltchev
Go to Admin > System Settings > Security, and show a screenshot of this page.

Also run the following commands and show the output:

Code: Select all

ls -la /usr/local/nagiosxi/html/includes/utils-users*

Code: Select all

sed -n 1894,1908p /usr/local/nagiosxi/html/includes/utils-users.inc.php

Re: Nagios 5.5: This rapid response URL has expired

Posted: Wed Jul 11, 2018 1:15 am
by duhd
Go to Admin > System Settings > Security, and show a screenshot of this page.
nagios.PNG
Also run the following commands and show the output:
ls -la /usr/local/nagiosxi/html/includes/utils-users*

Code: Select all

[root@nagios ~]# ls -la /usr/local/nagiosxi/html/includes/utils-users*
-rw-r----- 1 nagios nagios 68564 Jul 10 09:16 /usr/local/nagiosxi/html/includes/utils-users.inc.php
sed -n 1894,1908p /usr/local/nagiosxi/html/includes/utils-users.inc.php

Code: Select all

[root@nagios ~]# sed -n 1894,1908p /usr/local/nagiosxi/html/includes/utils-users.inc.php
    global $db_tables;

    $sql = "SELECT * FROM ".$db_tables[DB_NAGIOSXI]['auth_tokens']." WHERE auth_token = ".escape_sql_param($auth_token, DB_NAGIOSXI, true);
    if (!($rs = exec_sql_query(DB_NAGIOSXI, $sql))) {
        return false;
    }

    $arr = $rs->GetArray();
    if (!empty($arr)) {
        $arr = $arr[0];

        // Convert valid until to timestamp
        $arr['valid_until_ts'] = strtotime($arr['auth_valid_until']);
        return $arr;
    }

Re: Nagios 5.5: This rapid response URL has expired

Posted: Wed Jul 11, 2018 3:31 am
by Cpt.Ackbar
I tested it and it seems OK for me for pdf.

@duhd
Do not forget to set up proper privileges.

Code: Select all

chmod 750 /usr/local/nagiosxi/html/includes/utils-users.inc.php
chown nagios:nagios /usr/local/nagiosxi/html/includes/utils-users.inc.php
Verification: both files have to have same privileges and ownership

Code: Select all

[root@nagios ~]# ll /usr/local/nagiosxi/html/includes/ | grep utils-users.inc
-rwxr-x---   1 nagios nagios  68564 Jul  6 23:50 utils-users.inc.php
-rwxr-x---   1 nagios nagios  68480 Jun 29 12:10 utils-users.inc.php.original

Re: Nagios 5.5: This rapid response URL has expired

Posted: Wed Jul 11, 2018 4:36 pm
by scottwilkerson
Is the response URL from a new email? Or an older one?

Re: Nagios 5.5: This rapid response URL has expired

Posted: Wed Jul 11, 2018 9:21 pm
by duhd
That is URL from new email.
scottwilkerson wrote:Is the response URL from a new email? Or an older one?