summaryrefslogtreecommitdiff
path: root/scripts/krb
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/krb')
-rwxr-xr-xscripts/krb23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/krb b/scripts/krb
new file mode 100755
index 0000000..4df7fef
--- /dev/null
+++ b/scripts/krb
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -e
+
+ROOT_PASS=root
+KRB5_PASS=krb5
+KRB5_ADMIN_PASS=pass
+USER_PASS=tommie
+IP="$(grep krb configs/hosts | cut -d ' ' -f 1)"
+
+scripts/debian_roll krb
+lxc-attach krb -v DEBIAN_FRONTEND=noninteractive -- apt-get -y install krb5-admin-server
+
+scp configs/krb/krb5.conf root@$IP:/etc/
+scp configs/krb/kdc.conf root@$IP:/etc/krb5kdc/
+scp configs/krb/kadm5.acl root@$IP:/etc/krb5kdc/
+
+lxc-attach krb -- bash -c 'echo -e "'$KRB5_PASS'\n'$KRB5_PASS'" | krb5_newrealm'
+lxc-attach krb -- bash -c 'echo -e "'$KRB5_ADMIN_PASS'\n'$KRB5_ADMIN_PASS'" | kadmin.local addprinc root/admin'
+
+lxc-attach krb -- systemctl restart krb5-admin-server
+lxc-attach krb -- systemctl restart krb5-kdc
+
+lxc-attach --clear-env krb -- bash -c 'echo -e "'$KRB5_ADMIN_PASS'\n'$USER_PASS'\n'$USER_PASS'\n" | kadmin addprinc tom'