{php}IPAM: Installation and Configuration on Ubuntu

I was recently evaluating IP address management systems to which I did seem to find a favourite in {php}IPAM which is an open source IP address management system, this is a PHP based application with MySQL database management using jQuery libraries, ajax and some HTML5/CSS3 features. The features list is quite rich and whilst not detailing them in full, satisfied my criteria of functional requirements of providing API and IP request modules in addition to the standard feature set we should look for in an IP address management system.

One of the goals of {php}IPAM is to provide a light IP address management system, and therefore in most use cases all components of the LAMP architecture can be deployed on a single host, in my case this would be Ubuntu 14.04 LTS.

Before installing and configuring {php}IPAM there is a requirement to install the the required packages for the LAMP architecture (Apache, MySQL, PHP) to run the {php]IPAM application. If your are installing a new instance of MySQL you will be prompted to set the password credential for the ‘root’ user during installation.

In my use case I will be leveraging the API module, which also requires the php extensions curl (php5-curl) and mycrypt (php-mcrypt).

sudo apt-get update 
sudo apt-get -y install apache2 mysql-server php5 php5-gmp php-pear php5-mysql php5-ldap wget php5-mcrypt php5-curl 

Now we will need to the download package from the repository, and extract this to the Apache Web Server root directory.

cd /tmp
wget http://hivelocity.dl.sourceforge.net/project/phpipam/phpipam-1.1.010.tar
sudo tar -xvf phpipam-1.1.0.10.tar -C /var/www

By default, during installation of Apache, this will create a default web site, we will remove the symbolic link from thefrom sites-available to the sites-enabled directory and then enable the rewrite module and restart the Apache Web Server (apache2) service to apply changes.

sudo a2dissite 000-default.conf
sudo a2enmod rewrite
service apache2 restart 

Now we will create the {php}IPAM virtual host file (/etc/apache2/sites-available/ipam.conf) using a text editor and configure as per the below example. In this example, I will be optionally enabling the SSL engine and specifying the paths to the SSL certificate file, private key and the certificate chain file.

<VirtualHost *:443>
    ServerName ipam.dean.local
     SSLEngine on
     SSLCertificateFile /etc/apache2/ssl/ipam.dean.local.crt
     SSLCertificateKeyFile /etc/apache2/ssl/ipam.dean.local.key
     SSLCertificateChainFile /etc/apache2/ssl/ipam.dean.local.chainfile.crt
     ServerAdmin serveradmin@dean.local
     DocumentRoot /var/www/phpipam
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>​

Once the virtual host file has been created we will enable the site, enable the Apache SSL module and reload Apache to apply the configuration.

sudo a2enmod ssl 
sudo a2ensite ipam.conf
service apache2 restart 

Now we will configure the {php}IPAM database management system, which in this case is MySQL for the connection string, as all the components for the LAMP architecture are installed on a single host we can specify the hostname as ‘localhost’ and set a password for the user ‘phpipam’ to authenticate to the database ‘phpipam’.

$db['host'] = "localhost";
$db['user'] = "phpipam";
$db['pass'] = "enterasecurepassword";
$db['name'] = "phpipam";​

By browsing to the URL, in this example https://ipam.dean.local we may now initialise the {php}IPAM instance from the installation page select ‘Automatic Database Installation’ which will now create the phpipam MySQL database by supplying the MySQL root user credentials. The final step now is to set a site title and URL (you may choose to complete this at a later time), once these settings have been saved the installation is now complete and the {php}IPAM web application is available to accept connections and configure.

For those you still manage allocation of IP addresses by the use of spreadsheet, maybe it time to think about deploying an IP address management system (does not have to be {php}IPAM!), the above steps show {php}IPAM is simple to install and configure, if you have looked through the feature list provides a rich functionality and is an open-source project and through the extended API and IP request modules can integrate with your existing automation/continuous delivery implementations.

The headache of managing IP address allocation (or in fact most things!) in a spreadsheet reminds me of a comment made by Scott Bollinger ‘When the process is manually updating a spreadsheet you’ve already lost.’

Advertisements

Modifying incorrect timezone in Nagios XI web console

I was recently looking at the last check times within Nagios XI web console, I noticed that the timestamp was incorrect in comparison to the system time on the Nagios XI system (CentOS).

On browsing to Admin > System Config > System Profile, the PHP timezone was incorrect and set to be ‘America/Chicago’.

In order to set the correct PHP timezone, I performed the following:

1) Edit ‘/etc/php.ini’ to configure the correct time zone.

2) Browse to the ‘Module Settings’ section and modify the ‘date.timezone’ setting, in my case this was to modify the timezone as below:

date.timezone = Europe/London 

3) Save the modified ‘/etc/php.ini’ file.

4) Restart the apache server:

service httpd restart 

Now the Nagios XI web console is reporting the correct timezone and times are displayed as expected.