removed bin, moved vdns scripts to their own repo

This commit is contained in:
Matthew Saunders Brown 2024-02-22 15:50:57 -08:00
parent 29cdd5d0eb
commit 88540c4a6c
8 changed files with 0 additions and 301 deletions

View File

@ -1,29 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
/usr/local/sbin/pdns-rr-del.sh -p $thisfilename -h
}
pdns:getoptions "$@"
# check for zone
if [[ -z $zone ]]; then
echo "zone is required"
exit 1
fi
zone_exists=$(/usr/local/bin/vdns-zone-ext.sh -z $zone)
if [[ $zone_exists = "true" ]]; then
/usr/local/sbin/pdns-rr-del.sh $@
else
echo Zone $zone not found.
fi

View File

@ -1,29 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
/usr/local/sbin/pdns-rr-rep.sh -p $thisfilename -h
}
pdns:getoptions "$@"
# check for zone
if [[ -z $zone ]]; then
echo "zone is required"
exit 1
fi
zone_exists=$(/usr/local/bin/vdns-zone-ext.sh -z $zone)
if [[ $zone_exists = "true" ]]; then
/usr/local/sbin/pdns-rr-rep.sh "$@"
else
echo Zone $zone not found.
fi

View File

@ -1,35 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
echo "Add new zone to DNS"
echo ""
echo "usage: $thisfilename -z <zone> [-h]"
echo ""
echo " -h Print this help."
echo " -z <zone> Zone (domain name) to add."
}
pdns:getoptions "$@"
# check for zone
if [[ -z $zone ]]; then
echo "zone is required"
exit 1
fi
zone_exists=$(/usr/local/sbin/pdns-zone-ext.sh -z $zone)
if [[ $zone_exists = "true" ]]; then
echo Zone $zone already exists.
exit 1
else
/usr/local/sbin/pdns-zone-add.sh -z $zone -w hostname=$hostname/$zone
fi

View File

@ -1,60 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
echo "Show default records for given domain."
echo ""
echo "usage: $thisfilename -z <zone> [-c] [-h]"
echo ""
echo " -h Print this help."
echo " -z <zone> Zone (domain name) to display default records for."
echo " -c Output in csv format instead of columns."
}
pdns:getoptions "$@"
# check for zone
if [[ -z $zone ]]; then
echo "zone is required"
exit 1
fi
output="name,type,content"
# add SOA to output
output="$output\n$zone,SOA,$zone_default_ns $zone_defaults_mbox $serial $zone_defaults_refresh $zone_defaults_retry $zone_defaults_expire $zone_defaults_minimum"
# add each additiona record to output
for record in "${default_records[@]}"; do
# replace @ with zone
record=$(echo ${record} | sed -e "s/@/$zone/g")
# turn record row info in to array
orig_ifs="$IFS"
IFS='|'
read -r -a recordArray <<< "$record"
IFS="$orig_ifs"
# extract record info from array
rr_name=${recordArray[0]}
rr_type=${recordArray[1]}
rr_content=${recordArray[2]}
if [[ $rr_type = TXT ]]; then
rr_content="\"$rr_content\""
fi
output="$output\n$rr_name,$rr_type,$rr_content"
done
if [[ $csv ]]; then
echo -e $output
else
echo -e $output | column -t -s ,
fi

View File

@ -1,29 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
/usr/local/sbin/pdns-zone-del.sh -p $thisfilename -h
}
pdns:getoptions "$@"
# check for zone
if [[ -z $zone ]]; then
echo "zone is required"
exit 1
fi
zone_exists=$(/usr/local/bin/vdns-zone-ext.sh -z $zone)
if [[ $zone_exists = "true" ]]; then
/usr/local/sbin/pdns-zone-del.sh $@
else
echo Zone $zone not found.
fi

View File

@ -1,29 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
/usr/local/sbin/pdns-zone-exp.sh -p $thisfilename -h
}
pdns:getoptions "$@"
# check for zone
if [[ -z $zone ]]; then
echo "zone is required"
exit 1
fi
zone_exists=$(/usr/local/bin/vdns-zone-ext.sh -z $zone)
if [[ $zone_exists = "true" ]]; then
/usr/local/sbin/pdns-zone-exp.sh $@
else
echo Zone $zone not found.
fi

View File

@ -1,38 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
echo "Check if Zone exists (and is associated with this server)."
echo ""
echo "usage: $thisfilename -z <zone> [-h]"
echo ""
echo " -h Print this help."
echo " -z <zone> Zone (domain name) check."
}
pdns:getoptions "$@"
# check for zone
if [[ -z $zone ]]; then
echo "zone is required"
exit 1
fi
SEARCH=($(/usr/local/bin/vdns-zone-lst.sh -q $zone))
if [[ ${#SEARCH[@]} = 2 ]]; then
if [[ "${SEARCH[1]}" = $zone ]]; then
echo true
exit 0
fi
fi
echo false
exit 1

View File

@ -1,52 +0,0 @@
#!/bin/bash
#
# pdns-tools
# https://git.stack-source.com/msb/pdns-tools
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source /usr/local/sbin/pdns.sh
help()
{
echo "List Zones exists that are in DNS and associated with this server."
echo ""
echo "usage: $thisfilename [-q <query>] [-h]"
echo ""
echo " -h Print this help."
echo " -q <query> Optional search term."
echo " Can be a domain, or a partial string with * for wildcard."
echo " If using wildcard put the query in single quotes. e.g.:"
echo " $thisfilename (returns all domains)."
echo " $thisfilename -q example.com (returns domain example.com, if found)."
echo " $thisfilename -q '*example*' (returns any domain with example as part of the name)."
}
pdns:getoptions "$@"
if [[ -z $query ]]; then
query=*
fi
SEARCH=($(/usr/local/sbin/pdns-search.sh -q hostname=$hostname/$query -c))
# check for header row output, this indicates one or more results were found
if [[ "${SEARCH[0]}" = "content,name,object_type,type,zone,zone_id" ]]; then
# sort results
readarray -td '' SORTED < <(printf '%s\0' "${SEARCH[@]}" | sort -z)
# echo header and remove header row
echo zone
# check each row to verify data and output zone (domain) if it validates
for ROW in "${SORTED[@]}"; do
# turn row into array
readarray -d , -t row_array < <(echo $ROW)
# get zone, strip ending dot
zone=$(sed 's/.$//' <<< "${row_array[4]}")
# compare row to expected/valid result
if [[ $ROW = "hostname=$hostname/$zone,$zone.,comment,SOA,$zone.,$zone." ]]; then
# got a match
echo $zone
fi
done
fi