Page 1 of 1

Updating PHP on Nagios

Posted: Tue Jul 02, 2019 4:59 pm
by akrradford
Hello,

We moved our install to a new CentOS 7 server, things have been running smoothly for about six months.

During a vulnerability assessment, it was noted that the system is using an insecure version of PHP.

I tried updating and adding the PHP 7.3 repo, but I am receiving an error when I try to update via YUM:
Error: Package: nagiosxi-deps-el7-5.6.3-1.noarch (installed)
Requires: php-mssql
Removing: php-mssql-5.4.45-17.el7.remi.x86_64 (@remi-php54)
php-mssql = 5.4.45-17.el7.remi
Obsoleted By: php-pdo-dblib-7.0.33-9.el7.remi.x86_64 (remi-php70)
Not found
Available: php-mssql-5.4.16-7.el7.x86_64 (nagiosxi-deps)
php-mssql = 5.4.16-7.el7
Available: php-mssql-5.4.16-9.el7.x86_64 (epel)
php-mssql = 5.4.16-9.el7

I tried manually updating to 7.3 on my test box, but it fails its validation checks so I thought I would reach out to this forum to see if anybody can help.

Thanks,

Ryan

Re: Updating PHP on Nagios

Posted: Wed Jul 03, 2019 11:30 am
by ssax
Nagios XI only supports up to PHP 7.2, you can use these steps to do it:

*** NOTE: You must be on XI 5.5+ for this to work, you are REQUIRED to upgrade to at least that first. Take an XI backup AND a VM snapshot just in case.

Code: Select all

yum remove nagiosxi-deps -y
yum -y install epel-release wget
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
PHPTZ=$(grep -s '^date.timezone' /etc/php.ini | awk '{print $3}' | sed 's/\//\\\//g')
yum -y remove php-*
yum-config-manager --enable remi-php72
yum -y install php php-opcache php-devel php-gd php-ldap php-mbstring php-pdo php-mysqlnd php-pgsql php-pear php-pecl-ssh2 php-pgsql php-process php-snmp php-xml
sed -i "s/^date.timezone = .*/date.timezone = ${PHPTZ}/" /etc/php.ini
cd /tmp
rm -rf /tmp/nagiosxi
wget https://assets.nagios.com/downloads/nagiosxi/5/xi-5.6.3.tar.gz
tar zxf xi-5.6.3.tar.gz
cd /tmp/nagiosxi
rm -rf /etc/php.d/sourceguardian.ini
./init.sh
sed -i '/^PHP script/d' xi-sys.cfg
sed -i '/^1)/d' xi-sys.cfg
sed -i '/^2)/d' xi-sys.cfg
sed -i '/^3)/d' xi-sys.cfg
./install-sourceguardian-extension.sh
service httpd restart

Re: Updating PHP on Nagios

Posted: Fri Jul 05, 2019 2:20 pm
by akrradford
Worked like a champ. Thank you.

Ryan

Re: Updating PHP on Nagios

Posted: Mon Jul 08, 2019 10:17 am
by benjaminsmith
Hi Ryan,
Worked like a champ. Thank you
Thanks for the update.

I'll close this post, but if you have any new questions, please feel free to open another.