Code Monkey home page Code Monkey logo

phpipam-scripts's Introduction

phpipam-scripts

This is a set of scripts designed to access phpIPAM database from a DHCP/DNS server.

phpipam-hosts

phpipam-hosts will let you generate customized host lists which can be included in ISC DHCP Server or dnsmasq configuration. You can also create /etc/hosts and /etc/ethers files.

To include a generated host list in any section of the ISC DHCP Server configuration, you can add in the dhcpd configuration file:

include "/path/to/host-list";

To see available configuration options, run phpipam-hosts -h

Features

  • generate multiple host lists from one database and automatically restart DHCP server if any list changed
  • filter hosts by phpIPAM sections, subnets and host state (active, reserved, offline, dhcp)
  • check MAC address validity and automatically comment out invalid hosts in the finished configuration file
  • optionally generate host list with only invalid hosts for easier debugging

Requirements

  • Python
  • python-mysqldb
  • installed and configured phpIPAM (can be installed on a different host than phpipam-hosts)

Installation

Install phpipam-hosts in a directory in your $PATH, for example /usr/local/sbin. Save provided example configuration file in /etc/dhcp/phpipam.conf and modify default database configuration to reflect your environment.

phpipam-hosts is designed to run periodically from cron, access phpIPAM database and generate specified host lists. You can either add entries with specified arguments in cron directly (run phpipam-hosts --help to see list of available options) or write your configuration in main configuration file (/etc/dhcp/phpipam.conf by default) and access it using --group option.

Example cron entry which generates a single host list and restarts dhcpd daemon if host list is changed:

*/5 * * * * root /usr/local/sbin/phpipam-hosts -o /etc/dhcp/dhcpd-hosts.conf -x

You can use an example phpipam-hosts-wrapper script to generate multiple host files and restart dhcpd if any one of them changes. To do that, you should configure different host files with the same trigger file.j

License and copyright

License: GPLv3

Copyright (C) 2014 Maciej Delmanwski [email protected]
Homepage: https://github.com/debops/phpipam-scripts/
phpIPAM homepage: http://phpipam.net/

phpipam-scripts's People

Contributors

djh00t avatar drybjed avatar pedroberretta avatar the2nd avatar zlyoha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

phpipam-scripts's Issues

Error on mysql connect - solved

I recently upgraded my server to Ubuntu 20.04 (Python 2.7.18, mysql Ver 8.0.23) and I noticed the script was'nt working.
After a long troubleshoot I discovered this issue:

mysql_exceptions.OperationalError: (2059, "Authentication plugin 'caching_sha2_password' cannot be loaded

I tested the workaround provided here (https://stackoverflow.com/questions/49194719/authentication-plugin-caching-sha2-password-cannot-be-loaded) and I suggest to update the readme with this useful command

ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';

Regards

ip address's state definition has been changed since phpipam v1.2

Hello Maciej

I found you phpipam scripts very useful
but since version 1.2 phpipam has been completely rewriten
and your hardcoded statements of a state values don't fit it anymore

let me explain what have happened in python style
in previous versions of phpipam there were a dictionary {active:1, reserver:2, offline:0, dhcp:3}
now this dictionary has been trasformed to {active:2, reserver:3, offline:1, dhcp:4}

I would rewrite your code but I'am new to github so I don't know how to use it
can you rewrite you script to match new version?

Thx,
Nikolay

hostname validation needed

Yesterday, when I entered invalid characters (Cyrillic) into the hostname field, my isc-dhcp servers got crashed after rebooting.

I bet you know that hostnames can only consist of a limited set of characters. Therefore, this behavior is quite expected

we need the hostname argument to be validated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.