dockerFiles/kerberos/start.sh

41 lines
928 B
Bash
Raw Normal View History

2022-07-15 13:19:10 +00:00
#!/bin/bash
2022-07-15 15:42:47 +00:00
FQDN="test.com"
2022-07-15 13:19:10 +00:00
ADMIN="admin"
2022-07-15 15:42:47 +00:00
PASS="Admin12!"
2022-07-15 13:19:10 +00:00
KRB5_KTNAME=/etc/admin.keytab
cat /etc/hosts
echo "hostname: ${FQDN}"
2022-07-15 15:42:47 +00:00
inited="/app/inited"
function init_user() {
if [ -f "${inited}" ];then
echo "user inited"
return;
fi
echo "begin init user"
# create kerberos database
echo -e "${PASS}\n${PASS}" | kdb5_util create -s
# create admin
echo -e "${PASS}\n${PASS}" | kadmin.local -q "addprinc ${ADMIN}/admin"
# create hadoop
echo -e "${PASS}\n${PASS}" | kadmin.local -q "addprinc hadoop"
echo -e "${PASS}\n${PASS}" | kadmin.local -q "addprinc hadoop/${FQDN}"
kadmin.local -q "ktadd -norandkey -k ${KRB5_KTNAME} hadoop"
kadmin.local -q "ktadd -norandkey -k ${KRB5_KTNAME} hadoop/${FQDN}"
kadmin.local -q "xst -k /app/hadoop.keytab -norandkey hadoop/${FQDN}"
touch "${inited}"
echo "user inite success"
}
function main() {
init_user
/usr/local/bin/supervisord -n -c /etc/supervisord.conf
}
main