forked from cloudera/director-scripts
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall_mit_kdc.sh
executable file
·87 lines (70 loc) · 2.05 KB
/
install_mit_kdc.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
trap exit ERR
yum -y install krb5-server rng-tools
function svcctl() {
if which systemctl 2>/dev/null
then
systemctl $@
else
if [ "$1" = "enable" ]
then
chkconfig $2 on
else
service $2 $1
fi
fi
}
grep rdrand /proc/cpuinfo || echo 'EXTRAOPTIONS="-r /dev/urandom"' >> /etc/sysconfig/rngd
svcctl start rngd
REALM=HADOOPSECURITY.LOCAL
PRIVATE_IP=$(hostname -I)
cp -f /etc/krb5.conf{,.original}
cat - >/etc/krb5.conf <<EOF
[libdefaults]
default_realm = ${REALM:?}
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
default_tgs_enctypes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 arcfour-hmac-md5
default_tkt_enctypes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 arcfour-hmac-md5
permitted_enctypes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96 arcfour-hmac-md5
[realms]
${REALM:?} = {
kdc = ${PRIVATE_IP:?}
admin_server = ${PRIVATE_IP:?}
}
EOF
mv /var/kerberos/krb5kdc/kadm5.acl{,.original}
cat - >/var/kerberos/krb5kdc/kadm5.acl <<EOF
*/admin@${REALM:?} *
EOF
mv /var/kerberos/krb5kdc/kdc.conf{,.original}
cat - >/var/kerberos/krb5kdc/kdc.conf <<EOF
[kdcdefaults]
kdc_ports = 88
kdc_tcp_ports = 88
[realms]
${REALM:?} = {
acl_file = /var/kerberos/krb5kdc/kadm5.acl
dict_file = /usr/share/dict/words
admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
supported_enctypes = aes256-cts-hmac-sha1-96:normal aes128-cts-hmac-sha1-96:normal arcfour-hmac-md5:normal
max_renewable_life = 7d
}
EOF
kdb5_util create -P Passw0rd!
svcctl start krb5kdc
svcctl enable krb5kdc
svcctl start kadmin
svcctl enable kadmin
svcctl stop iptables || :
# use this technique instead of kadmin.local addprinc -pw ... because
# the version of kadmin.local on CentOS6 doesn't allow for passing
# commands in directly.
echo -e 'addprinc -pw Passw0rd! cm/admin\nexit' | kadmin.local
echo -e 'addprinc -pw Cloudera1 cdsw\nexit' | kadmin.local
# Ensure that selinux is turned off now and at reboot
setenforce 0
sed -i 's/SELINUX=.*/SELINUX=permissive/' /etc/selinux/config