Skip to content

Commit

Permalink
allow for dedicated .conf file, remove old sys_build user, update doc…
Browse files Browse the repository at this point in the history
…umenation link
  • Loading branch information
mattpascoe committed Oct 30, 2015
1 parent 8a885a6 commit c72af97
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ Install
* Click the install icon for the plugin which should be listed by the plugin name
* Follow any instructions it prompts you with.
* Install the $ONABASE/www/local/plugins/build_isc_dhcp/build_dhcpd script on your DHCP server. It is suggested to place it in /opt/ona/bin
* Modify the variables at the top of the build_dhcpd script to suit your environment.
* Copy the variables at the top of the build_dhcpd script and add them to `/opt/ona/etc/build_dhcpd.conf` making adjustments as needed.
* If you wish you can just modify the variables at the top of the build_dhcpd script to suit your environment instead of making the .conf file above.

Usage
-----
First off, you must have at least one subnet defined in the database as well as a host definition for the server you will be running the DHCP server on. This host definition should have the same name and IP address as what your server is actually configured to use.

The host within ONA should be defined as a DHCP server for whatever subnets you expect it to be responsible for. You must also have a default gateway defined for the subnet and any DHCP pools that may exist. The "make" process above should have also created a system configuration variable called "build_dhcp_type" with a value of "isc".
The host within ONA should be defined as a DHCP server for whatever subnets you expect it to be responsible for. You must also have a default gateway defined for the subnet and any DHCP pools that may exist. The install process above should have also created a system configuration variable called "build_dhcp_type" with a value of "isc".

You should now see the configuration being built real time in the web interface each time you select the server host and view its DHCP server display page.

This now also exposes the [[dcm.pl]] module called _build_dhcpd_. It is used by the build_dhcpd script to extract the configuration. It is also used by the web interface to generate configuration data.
This now also exposes the [dcm.pl](https://github.com/opennetadmin/dcm) module called _build_dhcpd_. It is used by the build_dhcpd script to extract the configuration. It is also used by the web interface to generate configuration data.

There are a few configuration options in the build script that should be examined. Edit the file `/opt/ona/bin/build_dhcpd` and adjust the following options as needed:
There are a few configuration options in the build script that should be examined. Edit the variables at the top of the file `/opt/ona/bin/build_dhcpd`
or better yet, add the following to `/opt/ona/etc/build_dhcpd.conf` with adjusted options as needed:
# this will default to placing data files in /opt/ona/etc/dhcpd, you can update the following for your system as needed
# for things like chroot jails etc
ONA_PATH="${ONABASE}/etc/dhcpd"
Expand All @@ -40,8 +42,7 @@ There are a few configuration options in the build script that should be examine
SRV_FQDN=`hostname -f`

# Path to the dcm.pl command. Also include any options that might be needed
# this uses the sys_build user to process this task.
DCM_PATH="${ONABASE}/bin/dcm.pl -l sys_build"
DCM_PATH="${ONABASE}/bin/dcm.pl"

# For now a path is required to a default header.
# this will have things like the authoritative statement,ddns-update-style, and other required options
Expand Down
12 changes: 10 additions & 2 deletions build_dhcpd
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@
#
# include "/opt/ona/etc/dhcpd/dhcpd.conf.ona";
#
# You will need to execute the following dcm command to automatically create the appropriate module entries:
#
# NOTE: Some distros use the Linux Terminal Server Project (LTSP) version of dhcp config file instead, be aware of that.
# NOTE: to view example configs in the GUI you need to set build_dhcp_type to "isc" or "dhcpd" in the sys_config table, this is done by the installer.
#
Expand All @@ -88,6 +86,10 @@
[ ! -r /etc/onabase ] && echo "[$0] ERROR: Unable to read /etc/onabase." && exit 1
ONABASE=`cat /etc/onabase`

########### Configuration ##############
# You should take the following configuration items and place them in $ONABASE/etc/build_dhcpd.conf
# If that file is not found the following defaults will be used
#
# this will default to placing data files in /opt/ona/etc/dhcpd, you can update the following for your system as needed
# for things like chroot jails etc
ONA_PATH="${ONABASE}/etc/dhcpd"
Expand Down Expand Up @@ -123,8 +125,14 @@ MAIL_SERVER=mail.example.com # name or IP of the mail server to us
MAIL_FROM=ona-build_dhcpd@$SRV_FQDN # email address to use in the from field
[email protected] # email address(es) to send our notifications to

########## END Configuration ####################

###################### No need to change anything below here ################################
# Pull in the config file if there is one
if [ -f $ONABASE/etc/build_dhcpd.conf ]
then
. $ONABASE/etc/build_dhcpd.conf
fi

# This will log a message in a standardized way
# Its job is simple.. take the message that was passed in and log it via some mechanism.
Expand Down
2 changes: 1 addition & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
$window['html'] .= "<br><b>Disabling install script:</b><br>";
// If there were no errors, move this install file out of the way.
if (!$stat) {
$window['html'] .= "&nbsp;&nbsp;&nbsp;&nbsp;<img src='{$images}/silk/accept.png' border='0'>Moved install files.<br><br><center><b>Install complete. Not disabling install script, this way you can always find where the build script is located.<br>Even though this install may look like it failed.. everything is OK to proceed.<br><br>You should read the documentation located <a href='http://opennetadmin.com/docs/plugins/build_isc_dhcpd'>HERE</a> for further install instructions.</b><br><br><a onclick=\"removeElement('{$window_name}');\">CLOSE WINDOW</a><br></center>";
$window['html'] .= "&nbsp;&nbsp;&nbsp;&nbsp;<img src='{$images}/silk/accept.png' border='0'>Moved install files.<br><br><center><b>Install complete. Not disabling install script, this way you can always find where the build script is located.<br>Even though this install may look like it failed.. everything is OK to proceed.<br><br>You should read the documentation located <a href='https://github.com/opennetadmin/{$plugin_name}/wiki'>HERE</a> for further install instructions.</b><br><br><a onclick=\"removeElement('{$window_name}');\">CLOSE WINDOW</a><br></center>";
} else {
$window['html'] .= "&nbsp;&nbsp;&nbsp;&nbsp;<img src='{$images}/silk/error.png' border='0'> Not disabling install script due to previous errors.<br><br><center><a onclick=\"removeElement('{$window_name}');toggle_window('{$window_name}');\">Fix the errors and then click to TRY AGAIN</a></center>";

Expand Down
2 changes: 0 additions & 2 deletions install.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@

insert into users (id, username, password, level) values ('', 'sys_build', '638c0b71a1677183e7840ae6b5b646a2', 0 ) on duplicate key update username='sys_build';

insert into sys_config (name, value, description, field_validation_rule, failed_rule_text, editable, deleteable) values ('build_dhcp_type', 'isc', 'DHCP build type', '', '', 1, 1) on duplicate key update value='isc';
5 changes: 3 additions & 2 deletions plugin_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
/*
Your plugin must have a short description and a version number
*/
$plug_name = basename(dirname(__FILE__));

$plugin_description = 'Build ISC DHCP server configurations.';
$plugin_version = '1.4';
$plugin_help_url = 'http://opennetadmin.com/docs/plugins/build_isc_dhcp';
$plugin_version = '1.5';
$plugin_help_url = 'https://github.com/opennetadmin/'.$plug_name.'/wiki';


?>

0 comments on commit c72af97

Please sign in to comment.