blob: 35bd8942b06363226bdb7f7fa299ed20c9490cec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
#
# kdcrotate This shell script rotates the list of KDCs in /etc/krb5.conf
#
# Author: Based on SysV Init in RHS Linux by Damien Neil
# Written by Nalin Dahyabhai <nalin@redhat.com>
#
# chkconfig: 345 99 01
#
# description: Rotate the list of KDCs listed in /etc/krb5.conf
#
PATH=/sbin:$PATH
# Only run in runlevels where we're 'enabled', which should only be 345.
if [ "$1" != "start" ] ; then
exit 0
fi
# source function library
. /etc/rc.d/init.d/functions
action "Rotating KDC list" "awk ' /^[[:space:]]*kdc[[:space:]]*=/ { \\
if(length(firstkdc) == 0) { \\
firstkdc = \$0; \\
} else { \\
if(length(kdclist) > 0) { \\
kdclist = kdclist ORS; \\
} \\
kdclist = kdclist \$0; \\
} \\
next; \\
} \\
{ \\
if(length(kdclist) > 0) { \\
NEWCONFIG = NEWCONFIG kdclist ORS; \\
} \\
if(length(firstkdc) > 0) { \\
NEWCONFIG = NEWCONFIG firstkdc ORS; \\
} \\
firstkdc = \"\"; \\
kdclist = \"\"; \\
NEWCONFIG = NEWCONFIG \$0 ORS; \\
} \\
END {printf \"%s\", NEWCONFIG > \"/etc/krb5.conf\"}' /etc/krb5.conf"
|