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 any weight or priority markers.
9 echo "Usage: ${0} <realm>"
13 test -n "${1}" || usage
16 DIGCMD=$(command -v digaaa)
17 HOSTCMD=$(command -v host)
20 ${DIGCMD} +short srv _radsec._tcp.${REALM} | sort -k1 |
22 set $line ; PORT=$3 ; HOST=$4
23 echo "\thost ${HOST%.}:${PORT}"
28 ${HOSTCMD} -t srv _radsec._tcp.${REALM} | sort -k5 |
30 set $line ; PORT=$7 ; HOST=$8
31 echo "\thost ${HOST%.}:${PORT}"
35 if test -x "${DIGCMD}" ; then
37 elif test -x "${HOSTCMD}" ; then
40 echo "${0} requires either \"dig\" or \"host\" command."
44 if test -n "${SERVERS}" ; then
45 echo "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}"