diff --git a/bin/vdns-rr-del.sh b/bin/vdns-rr-del.sh deleted file mode 100755 index fbfa61e..0000000 --- a/bin/vdns-rr-del.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 diff --git a/bin/vdns-rr-rep.sh b/bin/vdns-rr-rep.sh deleted file mode 100755 index e277e33..0000000 --- a/bin/vdns-rr-rep.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 diff --git a/bin/vdns-zone-add.sh b/bin/vdns-zone-add.sh deleted file mode 100755 index c55f87d..0000000 --- a/bin/vdns-zone-add.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 [-h]" - echo "" - echo " -h Print this help." - echo " -z 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 diff --git a/bin/vdns-zone-def.sh b/bin/vdns-zone-def.sh deleted file mode 100755 index c0ffc78..0000000 --- a/bin/vdns-zone-def.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 [-c] [-h]" - echo "" - echo " -h Print this help." - echo " -z 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 diff --git a/bin/vdns-zone-del.sh b/bin/vdns-zone-del.sh deleted file mode 100755 index abea185..0000000 --- a/bin/vdns-zone-del.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 diff --git a/bin/vdns-zone-exp.sh b/bin/vdns-zone-exp.sh deleted file mode 100755 index a178fbb..0000000 --- a/bin/vdns-zone-exp.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 diff --git a/bin/vdns-zone-ext.sh b/bin/vdns-zone-ext.sh deleted file mode 100755 index 22f8d3d..0000000 --- a/bin/vdns-zone-ext.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 [-h]" - echo "" - echo " -h Print this help." - echo " -z 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 diff --git a/bin/vdns-zone-lst.sh b/bin/vdns-zone-lst.sh deleted file mode 100755 index 302d45b..0000000 --- a/bin/vdns-zone-lst.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# pdns-tools -# https://git.stack-source.com/msb/pdns-tools -# Copyright (c) 2024 Matthew Saunders Brown -# 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 ] [-h]" - echo "" - echo " -h Print this help." - echo " -q 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