Quantcast
Channel: Miha – phpIPAM IP address management
Viewing all 15 articles
Browse latest View live

phpIPAM version 0.8 released

$
0
0

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:
----------------------------
+ Added add nested subnet under subnet details to simplify master subnet selection in hierarchy;
+ Added edit subnet link from search results;
+ Added reverse IPv6 DNS entries to IPCalc (Vincent Boisard);
+ Added option for plain-text emails;
+ Added ckEditor to write instructions;
+ StrictMode is not set globally anymore but set per section;
+ Added custom user fields;
+ Added option to verify that hostname is unique;
+ Improved MySQL exception handling;
+ Added mod_rewrite error detection on installation and upgrade;
+ Added hostname validation;
+ Added Hostfile dump of IP addresses;
+ Search also searches in custom fields;
+ jQuery updated to v 1.9.1;

Bugfixes:
------------------------
+ Fixed overlay on second popup;
+ Fixed IE search bug;
+ Fixed support for non-standard ports;
+ Fixed permitting overlapping subnets if vrfs are different;
+ Fixed dates in logging appearing in 12h format;
+ Fixed broken subnets link in tools > subnets if installation is not at document root;
+ Fixed error when adding new subnet if checkboxes are not selected in newer MySQL servers;
+ Fixed bad display of multilined navigation bar;
+ Fixed wrong output of tools > VLAN list when using Duplicate VLANs;
+ Fixed wrong link for upgrade script;
+ On VRF change all child subnets are updated also;
+ Fixed wrong maximum on dashboard top10 percentage;
+ Fixed Adding a vlan while editing a subnet resets the edit subnet form;
+ Fixed wrong free space calculation for nested subnets;
+ Fixed IP use statistics not cumulative up the hierarchy if subnes has slaves;

brm


phpIPAM version 0.9 released

$
0
0

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 group subnets by VRF in subnets list;
+ Added subsections;
+ Added AD username search;
+ Added folders;

Enhancements:
----------------------------
+ Added error catching/displaying for ajax-loaded php scripts;
+ Added default language for login/requests display and new users;
+ Added direct links to different pages in IP address table;
+ Subnets can now be edited directly from nested subnets list;
+ When adding nested subnets default vlan/vrf is selected from parent;
+ Added Section ordering;
+ Added per/section subnet ordering (overrides dafault form settings);
+ Clicking on section now shows all subnets and belonging details;
+ If session timeouts after re-login last requested page will be opened;
+ Searh for IP address now returns also subnet, even if IP is not existing;
+ Per-user selection of widgets to display;
+ Added description and required field checkbox for custom IP/Subnet Fields;
+ Added custom device fields;
+ Mails are now sent through phpmailer;
+ Admin user cannot be deleted;

Translations:
----------------------------
+ Added French translation (Denis Darré);
+ Added Dutch translation (Michiel Visser);
+ Added German translation (Carsten Brückner);

Bugfixes:
----------------------------
+ Fixed wrong VLAN display in tools;
+ Fixed subnet/section links from VLANS if base not /;
+ Fixed warning in apache log on subnet editing if no VRFs are configured;
+ Fixed admin menu off-screen overflow;
+ Fixed firefox error when selectiong rights for section/subnets was not possible;
+ Fixed subnet description in Cyrillic problem;
+ Fixed errors on no permissions for user;
+ Fixed Inaccurate Free Space Calculation (and Chart);
+ Fixed VLAN permissions where VLAN was not displayed;

brm

Automatic host availability check

$
0
0

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 it per 15 minutes:

# update host statuses exery 15 minutes
*/15 * * * * /usr/local/bin/php /usr/local/www/phpipam/functions/scripts/pingCheck.php

Change the paths according to your installation of course :)

That should be it. I would advise to run the script manually for the first time to see if any errors are present.

brm

phpipam version 1.0 released

$
0
0

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 version;

Enhancements:
----------------------------
+ Bootstrap 3;
+ UI enhancements;
+ Improved views based on browser width;
+ Widget order can now be set;
+ Widgets can be reordered (dragged) directly on dashboard;
+ Subnet can now be splitted to max 256 new subnets (16 before);
+ Scan settings are moved to Administration;
+ Widget management has moved to administration, which allows creation of new widgets;
+ Improved ICMP error detection;
+ Mail settings can now be set on gui (localhost / smtp);
+ Popup windows are now draggable;
+ VLAN adding in the fly enhancements;
+ Master section now shows all subnets in subsections;
+ Tools > devices redone;
+ DeviceTypes can now be edited/set/added;
+ Ping subnet enhancements;
+ Custom field types are now defineable (int/varchar/date/datetime/text/bool/set);
+ Date and timepicker popups if type = date/datetime;
+ For `set` and boolean custom fields dropdown is presented that users can pick;

+ Favourite subnets widget;
+ IP requests widget;
+ Changelog widget;

Translations:
----------------------------
+ Added Brazil translation (Michel Braga Guimarães);

Bugfixes:
--------
+ UI fixes;
+ Fixed bug where last page of IP addresses was inaccessible;
+ IP address state change is now sent to all admins;
+ Fixed subnet displaying as 0.0.0.0/0 in details;
+ Fixed links to subnets form vlans and vrfs;
+ Fixed search result showing all folders if searched item is not IP address;
+ Fixed disapearing section when L2 section was selected as master section;
+ Fixed device ID showing in mail notification instead of hostname;
+ Fixed device ID showing in search results and export instead of hostname;
+ Fixed search for subnet name returned no results;
+ Fixed apostophe in IP address description throws SQL error for scan results and XLS import;
+ Fixed requester email gets cut if longer than 32 chars;
+ Fixed admin folder edit appearing as subnet;
+ Fixed missing device/port in import;
+ Fixed master section delete did not delete subsections and belonging subnets/ips;
+ Fixed online status was not updated when running Ping status scans;
+ Fixed Folder name not appearing when deleting folder;

brm

phpipam twitter account

$
0
0
I have opened a twitter account to deploy news etc easier, if you like you can follow @phpipam on twitter. I was hoping to get at least guys using development releases to help me testing.

brm

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

$
0
0

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 be visible/hidden in tables view and updated device/VLAN view;
+ Added additional confirmation before section, subnet, folder and IP address deletion;
+ New script added for cron checks that discovers new hosts for selected networks;
+ Added inactivity timeout to settings;
+ Changed install procedure and updated install scripts;
+ Added PEAR check for installation;
+ Added free range disaply for VLANs;
+ Addes SSL/TLS option for SMTP mail;
+ API:
+ Bugfixes;
+ Added API admin permissions;
+ read/delete actions for IP addresses;
+ read/delete actions for Vlans;
+ read/delete actions for VRFs;

Security Fixes:
----------------------------
+ Fixed known command injection vulnerabilities in the scan functions;
+ Fixed known SQL injection vulnerabilities;
+ Fixed known XSS vulnerabilities;
+ Fixed known action XSS events;
+ Moved to crypt method for storing password in database with salting;
+ Added option to force user to change pass after first login;
+ Admin password must be changed after installation;
+ Added captcha code request after 5x unsuccesfull login to prevent brute-force attacks;

Translations:
----------------------------
+ Added es_ES translation;

Bugfixes:
----------------------------
+ Fixed top 10 widgets not escaping strings;
+ Fixed section parent can be set to self that caused section to disapear;
+ Fixed username instead of password being sent to smtp server;
+ Fixed IE search bug with workaround;
+ Fixed subnet and bcast not showing on strict mode disabled;
+ Fixed top subnets missing on dashboard for non-admin users;
+ Fixed bug when installation was silently failing bacause pf missing _() function (missing gettext extension)
+ Fixed device custom field not populated on adding device;
+ Fixed XLS export silently failed when description longer than 31 characters;
+ Fixed overlapping check not working;
+ Fixed subnet free space calcultation;
+ Fixed visual subnet display not showing on /31 and /32 networks;
+ Fixed custom fields display on folder edit;
+ Fixed unable to edit IP addresses when fields are sorted;
+ Fixde ordering of custom fields defaults to varchar 256;
+ Fixed IPv6 subnet / broadcast calculation bug and next subnet suggestion;

brm

phpipam 1.1.010 update released

$
0
0

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 MySQL database optimizations

$
0
0

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


Using custom fields in phpipam

$
0
0

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 it is not insert/exit query will fail.

 

You can also set which fields are to be hidden from default table by clicking of filter button. Selected custom fields will not be visible in table view, but will always be visible under details for each data type. For example hiding custom IP address field will be visible in editing IP address and IP address details, but will not be shown in list of all IP addresses in subnet. This is mainly used to control size of table view not to be too wide.

Also note that if for example some field is to be shown for addresses and all inputs for this field are empty in view of all addresses in subnet, the field will not be shown.

Below are some screenshots.

brm

Screen Shot 2015-02-24 at 08.14.55 Screen Shot 2015-02-24 at 08.09.57 Screen Shot 2015-02-24 at 08.09.40 Screen Shot 2015-02-24 at 08.09.29 Screen Shot 2015-02-24 at 08.09.15

SElinux policy for icmp checks

$
0
0

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

 

This also helps to check status, with setenforce 0:

[root@ipam selinux]# getenforce
Enforcing
[root@ipam selinux]# setenforce 0
[root@ipam selinux]# getenforce
Permissive
[root@ipam selinux]# 

 

than add correct permission to ping

[root@ipam selinux]# ls -ls `which fping`
88 -rwxr-xr-x. 1 root root 89927 Apr  3 17:11 /usr/local/sbin/fping
[root@ipam selinux]# chmod 4755 /usr/local/sbin/fping
[root@ipam selinux]# ls -ls `which fping`
88 -rwsr-xr-x. 1 root root 89927 Apr  3 17:11 /usr/local/sbin/fping
[root@ipam selinux]#

brm

phpipam 1.2 beta1 testers needed

$
0
0

Hi all,

first beta version of phpipam 1.2 is available for download on Github:

phpipam 1.2 beta 1

If you have time help us squash some bugs before final release, focus is on the following things:

  • scan agents;
  • PowerDNS integration;
  • APIv2 (REST)
  • subnets scanning (pear/ping/fping)

Report any issues to our GitHub page (https://github.com/phpipam/phpipam/).

 

UPDATE: 1.2_beta2 now available !

Screen Shot 2015-10-12 at 13.15.56

 

phpipam on Synology

phpipam v1.2 released

$
0
0

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 domains;
	+ Added option to define address as default GW for subnet;
	+ Added customizable address tags with compressed option;
	+ Added temporary subnet / address shares;
	+ Added quick subnet masks;
	+ Added nameserver sets per subnets (jonashauge);
	+ Added optional syslog as log location;
	+ REST API:
		+ documentation: http://phpipam.net/api-documentation/
		+ API v2, old v1 support added
		+ Complete rewrite of all API calls;
		+ New security models (crypt, ssl, none);
		+ Support for custom fields;
		+ JSON / XML output
		+ Full read/write controllers (Sections, Subnets/Folders, Addresses, Vlans, Vrfs);
	+ PowerDNS integration:
		+ Automatic reverse records creation (PTR) - IPv4 and IPv6;
		+ Automatic SOA, NS record creation;
		+ DNS domain management;
	+ Added Scan agents to scan subnets remotely;
	+ Added firewall zone mappings and module;
	+ Added per-subnet DNS resolvers;
	+ Added option to mark subnet as utilized (full);

	Enhancements:
	----------------------------
	+ All tables are now InnoDB by default;
	+ Upgraded jQuery to 2.1.3;
	+ All functions rewritten to classes/methods;
	+ Parametized all SQL queries, moved from MySQLI to PDO;
	+ Added VLAN/VRF to search and to search results export;
	+ Redesigned admin and tools menu;
	+ Added scanned/discovered subnets to tools for faster overview;
	+ Per-user display settings;
	+ New widget - tools shortcuts;
	+ New widget - IP calculator;
	+ New widget - request IP address;
	+ Clickable links for subnet fields;
	+ Custom VRF fields;
	+ Subnets can be now linked to devices;
	+ Import/export enhancements;
	+ Fast user switching for admins to impersonate user;
	+ Opened folders and subnets in tree menu are saved on page reload;
	+ RWA users can now process IP requests;
	+ Added auto-suggest for possible slave subnets;
	+ SSL option for MySQL connections;
	+ Enum custom field support;
	+ Added password reset script;
	+ Set sections to display VRF in;

	Security Fixes:
	----------------------------
	+ Parametized all MySQL querries;
	+ Fixed plainpass being logged on user update;
	+ Fixed XSS exploit on /error/;
	+ Added CSRF protection to forms;

	Translations:
	----------------------------
	+ Added Czech translation;

	Bugfixes:
	----------------------------
	+ Fixed bug with SSL/TLS smtp servers;
	+ Fixed visual subnet display issues on 32bit systems;
	+ Fixed IPv6 split subnets bug;
	+ Fixed /31 ping bug scanning out of boundaries;
	+ Fixed nested broadcast not counted to used percentage;
	+ Fixed invalid redirect after timeout;
	+ Fixed discovery script index overridden;
	+ Fixed dashboard graphs links to subnets;
	+ Fixed Invalid ID on subnet scan of large subnets;

brm

phpipam 1.2.1 bugfix release

$
0
0

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 API clients

$
0
0

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();

# print result
print_r($result);
?>


API client takes following parameters for initialization:

  • $api_url : Url of your phpipam API server - http://10.10.10.3/phpipam/api/
  • $api_app_id : Name / id of your application as created in phpipam API under administration - myfirstapi
  • $api_key : API key if API security is set to crypt for you API appid. This will be used to encrypt requests, otherwise set to false
  • $api_username, $api_password : Username / password of some phpipam account to use for authorization. Not needed for encrypted requests
  • $result_format : can by one of following: json / xml / array / object

 

For call execution following parameters are needed:

  • method : HTTP method to use (OPTIONS, GET, POST, DELETE, PATCH, PUT) - - REQUIRED
  • controller : Which controller to use (sections, subnets, vlans, ...) - REQUIRED
  • identifiers : array of identifiers to add to URL request. (/api/myfistapi/sections/identifier1/identifier2/...)
  • parameters : key/value array of GET/POST parameters to add to URL request. (POST /api/myfistapi/sections/1/?name=test)
  • Token file : if this is set to false than for each query first authorisation query will be made to obtain access token,
    meaning 1 additional request. If you specify filename here the token will be saved to this file, so no additional queries
     will be required as long as token is valid.

 

 

This is an output from terminal with debug mode :

 

[root@phpipam /usr/local/www/phpipam.net/phpipam-api-clients/php-client (master*) #] php example.php
*   Trying 46.19.10.34...
* Connected to devel.phpipam.net (46.19.10.34) port 80 (#0)
> GET /1.3/api/myapi/sections/5/ HTTP/1.1
Host: devel.phpipam.net
User-Agent: phpipam-api php class
Accept: */*
Content-Type: application/json
token: 1UNFcRNGjH5UvHGaRy!vzgt1

< HTTP/1.1 200 OK
< Date: Wed, 22 Jun 2016 10:49:52 GMT
< Server: Apache/2.4.18 (FreeBSD) OpenSSL/1.0.1l-freebsd
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Length: 451
< Content-Type: application/json
* Connection #0 to host devel.phpipam.net left intact

{"code":200,"success":true,"data":{"id":"5","name":"Testing section",
"description":null,"masterSection":"0","permissions":null,"strictMode":"1",
"subnetOrdering":"default","order":"3","editDate":"2015-12-16 13:04:44",
"showVLAN":"1","showVRF":"1","DNS":null,"links":[{"rel":"self",
"href":"\/api\/apiclient\/sections\/5\/",
"methods":["GET","POST","DELETE","PATCH"]},
{"rel":"subnets","href":"\/api\/apiclient\/sections\/5\/subnets\/",
"methods":["GET"]}]}}#

 

br,

Miha

 

 

 


Viewing all 15 articles
Browse latest View live