Skip to content

Commit

Permalink
Merge pull request #97 from mekanix/feature/unbound
Browse files Browse the repository at this point in the history
Move zone files to separate directory
  • Loading branch information
mekanix authored Nov 19, 2019
2 parents 757ab72 + bf85902 commit 90baaec
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 0 additions & 2 deletions scripts/master-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ dhcp() {
-e "s:MASTER_IP:${MASTER_IP}:g" \
${SCRIPT_DIR}/../templates/master.conf >"${TEMP_MASTER_CONF}"

ZONE_BASE=${DOMAIN}

cbsd jcreate inter=0 jconf="${TEMP_MASTER_CONF}"
echo 'sendmail_enable="NONE"' >"${CBSD_WORKDIR}/jails-data/cbsd-data/etc/rc.conf.d/sendmail"
cp ${SCRIPT_DIR}/../templates/master.fstab "${CBSD_WORKDIR}/jails-fstab/fstab.cbsd.local"
Expand Down
11 changes: 7 additions & 4 deletions scripts/network-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ setup_unbound() {
sed \
-e "s:DOMAIN:${DOMAIN}:g" \
"${SCRIPT_DIR}/../templates/unbound_cbsd.conf" >/var/unbound/conf.d/cbsd.conf
if [ ! -d /var/unbound/zones ]; then
mkdir /var/unbound/zones
fi
sed \
-e "s:DOMAIN:${DOMAIN}:g" \
-e "s:INTERFACE_IP:${INTERFACE_IP}:g" \
"${SCRIPT_DIR}/../templates/unbound_cbsd.zone" >/var/unbound/conf.d/${DOMAIN}.zone
"${SCRIPT_DIR}/../templates/unbound_cbsd.zone" >/var/unbound/zones/${DOMAIN}.zone
cp "${SCRIPT_DIR}/../templates/unbound_control.conf" /var/unbound/control.conf
cp "${SCRIPT_DIR}/../templates/resolvconf.conf" /etc/resolvconf.conf

Expand All @@ -135,7 +138,7 @@ setup_unbound() {
-e "s:DOMAIN:${DOMAIN}:g" \
-e "s:ZONE:${ZONE}:g" \
-e "s:LAST_OCTET:${LAST_OCTET}:g" \
"${SCRIPT_DIR}/../templates/unbound_cbsd_reverse.zone" >"/var/unbound/conf.d/${ZONE}.zone"
"${SCRIPT_DIR}/../templates/unbound_cbsd_reverse.zone" >"/var/unbound/zones/${ZONE}.zone"
sed \
-e "s:ZONE:${ZONE}:g" \
"${SCRIPT_DIR}/../templates/unbound_cbsd_reverse.conf" >>/var/unbound/conf.d/cbsd-reverse.conf
Expand All @@ -146,14 +149,14 @@ setup_unbound() {
-e "s:DOMAIN:${DOMAIN}:g" \
-e "s:ZONE:${ZONE}:g" \
-e "s:LAST_OCTET:${LAST_OCTET}:g" \
"${SCRIPT_DIR}/../templates/unbound_cbsd_reverse.zone" >"/var/unbound/conf.d/${ZONE}.zone"
"${SCRIPT_DIR}/../templates/unbound_cbsd_reverse.zone" >"/var/unbound/zones/${ZONE}.zone"
echo >>/var/unbound/conf.d/cbsd-reverse.conf
sed \
-e "s:ZONE:${ZONE}:g" \
"${SCRIPT_DIR}/../templates/unbound_cbsd_reverse.conf" >>/var/unbound/conf.d/cbsd-reverse.conf

chown -R unbound:unbound /var/unbound
chmod g+w /var/unbound/conf.d /var/unbound/conf.d/*.zone
chmod g+w /var/unbound/conf.d /var/unbound/zones/*.zone
service local_unbound restart
resolvconf -u
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/register.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ ACTION="${1}"
PF_ACTION="add"
DOMAIN=`reggae get-config DOMAIN`

ZONE_FILE="/var/unbound/conf.d/${DOMAIN}.zone"
ZONE_FILE="/var/unbound/zones/${DOMAIN}.zone"
REVERSE_ZONE=`echo ${IP} | awk -F '.' '{print $3 "." $2 "." $1 ".in-addr.arpa"}'`
REVERSE_ZONE_FILE="/var/unbound/conf.d/${REVERSE_ZONE}.zone"
REVERSE_ZONE_FILE="/var/unbound/zones/${REVERSE_ZONE}.zone"
LAST_OCTET=`echo "${IP}" | awk -F '.' '{print $4}'`


Expand Down
4 changes: 2 additions & 2 deletions templates/reggae-register.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ IP=$2
NAME=$3
DOMAIN=$4

ZONE_FILE="/var/unbound/conf.d/${DOMAIN}.zone"
ZONE_FILE="/var/unbound/zones/${DOMAIN}.zone"
REVERSE_ZONE=`echo ${IP} | awk -F '.' '{print $3 "." $2 "." $1 ".in-addr.arpa"}'`
REVERSE_ZONE_FILE="/var/unbound/conf.d/${REVERSE_ZONE}.zone"
REVERSE_ZONE_FILE="/var/unbound/zones/${REVERSE_ZONE}.zone"
LAST_OCTET=`echo "${IP}" | awk -F '.' '{print $4}'`


Expand Down
2 changes: 1 addition & 1 deletion templates/unbound_cbsd.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
auth-zone:
name: "DOMAIN"
zonefile: "conf.d/DOMAIN.zone"
zonefile: "zones/DOMAIN.zone"
2 changes: 1 addition & 1 deletion templates/unbound_cbsd_reverse.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
auth-zone:
name: "ZONE"
zonefile: "conf.d/ZONE.zone"
zonefile: "zones/ZONE.zone"

0 comments on commit 90baaec

Please sign in to comment.