summaryrefslogtreecommitdiff
path: root/radsec-dynsrv.sh
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2010-05-28 15:32:31 +0200
committerLinus Nordberg <linus@nordberg.se>2010-05-28 15:32:31 +0200
commitdaf4ee8837407d6e1194eab86caf47a9bf9faa34 (patch)
tree114abbbbc7a65390638b746871016eaddb68d91e /radsec-dynsrv.sh
parentea4f850a2412df8bc4618b98350c2f961d8202ae (diff)
Create tools/ directory and move shell scripts there.
Diffstat (limited to 'radsec-dynsrv.sh')
-rwxr-xr-xradsec-dynsrv.sh51
1 files changed, 0 insertions, 51 deletions
diff --git a/radsec-dynsrv.sh b/radsec-dynsrv.sh
deleted file mode 100755
index 7a74b6d..0000000
--- a/radsec-dynsrv.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#! /bin/bash
-
-# Example script!
-# This script looks up radsec srv records in DNS for the one
-# realm given as argument, and creates a server template based
-# on that. It currently ignores weight markers, but does sort
-# servers on priority marker, lowest number first.
-# For host command this is coloumn 5, for dig it is coloumn 1.
-
-usage() {
- echo "Usage: ${0} <realm>"
- exit 1
-}
-
-test -n "${1}" || usage
-
-REALM="${1}"
-DIGCMD=$(command -v digaaa)
-HOSTCMD=$(command -v host)
-
-dig_it() {
- ${DIGCMD} +short srv _radsec._tcp.${REALM} | sort -k1 |
- while read line ; do
- set $line ; PORT=$3 ; HOST=$4
- echo -e "\thost ${HOST%.}:${PORT}"
- done
-}
-
-host_it() {
- ${HOSTCMD} -t srv _radsec._tcp.${REALM} | sort -k5 |
- while read line ; do
- set $line ; PORT=$7 ; HOST=$8
- echo -e "\thost ${HOST%.}:${PORT}"
- done
-}
-
-if test -x "${DIGCMD}" ; then
- SERVERS=$(dig_it)
-elif test -x "${HOSTCMD}" ; then
- SERVERS=$(host_it)
-else
- echo "${0} requires either \"dig\" or \"host\" command."
- exit 1
-fi
-
-if test -n "${SERVERS}" ; then
- echo -e "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}"
- exit 0
-fi
-
-exit 0