|
cvsdist |
af3b546 |
#!/bin/sh
|
|
cvsdist |
af3b546 |
#
|
|
cvsdist |
af3b546 |
# kdcrotate This shell script rotates the list of KDCs in /etc/krb5.conf
|
|
cvsdist |
af3b546 |
#
|
|
cvsdist |
af3b546 |
# Author: Based on SysV Init in RHS Linux by Damien Neil
|
|
cvsdist |
af3b546 |
# Written by Nalin Dahyabhai <nalin@redhat.com>
|
|
cvsdist |
af3b546 |
#
|
|
cvsdist |
af3b546 |
# chkconfig: 345 99 01
|
|
cvsdist |
af3b546 |
#
|
|
cvsdist |
af3b546 |
# description: Rotate the list of KDCs listed in /etc/krb5.conf
|
|
cvsdist |
af3b546 |
#
|
|
cvsdist |
af3b546 |
|
|
cvsdist |
af3b546 |
PATH=/sbin:$PATH
|
|
cvsdist |
af3b546 |
|
|
cvsdist |
af3b546 |
# Only run in runlevels where we're 'enabled', which should only be 345.
|
|
cvsdist |
af3b546 |
if [ "$1" != "start" ] ; then
|
|
cvsdist |
af3b546 |
exit 0
|
|
cvsdist |
af3b546 |
fi
|
|
cvsdist |
af3b546 |
|
|
cvsdist |
af3b546 |
# source function library
|
|
cvsdist |
af3b546 |
. /etc/rc.d/init.d/functions
|
|
cvsdist |
af3b546 |
|
|
cvsdist |
af3b546 |
action "Rotating KDC list" "awk ' /^[[:space:]]*kdc[[:space:]]*=/ { \\
|
|
cvsdist |
af3b546 |
if(length(firstkdc) == 0) { \\
|
|
cvsdist |
af3b546 |
firstkdc = \$0; \\
|
|
cvsdist |
af3b546 |
} else { \\
|
|
cvsdist |
af3b546 |
if(length(kdclist) > 0) { \\
|
|
cvsdist |
af3b546 |
kdclist = kdclist ORS; \\
|
|
cvsdist |
af3b546 |
} \\
|
|
cvsdist |
af3b546 |
kdclist = kdclist \$0; \\
|
|
cvsdist |
af3b546 |
} \\
|
|
cvsdist |
af3b546 |
next; \\
|
|
cvsdist |
af3b546 |
} \\
|
|
cvsdist |
af3b546 |
{ \\
|
|
cvsdist |
af3b546 |
if(length(kdclist) > 0) { \\
|
|
cvsdist |
af3b546 |
NEWCONFIG = NEWCONFIG kdclist ORS; \\
|
|
cvsdist |
af3b546 |
} \\
|
|
cvsdist |
af3b546 |
if(length(firstkdc) > 0) { \\
|
|
cvsdist |
af3b546 |
NEWCONFIG = NEWCONFIG firstkdc ORS; \\
|
|
cvsdist |
af3b546 |
} \\
|
|
cvsdist |
af3b546 |
firstkdc = \"\"; \\
|
|
cvsdist |
af3b546 |
kdclist = \"\"; \\
|
|
cvsdist |
af3b546 |
NEWCONFIG = NEWCONFIG \$0 ORS; \\
|
|
cvsdist |
af3b546 |
} \\
|
|
cvsdist |
af3b546 |
END {printf \"%s\", NEWCONFIG > \"/etc/krb5.conf\"}' /etc/krb5.conf"
|