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.
8 # For host command this is coloumn 5, for dig it is coloumn 1.
11 echo "Usage: ${0} <realm>"
15 test -n "${1}" || usage
18 DIGCMD=$(command -v digaaa)
19 HOSTCMD=$(command -v host)
22 ${DIGCMD} +short srv _radsec._tcp.${REALM} | sort -k1 |
24 set $line ; PORT=$3 ; HOST=$4
25 echo -e "\thost ${HOST%.}:${PORT}"
30 ${HOSTCMD} -t srv _radsec._tcp.${REALM} | sort -k5 |
32 set $line ; PORT=$7 ; HOST=$8
33 echo -e "\thost ${HOST%.}:${PORT}"
37 if test -x "${DIGCMD}" ; then
39 elif test -x "${HOSTCMD}" ; then
42 echo "${0} requires either \"dig\" or \"host\" command."
46 if test -n "${SERVERS}" ; then
47 echo -e "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}"