Skip to content
Snippets Groups Projects
Commit 202d3716 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add search for custom ttls

parent af8b46e4
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/bash
# ======================================================================
#
# INFOBLOX HELPER
# show all hosts that override the default TTL
#
# ----------------------------------------------------------------------
# 2022-09-14 v1.0 <axel.hahn@iml.unibe.ch> initial version
# ======================================================================
_version="1.0"
# ----------------------------------------------------------------------
# HELP
# ----------------------------------------------------------------------
if [ -z "$1" ] || [ "$1" = "-h" ]; then
cat <<EOH
>>>>>>>>>> INFOBLOX DNS HELPER: TTL v$_version
Search for hostnames in Infoblox API and show all hosts that have an
activated custom ttl value.
It uses dns-api.sh and adds the return field for aliases.
SYNTAX: dns-search.sh REGEX
REGEX string search string for a hostname.
Use a dot . to scan all hosts you are allowed to access
EOH
exit 0
fi
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
mysearch=$1
>&2 echo ";"
>&2 echo "; >>>>>>>>>> INFOBLOX DNS HELPER TTL v$_version"
>&2 echo ";"
"$( dirname $0 )"/dns-api.sh GET "/record:host?name~=${mysearch}&_return_fields%2B=ttl,use_ttl" \
| jq -r '.[] | select ( .use_ttl == true and .ttl != null and .ttl > 0 and .ttl < 86400 ) | .name,.ttl'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment