Miha

Author Archives: Miha

phpipam API clients

To simplify API calls etc. I created a separate GitHub repository to have a collection of phpipam API clients for different languages etc. If you created a client and want to share it head over to https://github.com/phpipam/phpipam-api-clients and share yours !

 

To start I created a php class to work as API client, now available in repo in php-client folder.
https://github.com/phpipam/phpipam-api-clients/tree/master/php-client

It supports all API calls, also encrypted requests are supported by setting $api_key variable in config file. Supported output formats are json/xml/array/object.

 

Here is a short example of working with client.

  1. Copy config.dist.php to config.php and enter details for you installation / API to provided variables. You can also specify each parameter when initialising client directly.
  2. Make calls ?

Here is a short example how to get details for specific section:
<?php
include config file and api client class file
require("api-config.php");
require("class.phpipam-api.php");

# init object with settings from config file or specify your own
$API = new phpipam_api_client ($api_url, $api_app_id, $api_key, $api_username, $api_password, $result_format);
# debug - output curl headers it some problems occur
$API->set_debug (false);
# execute call
$API->execute ("GET", "sections", array(5), "", $token_file);
# ger result
$result = $API->get_result();

# Continue reading

phpipam 1.2.1 bugfix release

phpipam version 1.2.1 was released today. This is a bugfix release, addressing the following issues:

 Enhancements:
 ----------------------------
 + French translation updated to verson 1.2;
 + German translation updated to verson 1.2;

 Bugfixes:
 --------
 + Fixed upgrade bug that selected invalid auth method for AD/LDAP users;
 + Fixed LDAP problems after 1.2 upgrade;
 + Fixed PowerDNS Slave with multiple masters delimiter error;
 + Fixed owerDNS PTR records not being updated automatically;
 + Fixed csrf cookie bug when editing folder;
 + Fixed csrf cookie bug when truncationg subnet;
 + Fixed invalid code for API crypt method;
 + Fixed strange headings font display in Firefox;
 + Fixed invalid proxy settings in config.dist.php;
 + Fixed search same hostnames in db link form address table;
 + Fixed import subnet bug caused by fw object;
 + Fixed Subnet Import (Preview button > no action);

 Security Fixes:
 ----------------------------
 + Fixed security issues introduced in 1.2;

There is no database change, so just replace phpipam directory and copy over config.php.

br
Miha

phpipam v1.2 released

Dear all, I am happy to announce new release of phpipam IP address management – version 1.2.

For this release backend code was completely rewritten, for database connections now pdo has replaced mysqli, so make sure you php supports pdo and pdo_mysql before upgrading. It also fixes lots of bugs, parametized SQL queries and brings lots of new features, most important are:

  • Multiple simultaneous authentication methods
  • PowerDNS integration
  • REST API
  • Mark subnet as full
  • L2 domains
  • ICMP check enhancements (fping support)
  • Firewall zones and nameservers

And much more. You can find full changelog below, please read it.

If you find phpIPAM useful for your company donations would be highly appreciated :)

You can demo it here: http://demo.phpipam.net/
You can download it on sourceforge site: phpipam-1.2 or on github.

 

Before upgrading make sure you first backup current database, you can follow upgrade guide on our site.

 

Some screenshots:

Screen Shot 2016-01-29 at 20.12.45 Screen Shot 2016-01-29 at 20.12.39 Screen Shot 2016-01-29 at 20.12.32 Screen Shot 2016-01-29 at 20.12.19 Screen Shot 2016-01-29 at 20.13.39 Screen Shot 2016-01-29 at 20.15.53

Special thanks to all the people submitting bug reports, translators and feature testers!


Full changelog for this release is:

== 1.20

	New features:
	------------
	+ Added multiple simultaneous authentication methods (Apache, AD, LDAP, Radius, NetIQ);
	+ Added fping scanning support;
	+ Added selectable scanning type (ping/pear/fping);
	+ Added L2  Continue reading

SElinux policy for icmp checks

Many issues reported with scanning subnets and updating host statuses are related to SElinux being enabled. So far the solution was to completely disable SElinux, but this was more workaround than anything else. Robert was kind enough to share SElinux policy that should be used with phpipam if SElinux is enabled on your server.

 

Basically it permits the opening of raw IP sockets for non-root users, that are required for executing ping command.

 

1) Create the file http_ping.tt and add the following to it:

module http_ping 1.0;

require {
type httpd_t;
class capability net_raw;
class rawip_socket { getopt create setopt write read };
}

#============= httpd_t ==============
allow httpd_t self:capability net_raw;
allow httpd_t self:rawip_socket { getopt create setopt write read };

 

2) Run the following commands (as root user):

checkmodule -M -m -o http_ping.mod http_ping.tt
semodule_package -o http_ping.pp -m http_ping.mod
semodule -i http_ping.pp

brm

Using custom fields in phpipam

phpipam has support for creating custom fields to be used in address, subnets, vlans, devices and users tables. This is useful when you need to add some custom data to your tables. You can set your custom fields under Administration > Custom fields.

 

It supports following types of data and it representations:

  • varchar: normal input field
  • integer: input field that must be an integer
  • boolean: true/false field, that is interpreted with dropdown
  • text: textarea input field, that holds bigger data than varchar
  • date: adds date field, that is represented with date dropdown
  • datetime: adds datetime field, that is represented with date and time dropdown
  • set: set field adds dropdown options, you control options in size/length field. For example, to have dropdown with three options you set ‘site1′,’site2′,’site3′ in size/length field.

 

Besides setting field type there are some other variables that can be set for each:

  • size / length: depends on field type this controls maximum length of input field or text, maximum size of integer, options for set field etc.
  • default: adds default value if field is left blank.
  • required: controls weather field is required to be filled in, if Continue reading

phpipam MySQL database optimizations

Having large amount of subnets (and other tables) on unoptimised MySQL database server can significantly increase page loads. To see which parameters need to be change I usually use mysqltuner perl script, which connects to database, analyses data and proposes which parameters need to be changed that are not optimally set based on current load.mysqltuner

Installation is simple:

1.) Fetch mysqltuner on FreeBSD:

cd ~
fetch http://mysqltuner.pl

or wget on linux:

wget http://mysqltuner.com

2.) Make it executable:

chmod +x mysqltuner.pl

3.) And run it to analyse database, you have to provide administrative credentials.

./mysqltuner.pl

 

Any other similar scripts out there you would recommend?

brm

phpipam 1.1.010 update released

phpipam 1.1.010 update released with following fixes:

== 1.1.010

Bugfixes:
----------------------------
+ Fixed login fails with LDAP when escape characters are in password;
+ Fixed login not working with spaces in password for AD login;
+ Fixed Ivalid action when adding vlans from subnet popup menu;
+ Fixed custom fields not appearing properly on IP request editing;
+ Fixed Invalid ID error for IP address details on sorting;
+ Fixed warnings if no VLAN search results are present;
+ Fixed test mail not sending;
+ Fixed unable to login if $phpsessname not defined;
+ Fixed unable to login after upgrade;

I apologise for any inconvenience some users experienced with upgrade.

brm

phpipam v1.1 released :: security fixes, performance improvements, mod_rewrite optional

Dear all, I am happy to announce new version of phpipam IP address management – version 1.1.

This release fixed some bugs, provided some new features, but most importantly it was focused on:

  • Security fixes (SQL injection, XSS scripting, crypting DB passwords, brute-force attack prevention, …)
  • Performace improvements (Caching, reusing SQL connection),..
  • mod_rewrite no longer required, selectable URL structure under settings

Some screens:

installation vlans subnet

If you find phpIPAM useful for your company donations would be highly appreciated :)

You can demo it here: http://demo.phpipam.net/
You can download it on sourceforge site: phpipam-1.1.

Special thanks to all the people submitting bug reports, translators and feature testers!


Full changelog for this release is:

Enhancements:
----------------------------
+ Caching of SQL results to avoid multiple queries;
+ Reduced number of DB queries;
+ Added selected mail notifications to admins to be notified on IP/subnet change;
+ Added new subnetId index to ipaddresses table that significantly improves network loading;
+ Now using only 1 network connection towards MySQL server;
+ Updated pagination;
+ mod_rewrite no longer required, selectable URL structure under settings;
+ Added option not to display free ranges;
+ Added option to set maximum VLAN number;
+ Selectable custom fields to  Continue reading

phpipam version 1.0 released

Dear all, I am happy to announce new version of phpipam IP address management – version 1.0. Subnet details

New features, like changelog, favourite subnets, upgraded UI with bootstrap3 and other were introduced, and also lots of improvements and bug fixes are included. Most important are:

  • IP address changelog, subnet and section changelogs with full changelog under tools;
  • Favourite subnets for quick access;
  • Bootstrap 3 with UI enhancements;
  • Widgets can be reordered (dragged) directly on dashboard;
  • Mail settings can now be set on gui (localhost / smtp);

If you find phpIPAM useful for your company donations would be highly appreciated :)

You can demo it here: http://demo.phpipam.net/
You can download it on sourceforge site: phpipam-1.0.

Special thanks to all the people submitting bug reports, translators and feature testers!

Screenshots:

Dashboard Subnet scanning Subnet details Subnet editing Settings IP address editing

Full changelog for this release is:

New features:
----------------------------
+ IP address page with IP address details and IP history (Changelog);
+ IP address changelog, subnet and section changelogs with full changelog under tools;
+ Favourite subnets for quick access;
+ Adding subnets from free space with automatic mask provided;
+ Automatic database validity check after upgrading and automatic field/table fix under administration;
+ Automatic weekly check for new phpipam Continue reading

Automatic host availability check

From version 0.9 on there is a option to automatically check statuses of configured hosts for selected subnets, and I received some related questions about it, so here is a short description and guide for it.

Firstly, pcntl support for php cli is advised so phpipam can do parallel icmp checks, this greatly reduces time required for checking status. You can check if your installation is ok with following command:

php -m | grep pcntl

1.) Configure the parameters for pinging

You should set required parameters for pinging, etc ping path etc under

functions/scan/config-scan.php

You can get your ping path by invoking “whereis ping” in terminal.
You can also set some optional parameters in script itself

functions/scripts/pingCheck.php

 

Also, set the time parameters for status under Administration > IPAM settings (Ping status intervals), phpipam will set host as down/up based on this values.

2.) Select which networks to check

Now you have to select which subnets should scan for statuses for configured hosts. Go to edit subnet and check “Check hosts status”. This will tell the cron script to check the status of hosts inside this subnet.
ICMP check

3.) Add cron script

I suggest checking Continue reading

phpIPAM version 0.9 released

Dear all, I am happy to announce new version of phpipam IP address management – version 0.9. Subnet status
New features, like Support for ICMP network discovery, ICMP check IP status in demand, Compressed (grouped) DHCP IP ranges and other were introduced. Most important are:

  • Support for ICMP network discovery;
  • Cron script to check status for selected subnets/hosts with threading suport (pcntl php extension required)
  • ICMP check IP status in demand;
  • Added folders;
  • Compressed (grouped) DHCP IP ranges;
  • Added subsections;

Some instructions on how to setup ICMP scanning will follow.

If you find phpIPAM useful for your company donations would be highly appreciated :)

You can demo it here: http://demo.phpipam.net/
You can download it on sourceforge site: phpipam-0.9.

Special thanks to all the people submitting bug reports, translators and feature testers!

Screenshots:

Subnet status Screen Shot 2013-10-30 at 14.25.57 On-demand check IP last seen UI changes Mail status notifications

Full changelog for this release is:

New features:
----------------------------
+ Support for ICMP network discovery;
+ Cron script to check status for selected subnets/hosts with threading suport (pcntl php extension required);
+ ICMP check IP status in demand;
+ Compressed (grouped) DHCP IP ranges;
+ API server version 0.1;
+ Option to show and group subnets by VLAN in subnets list;
+ Option to show and Continue reading

phpIPAM version 0.8 released

Dear all, I am happy to announce new version of phpipam IP address management – version 0.8. Quite some bugs have been squashed and some new features introduced, like per-group permissions, support for translations, visual subnet displays and other: Permissions

  • New group and permission management;
  • Support for translations;
  • Subnet resizing;
  • Subnet splitting into smaller subnets;
  • Added free space display for nested subnets;
  • Added visual display of subnet usage per IP address;
  • Added truncate network option that deletes all IP addresses in subnet;
  • Added button the updates subnet with RIPE information;

You can demo it here: http://demo.phpipam.net/
You can download it on sourceforge site: phpipam-0.8.

Please note that IE8 is no longer supported!

Special thanks to all the people submitting bug reports, donors, translators and feature testers!

Screenshots:

Screen Shot 2013-06-18 at 10.19.10 PM Screen Shot 2013-06-18 at 10.18.57 PM Screen Shot 2013-06-18 at 10.19.36 PM Screen Shot 2013-06-18 at 10.19.32 PM Screen Shot 2013-06-18 at 10.18.47 PM

Full changelog for this release is:

New features:
----------------------------
+ New group and permission management;
+ Support for translations;
+ Subnet resizing;
+ Subnet splitting into smaller subnets;
+ Added free space display for nested subnets;
+ Added visual display of subnet usage per IP address;
+ Added truncate network option that deletes all IP addresses in subnet;
+ Added button the updates subnet with RIPE information;

Enhancements:
----------------------------
+ Continue reading

Translators wanted

Translation support will be available on next phpipam release, code is being redone and final checks ongoing. I have decided to go with gettext, it seems to be the most suitable for phpipam.

Translating is straight-forward, by providing translations for strings, for example:

#: functions/functions-mail.php:176
msgid “your domain username”
msgstr “translated text”

There are many tools available to help with translation, like poedit and others.

If anyone is interested in providing translation, please contact me on email. I have already received some requests in the past, I will try to dig up old emails…

brm

phpIPAM installation on debian 6.0.6

I have received a request for help on manual installation of phpIPAM on debian linux, so I decided to write a small how-to if anyone else has problems or is not so familiar with linux distributions and environment. I have used fresh default debian 6.0 as distribution because it is widely used, I believe on ubuntu linux procedure should be very similar, except maybe for locations of some config files.

I have used the following settings for installation:

  • Fresh debian installation
  • MySQL server not yet installed and no root pass configured
  • Apache not installed and configured
  • phpipam will be installed in default directory (no vhosts) under /phpipam/ folder

If you already have MySQL/apache set you can skip point 3.

Installation procedure:

1.) Preparing environment and installing required apps

Update your sources (apt-get update) and install Apache, php and mysql server:

apt-get install apache2 mysql-server php5 php5-gmp php-pear php5-mysql php5-ldap

After all is installed and the apache server is running, you need to decide weather you will be running it under vhost or in subdirectory or root directory. For this guide I will have it in subdirectory http://server/phpipam/, so do the following:

cd /var/www/
wget http://freefr.dl.sourceforge.net/project/phpipam/phpipam-1. Continue reading