summaryrefslogtreecommitdiff
path: root/scripts/krb
blob: 4df7fefe8b567d7f1a9a1b10b5f3e79f97298a05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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'