This repository has been archived by the owner on Aug 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will automatically check whether or not a new zonefile is valid, and if it contains the appropriate domain records on every commit (and Pull Request!)
- Loading branch information
1 parent
9961433
commit 9333929
Showing
3 changed files
with
84 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dist: xenial | ||
language: minimal | ||
addons: | ||
apt: | ||
packages: | ||
- bind9 | ||
script: | ||
- /bin/bash verify_domains.sh | ||
- /bin/bash test_zones.sh |
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,58 @@ | ||
#!/bin/bash | ||
#Update script for ".o" on BIND9/Ubuntu 18.04 | ||
|
||
#Variables | ||
TLD='o' | ||
NS='ns11.opennic.glue.' | ||
EMAIL='jonah.opennic.org.' | ||
CHECKZONE=/usr/sbin/named-checkzone | ||
TMP_DEST='db.o-tmp' | ||
WORK_DIR='' | ||
FILE_NAME='db.o' | ||
FILES=${WORK_DIR}zone/* | ||
|
||
# ADD NEW SOA! | ||
{ echo "@ IN SOA $NS $EMAIL (" | ||
echo " `date +%s` ; serial" | ||
echo " 4H ; refresh (4 hours)" | ||
echo " 1H ; retry (1 hour)" | ||
echo " 1W ; expire (1 week)" | ||
echo " 1H ; minimum (1 hour)" | ||
echo " )" | ||
} >> $WORK_DIR$FILE_NAME | ||
|
||
# ADD NAMESERVERS! | ||
{ echo "; TLD information" | ||
echo " IN NS ns11.opennic.glue." | ||
echo " IN NS ns2.opennic.glue." | ||
echo " IN NS ns6.opennic.glue." | ||
echo " IN NS ns8.opennic.glue." | ||
echo ";" | ||
echo "; Additional zones" | ||
echo ";" | ||
} >> $WORK_DIR$FILE_NAME | ||
|
||
|
||
for f in $FILES | ||
do | ||
cp $WORK_DIR$FILE_NAME $TMP_DEST | ||
cat $f >> $TMP_DEST | ||
|
||
TEST=$($CHECKZONE $TLD "$TMP_DEST" | tail -n 1) | ||
if [ "$TEST" != "OK" ]; then | ||
echo "Failed to add ${f}.o to the main zone!" | ||
exit 1 | ||
else | ||
echo "Processed ${f}.o Successfully" | ||
echo "; `git log --oneline -- $f | tail -n 1`" >> $FILE_NAME | ||
cat $f >> $FILE_NAME | ||
fi | ||
|
||
VERIFY=$($CHECKZONE $TLD "$WORK_DIR$FILE_NAME" | tail -n 1) | ||
if [ "$VERIFY" != "OK" ]; then | ||
echo "Some unknown error occured: $WORK_DIR$FILE_NAME" | ||
exit 1 | ||
fi | ||
done | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cd zone | ||
|
||
for f in * | ||
do | ||
while read domain; do | ||
FIRST=`echo "$domain" | awk '{print $1;}'` | ||
if [[ $FIRST == *$f ]]; then | ||
echo $FIRST > /dev/null | ||
else | ||
echo $FIRST | ||
echo "A line in ${f} does not match the domain name!" | ||
exit 1 | ||
fi | ||
done <$f | ||
done | ||
|
||
exit 0 |