4 # This script looks up radsec srv records in DNS for the one
5 # realm given as argument, and creates a server template based
6 # on that. It currently ignores weight markers, but does sort
7 # servers on priority marker, lowest number first.
10 echo "Usage: ${0} <realm>"
14 test -n "${1}" || usage
17 DIGCMD=$(command -v digaaa)
18 HOSTCMD=$(command -v host)
21 ${DIGCMD} +short srv _radsec._tcp.${REALM} | sort -k1 |
23 set $line ; PORT=$3 ; HOST=$4
24 echo "\thost ${HOST%.}:${PORT}"
29 ${HOSTCMD} -t srv _radsec._tcp.${REALM} | sort -k5 |
31 set $line ; PORT=$7 ; HOST=$8
32 echo "\thost ${HOST%.}:${PORT}"
36 if test -x "${DIGCMD}" ; then
38 elif test -x "${HOSTCMD}" ; then
41 echo "${0} requires either \"dig\" or \"host\" command."
45 if test -n "${SERVERS}" ; then
46 echo "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}"