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 dig)
19 HOSTCMD=$(command -v host)
22 ${DIGCMD} +short srv $SRV_HOST | sort -k1 |
24 set $line ; PORT=$3 ; HOST=$4
25 echo -e "\thost ${HOST%.}:${PORT}"
30 ${DIGCMD} +short naptr ${REALM} | grep x-eduroam:radius.tls | sort -k1 |
32 set $line ; TYPE=$3 ; HOST=$6
33 if [ "$TYPE" == "\"s\"" ]; then {
40 ${HOSTCMD} -t srv $SRV_HOST | sort -k5 |
42 set $line ; PORT=$7 ; HOST=$8
43 echo -e "\thost ${HOST%.}:${PORT}"
48 ${HOSTCMD} -t naptr ${REALM} | grep x-eduroam:radius.tls | sort -k5 |
50 set $line ; TYPE=$7 ; HOST=${10}
51 if [ "$TYPE" == "\"s\"" ]; then {
58 if test -x "${DIGCMD}" ; then
59 SERVERS=$(dig_it_naptr)
60 elif test -x "${HOSTCMD}" ; then
61 SERVERS=$(host_it_naptr)
63 echo "${0} requires either \"dig\" or \"host\" command."
67 if test -n "${SERVERS}" ; then
68 echo -e "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}"