Skip to content

Commit c72af97

Browse files
committed
allow for dedicated .conf file, remove old sys_build user, update documenation link
1 parent 8a885a6 commit c72af97

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ Install
1818
* Click the install icon for the plugin which should be listed by the plugin name
1919
* Follow any instructions it prompts you with.
2020
* 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
21-
* Modify the variables at the top of the build_dhcpd script to suit your environment.
21+
* 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.
22+
* 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.
2223

2324
Usage
2425
-----
2526
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.
2627

27-
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".
28+
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".
2829

2930
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.
3031

31-
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.
32+
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.
3233

33-
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:
34+
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`
35+
or better yet, add the following to `/opt/ona/etc/build_dhcpd.conf` with adjusted options as needed:
3436
# this will default to placing data files in /opt/ona/etc/dhcpd, you can update the following for your system as needed
3537
# for things like chroot jails etc
3638
ONA_PATH="${ONABASE}/etc/dhcpd"
@@ -40,8 +42,7 @@ There are a few configuration options in the build script that should be examine
4042
SRV_FQDN=`hostname -f`
4143

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

4647
# For now a path is required to a default header.
4748
# this will have things like the authoritative statement,ddns-update-style, and other required options

build_dhcpd

+10-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@
7575
#
7676
# include "/opt/ona/etc/dhcpd/dhcpd.conf.ona";
7777
#
78-
# You will need to execute the following dcm command to automatically create the appropriate module entries:
79-
#
8078
# NOTE: Some distros use the Linux Terminal Server Project (LTSP) version of dhcp config file instead, be aware of that.
8179
# 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.
8280
#
@@ -88,6 +86,10 @@
8886
[ ! -r /etc/onabase ] && echo "[$0] ERROR: Unable to read /etc/onabase." && exit 1
8987
ONABASE=`cat /etc/onabase`
9088

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

128+
########## END Configuration ####################
126129

127130
###################### No need to change anything below here ################################
131+
# Pull in the config file if there is one
132+
if [ -f $ONABASE/etc/build_dhcpd.conf ]
133+
then
134+
. $ONABASE/etc/build_dhcpd.conf
135+
fi
128136

129137
# This will log a message in a standardized way
130138
# Its job is simple.. take the message that was passed in and log it via some mechanism.

install.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
$window['html'] .= "<br><b>Disabling install script:</b><br>";
187187
// If there were no errors, move this install file out of the way.
188188
if (!$stat) {
189-
$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>";
189+
$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>";
190190
} else {
191191
$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>";
192192

install.sql

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11

2-
insert into users (id, username, password, level) values ('', 'sys_build', '638c0b71a1677183e7840ae6b5b646a2', 0 ) on duplicate key update username='sys_build';
3-
42
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';

plugin_info.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
/*
33
Your plugin must have a short description and a version number
44
*/
5+
$plug_name = basename(dirname(__FILE__));
56

67
$plugin_description = 'Build ISC DHCP server configurations.';
7-
$plugin_version = '1.4';
8-
$plugin_help_url = 'http://opennetadmin.com/docs/plugins/build_isc_dhcp';
8+
$plugin_version = '1.5';
9+
$plugin_help_url = 'https://github.com/opennetadmin/'.$plug_name.'/wiki';
910

1011

1112
?>

0 commit comments

Comments
 (0)