NagiosXi Not working after Upgrading PHP (Offline)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
ncrvision
Posts: 13
Joined: Tue Jul 23, 2019 9:55 am

NagiosXi Not working after Upgrading PHP (Offline)

Post by ncrvision »

Hi,

We tried to upgrade PHP from 5.4.16 to 7.4.19 using offline Tarball, as we got a Warning for Security Vulnerability (shown below) in using the Older version.

" Vulnerable version of component PHP found -- PHP 5.4.16","* Upgrade to PHP version "

The PHP is getting upgraded successfully, but once we restart after the upgrade,Nagios is not working.

Below is the Error that we are getting, once we restart Nagios after upgrading PHP:

PHP Script is '/usr/local/nagiosxi/html/Includes/dbl.inc.php' is protected y SourceGuardian requires a SourceGuardian loader 'ixed.7.4.lin' to be installed.

1) Click here to download the required 'ixed.7.4.lin' loader from the SourceGuardian site
2) Install the loader to /usr/lib64/php/modules
3)Edit /etc/php.ini and add 'extension=ixed.7.4.lin' directive
4)Restart the web server


We followed the steps that were mentioned on the Forum for Nagios Offline Upgrade (https://support.nagios.com/kb/article/n ... 7-860.html) but still no luck.

Here's our system Information:

Linux Distribution -- Centos-release-7-8.2003.0.el7.centos.x86_64
32 or 64bit ? -- 64bit
VMware Image or Manual Install of XI? -- Manual Installation

Kindly assist regarding this.
Regards,
Vision
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by vtrac »

Hi,
How are you doing?
Please run and update outputs of the below two commands:

Code: Select all

ls -la /etc/yum.repos.d/

rpm -qa | grep "^php"
Please also run and update outputs to this post:

Code: Select all

/usr/lib64/php/modules/ixed*
Lastly, please run and update outputs to this post as well:

Code: Select all

cat /etc/php.d/sourceguardian.ini
Best Regards,
Vinh
ncrvision
Posts: 13
Joined: Tue Jul 23, 2019 9:55 am

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by ncrvision »

Hi Vinh,

Here's the Output for the commands that you've posted. (Before Upgrading PHP)

Command: ls -la /etc/yum.repos.d/
Output:
[root@localhost nagiosxi]# ls -la /etc/yum.repos.d/
total 48
drwxr-xr-x. 2 root root 220 Apr 2 2020 .
drwxr-xr-x. 145 root root 8192 Jun 2 15:13 ..
-rw-r--r--. 1 root root 1664 Apr 7 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Apr 7 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Apr 7 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Apr 7 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Apr 7 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Apr 7 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 7577 Apr 7 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 Apr 7 2020 CentOS-x86_64-kernel.repo


Command: rpm -qa | grep "^php"
Output:
[root@localhost nagiosxi]# rpm -qa | grep "^php"
php-pear-1.9.4-22.el7.noarch
php-mssql-5.4.16-7.el7.x86_64
php-pgsql-5.4.16-48.el7.x86_64
php-pdo-5.4.16-48.el7.x86_64
php-mbstring-5.4.16-48.el7.x86_64
php-gd-5.4.16-48.el7.x86_64
php-mysql-5.4.16-48.el7.x86_64
php-imap-5.4.16-7.el7.x86_64
php-xml-5.4.16-48.el7.x86_64
php-pecl-ssh2-0.12-1.el7.x86_64
php-devel-5.4.16-48.el7.x86_64
php-snmp-5.4.16-48.el7.x86_64
php-cli-5.4.16-48.el7.x86_64
php-process-5.4.16-48.el7.x86_64
php-pear-HTML-Template-IT-1.3.0-2.el5.noarch
php-5.4.16-48.el7.x86_64
php-common-5.4.16-48.el7.x86_64
php-mcrypt-5.4.16-7.el7.x86_64
php-ldap-5.4.16-48.el7.x86_64

Command: /usr/lib64/php/modules/ixed*
Output:
[root@localhost nagiosxi]# sudo /usr/lib64/php/modules/ixed*
sudo: /usr/lib64/php/modules/ixed.5.4.lin: command not found

Command: cat /etc/php.d/sourceguardian.ini
Output:
[root@localhost nagiosxi]# cat /etc/php.d/sourceguardian.ini
extension=ixed.5.4.lin


This is the Output that we get before upgrading PHP.

Once we update PHP and execute the same commands, we get the below output.

Command: ls -la /etc/yum.repos.d/
Output:
[vinay@localhost ~]$ ls -la /etc/yum.repos.d
total 116
drwxr-xr-x. 2 root root 4096 May 25 16:19 .
drwxr-xr-x. 146 root root 8192 Jun 9 16:09 ..
-rw-r--r--. 1 root root 1664 Apr 8 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Apr 8 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Apr 8 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Apr 8 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Apr 8 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Apr 8 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 7577 Apr 8 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 Apr 8 2020 CentOS-x86_64-kernel.repo
-rw-r--r--. 1 root root 951 Oct 2 2017 epel.repo
-rw-r--r--. 1 root root 1050 Oct 2 2017 epel-testing.repo
-rw-r--r--. 1 root root 446 Jan 4 21:44 remi-glpi91.repo
-rw-r--r--. 1 root root 446 Jan 4 21:44 remi-glpi92.repo
-rw-r--r--. 1 root root 446 Jan 4 21:44 remi-glpi93.repo
-rw-r--r--. 1 root root 446 Jan 4 21:44 remi-glpi94.repo
-rw-r--r--. 1 root root 855 Jan 4 21:44 remi-modular.repo
-rw-r--r--. 1 root root 456 Jan 4 21:44 remi-php54.repo
-rw-r--r--. 1 root root 1314 Jan 4 21:44 remi-php70.repo
-rw-r--r--. 1 root root 1314 Jan 4 21:44 remi-php71.repo
-rw-r--r--. 1 root root 1314 Jan 4 21:44 remi-php72.repo
-rw-r--r--. 1 root root 1314 Jan 4 21:44 remi-php73.repo
-rw-r--r--. 1 root root 1314 May 25 16:25 remi-php74.repo
-rw-r--r--. 1 root root 1314 Jan 4 21:44 remi-php80.repo
-rw-r--r--. 1 root root 2605 Jan 4 21:44 remi.repo
-rw-r--r--. 1 root root 750 Jan 4 21:44 remi-safe.repo

Command: rpm -qa | grep "^php"
Output:
[vinay@localhost ~]$ rpm -qa | grep "^php"
php-pdo-7.4.19-1.el7.remi.x86_64
php-mbstring-7.4.19-1.el7.remi.x86_64
php-pgsql-7.4.19-1.el7.remi.x86_64
php-pecl-ssh2-1.3.1-1.el7.remi.7.4.x86_64
php-cli-7.4.19-1.el7.remi.x86_64
php-7.4.19-1.el7.remi.x86_64
php-imap-7.4.19-1.el7.remi.x86_64
php-xml-7.4.19-1.el7.remi.x86_64
php-pear-1.10.12-7.el7.remi.noarch
php-snmp-7.4.19-1.el7.remi.x86_64
php-fedora-autoloader-1.0.1-2.el7.noarch
php-gd-7.4.19-1.el7.remi.x86_64
php-ldap-7.4.19-1.el7.remi.x86_64
php-common-7.4.19-1.el7.remi.x86_64
php-sodium-7.4.19-1.el7.remi.x86_64
php-odbc-7.4.19-1.el7.remi.x86_64
php-mysqlnd-7.4.19-1.el7.remi.x86_64
php-pdo-dblib-7.4.19-1.el7.remi.x86_64
php-json-7.4.19-1.el7.remi.x86_64
php-process-7.4.19-1.el7.remi.x86_64
php-devel-7.4.19-1.el7.remi.x86_64

Command: /usr/lib64/php/modules/ixed*
Output:
[vinay@localhost ~]$ sudo /usr/lib64/php/modules/ixed*
[sudo] password for vinay:
sudo: /usr/lib64/php/modules/ixed.5.4.lin: command not found

Command: cat /etc/php.d/sourceguardian.ini
Output:
[vinay@localhost ~]$ cat /etc/php.d/sourceguardian.ini
extension=ixed.5.4.lin

Kindly let me know if anything is needed further.
Regards,
Vision
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by vtrac »

Hi,
Hope you are doing good!! ... :-)

Please change contents inside the "/etc/php.d/sourceguardian.ini" file
From:

Code: Select all

extension=ixed.5.4.lin
To:

Code: Select all

extension=ixed.7.4.lin
Now, please restart httpd:

Code: Select all

systemctl restart httpd

Best Regards,
Vinh
ncrvision
Posts: 13
Joined: Tue Jul 23, 2019 9:55 am

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by ncrvision »

Hi,

I've modified contents inside the "/etc/php.d/sourceguardian.ini" file ( extension=ixed.5.4.lin to extension=ixed.7.4.lin) but still NO LUCK.

After upgrading, when we restart the httpd service, Nagios shows the following error from UI end:

PHP script '/usr/local/nagiosxi/html/includes/dbl.inc.php' is protected by SourceGuardian and requires a SourceGuardian loader 'ixed.7.4.lin' to be installed.

1) Click here to download the required 'ixed.7.4.lin' loader from the SourceGuardian site
2) Install the loader to /usr/lib64/php/modules
3) Edit /etc/php.ini and add 'extension=ixed.7.4.lin' directive
4) Restart the web server


From terminal, when we check the nagios status, it shows service is not found.

[maniprahalath@localhost ~]$ systemctl status nagios
Unit nagios.service could not be found.


We tried to download the ixed.7.4.lin loader from the sourceguardian site and installed it on the /usr/lib64/php/modules, edited the directive and restarted the server but still the error persists.

Seems, the Offline Tarball, doesnt have ./init.sh and install-sourceguardian-extension.sh.

Kindly assist in resolving it.
Regards,
Vision
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by vtrac »

Hi,
How are you doing?
Interesting, not sure why you can not do "systemctl status nagios.service".

Can you please run the below commands on your XI command prompt and post outputs?

Code: Select all

ls -l /etc/systemd/system/multi-user.target.wants/nagios.service

ls -l /usr/lib/systemd/system/nagios.service
Also, please run this and upload results (outputs):

Code: Select all

ls -l /usr/lib64/php/modules/ixed*

cat /etc/php.d/sourceguardian.ini
Also, please edit "/etc/php.ini" and add the below directive:

Code: Select all

extension=ixed.7.4.lin
Best Regards,
Vinh
ncrvision
Posts: 13
Joined: Tue Jul 23, 2019 9:55 am

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by ncrvision »

Hi,

Below is the output that I've got, on executing the mentioned commands.

ls -l /etc/systemd/system/multi-user.target.wants/nagios.service
Output:
[root@localhost maniprahalath]# ls -l /etc/systemd/system/multi-user.target.wants/nagios.service
lrwxrwxrwx. 1 root root 38 Jun 2 08:29 /etc/systemd/system/multi-user.target.wants/nagios.service -> /usr/lib/systemd/system/nagios.service


ls -l /usr/lib/systemd/system/nagios.service
Output:
[root@localhost maniprahalath]# ls -l /usr/lib/systemd/system/nagios.service
ls: cannot access /usr/lib/systemd/system/nagios.service: No such file or directory


ls -l /usr/lib64/php/modules/ixed*
Output:
[root@localhost maniprahalath]# ls -l /usr/lib64/php/modules/ixed*
-rw-r--r--. 1 root root 114446 Oct 17 2019 /usr/lib64/php/modules/ixed.5.4.lin


cat /etc/php.d/sourceguardian.ini
Output:
[root@localhost maniprahalath]# cat /etc/php.d/sourceguardian.ini
extension=ixed.7.4.lin


I've edited "/etc/php.ini" and added the "extension=ixed.7.4.lin" directive.

Also when I check, systemctl status nagios.service, still am getting nagios.service not found.

[root@localhost etc]# systemctl status nagios.service
Unit nagios.service could not be found.


Kindly let me know what should be done next.
Regards,
Vision
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by vtrac »

Hi,
How are you doing?
Looks like two things we need to fix.

1) You are missing the "/usr/lib/systemd/system/nagios.service" file.

Please create a file called "/usr/lib/systemd/system/nagios.service" with the following contents:

Code: Select all

[Unit]
Description=Nagios Core 4.4.6
Documentation=https://www.nagios.org/documentation
After=network.target local-fs.target mariadb.service

[Service]
Type=forking
ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
ExecStop=/usr/bin/kill -s TERM ${MAINPID}
ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd
ExecReload=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ExecReload=/usr/bin/kill -s HUP ${MAINPID}

[Install]
WantedBy=multi-user.target

2) If you already installed PHP 7.4, then you are missing the "/usr/lib64/php/modules/ixed.7.4.lin" file.
Did you download and install SourceGuardian "ixed.7.4.lin"?
Please run the below command as "root" and post the outputs to this ticket. I want to find where "ixed.7.4.lin" file is located and copy it to "/usr/lib64/php/modules/" folder.

Code: Select all

find /usr -type f -name "ixed.7.4.lin"
Best Regards,
Vinh
ncrvision
Posts: 13
Joined: Tue Jul 23, 2019 9:55 am

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by ncrvision »

Hi,

I've created the nagios.service folder on /usr/lib/systemd/system/

root@localhost system]# pwd
/usr/lib/systemd/system
[root@localhost system]# cat nagios.service
[Unit]
Description=Nagios Core 4.4.6
Documentation=https://www.nagios.org/documentation
After=network.target local-fs.target mariadb.service

[Service]
Type=forking
ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
ExecStop=/usr/bin/kill -s TERM ${MAINPID}
ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd
ExecReload=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ExecReload=/usr/bin/kill -s HUP ${MAINPID}

[Install]
WantedBy=multi-user.target


Also I've downloaded the "ixed.7.4.lin" & copied it onto usr/lib64/php/modules/

[root@localhost system]# cd /usr/lib64/php/modules/
[root@localhost modules]# ls
bz2.so ftp.so ldap.so pdo.so snmp.so sysvshm.so
calendar.so gd.so mbstring.so pdo_sqlite.so sockets.so tokenizer.so
ctype.so gettext.so mysqli.so pgsql.so sodium.so xmlreader.so
curl.so iconv.so mysqlnd.so phar.so sqlite3.so xml.so
dom.so ixed.5.4.lin opcache.so posix.so ssh2.so xmlwriter.so
exif.so ixed.7.4.lin pdo_mysql.so shmop.so sysvmsg.so xsl.so
fileinfo.so json.so pdo_pgsql.so simplexml.so sysvsem.so


The Output for find /usr -type f -name "ixed.7.4.lin" is,

[root@localhost modules]# find /usr -type f -name "ixed.7.4.lin"
/usr/lib64/php/modules/ixed.7.4.lin


Now as both of these files are present & when I tried to start the service am getting Nagios unit not found.

[root@localhost modules]# systemctl start nagios.service
Failed to start nagios.service: Unit not found.


On checking the status via, systemctl status nagios.service the output still remains the same.

[root@localhost modules]# systemctl status nagios.service
Unit nagios.service could not be found.


Kindly advice If am missing anything.
Regards,
Vision
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: NagiosXi Not working after Upgrading PHP (Offline)

Post by vtrac »

Hi Vision,
How are you doing?
I like your name ... :-)

Please run the below command as "root" on your Nagios XI command prompt:

Code: Select all


   systemctl enable /etc/systemd/system/multi-user.target.wants/nagios.service
   systemctl start nagios
   systemctl status nagios

Best Regards,
Vinh
Locked