No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / packages / debian / heimdal-kdc.postinst
blob72e7af5b6fb9548fec2e24ec6cc6d8562e6adeec
1 #!/bin/sh -e
3 . /usr/share/debconf/confmodule
5 if [ ! -f /var/log/heimdal-kdc.log ]
6 then
7 touch /var/log/heimdal-kdc.log
8 chmod 600 /var/log/heimdal-kdc.log
9 fi
11 add_servers() {
12 kadmin_entry="kerberos-adm stream tcp nowait root /usr/sbin/tcpd /usr/lib/heimdal-servers/kadmind"
13 hprop_entry="#krb_prop stream tcp nowait root /usr/sbin/tcpd /usr/sbin/hpropd"
15 update-inetd --group KRB5 --add "$kadmin_entry"
16 update-inetd --group KRB5 --add "$hprop_entry"
19 enable_servers() {
20 update-inetd --pattern '[ \t]/usr/lib/heimdal-servers/kadmind' --enable kerberos-adm
23 # if not configured, try moving existing configuration
24 if [ ! -f /etc/heimdal-kdc/.configured ] &&
25 [ -f /var/lib/heimdal-kdc/.configured ]
26 then
27 for i in kdc.conf kadmind.acl
29 if [ -f /var/lib/heimdal-kdc/$i ]
30 then
31 mv /var/lib/heimdal-kdc/$i /etc/heimdal-kdc/$i
33 done
34 mv /var/lib/heimdal-kdc/.configured /etc/heimdal-kdc/.configured
37 # if already configured - dont reconfigure
38 if [ ! -f /etc/heimdal-kdc/.configured ]
39 then
40 # get default realm
41 # should use krb5-config setting???
42 if db_get krb5-config/default_realm && [ "x$RET" != "x" ]
43 then
44 default_realm="$RET"
45 else
46 default_realm="`hostname -d | tr a-z A-Z`"
48 db_fget heimdal/realm seen
49 if [ "$RET" != "true" ]; then
50 db_set heimdal/realm "$default_realm"
52 db_subst heimdal/realm default_realm "$default_realm"
53 db_input medium heimdal/realm || true
54 db_go
55 db_get heimdal/realm; REALM="$RET"
57 # get password
58 db_input medium heimdal-kdc/password || true
59 db_go
60 db_get heimdal-kdc/password; PASSWORD="$RET"
61 db_set heimdal-kdc/password ""
63 DST=/etc/heimdal-kdc/kdc.conf
64 cp -a /usr/share/doc/heimdal-kdc/examples/kdc.conf "$DST"
65 # /usr/lib/heimdal-kdc/setconfig --file "$DST" --section realms::REALM.ORG "=$REALM"
67 DST=/etc/heimdal-kdc/kadmind.acl
68 cp -a /usr/share/doc/heimdal-kdc/examples/kadmind.acl "$DST"
70 kstash --master-key-fd=0 <<EOF
71 $PASSWORD
72 EOF
74 echo -e "\n\n" | kadmin -l init "$REALM" > /dev/null
76 touch /etc/heimdal-kdc/.configured
79 case "$1" in
80 abort-upgrade | abort-deconfigure | abort-remove)
82 configure)
83 if [ -z "$2" ]
84 then
85 add_servers
86 elif dpkg --compare-versions "$2" le "0.7.2.dfsg.1-6"
87 then
88 enable_servers
92 printf "$0: incorrect arguments: $*\n" >&2
93 exit 1
95 esac
98 #DEBHELPER#