-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for reloading configuration on SIGHUP
Fixes #323.
- Loading branch information
Showing
17 changed files
with
186 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@ IN SOA ns1.example.com. hostmaster 2024080900 1800 900 604800 86400 | ||
IN NS ns1.example.com. | ||
IN NS ns2.example.com. | ||
IN A 192.0.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@ IN SOA ns1.example.net. hostmaster 2024090900 1800 900 604800 86400 | ||
IN NS ns1.example.net. | ||
IN NS ns2.example.net. | ||
IN A 192.0.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
server: | ||
xfrdfile: "xfrd.state" | ||
logfile: "/dev/stderr" | ||
zonesdir: "" | ||
username: "" | ||
chroot: "" | ||
verbosity: 1 | ||
ip-address: 127.0.0.1 | ||
reload-config: yes | ||
|
||
zone: | ||
name: example.com | ||
zonefile: example.com.zone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
server: | ||
xfrdfile: "xfrd.state" | ||
logfile: "/dev/stderr" | ||
zonesdir: "" | ||
username: "" | ||
chroot: "" | ||
verbosity: 1 | ||
ip-address: 127.0.0.1 | ||
reload-config: yes | ||
|
||
zone: | ||
name: example.com | ||
zonefile: example.com.zone | ||
|
||
zone: | ||
name: example.net | ||
zonefile: example.net.zone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
BaseName: reload-config | ||
Version: 1.0 | ||
Description: Test reread of nsd.conf on SIGHUP | ||
CreationDate: Fri Aug 9 13:47:00 CEST 2024 | ||
Maintainer: Jeroen Koekkoek | ||
Category: | ||
Component: | ||
CmdDepends: | ||
Depends: 0000_nsd-compile.tpkg | ||
Help: | ||
Pre: reload-config.pre | ||
Post: reload-config.post | ||
Test: reload-config.test | ||
AuxFiles: | ||
Passed: | ||
Failure: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# #-- reload-config.post --# | ||
# source the master var file when it's there | ||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master | ||
# source the test var file when it's there | ||
[ -f .tpkg.var.test ] && source .tpkg.var.test | ||
# | ||
# do your teardown here | ||
. ../common.sh | ||
|
||
cat nsd.log | ||
|
||
rm -f nsd.log | ||
rm -f xfrd.state | ||
rm -f nsd.zonelist | ||
|
||
if test -f $NSD_PID; then | ||
# the test must have failed | ||
kill_pid `cat $NSD_PID` | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# #-- reload-config.pre --# | ||
# source the master var file when it's there | ||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master | ||
# use .tpkg.var.test for in test variable passing | ||
[ -f .tpkg.var.test ] && source .tpkg.var.test | ||
. ../common.sh | ||
|
||
# start NSD | ||
get_random_port 1 | ||
NSD_PORT=$RND_PORT | ||
|
||
NSD_PID="nsd.pid.$$" | ||
|
||
# share the vars | ||
echo "export NSD_PORT=$NSD_PORT" >> .tpkg.var.test | ||
echo "export NSD_PID=$NSD_PID" >> .tpkg.var.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# #-- reload-config.test --# | ||
# source the master var file when it's there | ||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master | ||
# use .tpkg.var.test for in test variable passing | ||
[ -f .tpkg.var.test ] && source .tpkg.var.test | ||
. ../common.sh | ||
|
||
NSD="../../nsd" | ||
|
||
cp reload-config.1.conf nsd.conf | ||
$NSD -p $NSD_PORT -P $NSD_PID -V 5 -c nsd.conf > nsd.log 2>&1 | ||
wait_nsd_up nsd.log | ||
|
||
dig @127.0.0.1 -p $NSD_PORT example.com. SOA | tee result | ||
if ! grep hostmaster.example.com result; then | ||
echo "zone example.com should be available" >&2 | ||
exit 1 | ||
fi | ||
|
||
dig @127.0.0.1 -p $NSD_PORT example.net. SOA | tee result | ||
if grep hostmaster.example.net result; then | ||
echo "zone example.net should not be available" >&2 | ||
exit 1 | ||
fi | ||
|
||
cp reload-config.2.conf nsd.conf | ||
kill -SIGHUP $(head -n1 ${NSD_PID}) | ||
|
||
wait_logfile nsd.log "zone example.net read" | ||
|
||
dig @127.0.0.1 -p $NSD_PORT example.net. SOA | tee result | ||
if ! grep hostmaster.example.net result; then | ||
echo "zone example.net should be available" >&2 | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters