summaryrefslogtreecommitdiff
path: root/scripts/kerberos
blob: 0fb455d743a3a6cb285bfe39f4a3ab6b9776167b (plain)
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
#!/bin/bash
set -e

ROOT_PASS=root
KRB5_PASS=krb5
KRB5_ADMIN_PASS=pass

scripts/debian_roll kerberos
lxc-attach -n kerberos -v DEBIAN_FRONTEND=noninteractive -- apt-get -y install krb5-admin-server

IP="$(lxc-info -n kerberos | grep IP | tr -s ' ' | cut -d ' ' -f 2)"

sshpass -p $ROOT_PASS ssh-copy-id -o "StrictHostKeyChecking=no" root@$IP
scp configs/kerberos/krb5.conf root@$IP:/etc/
scp configs/kerberos/kdc.conf root@$IP:/etc/krb5kdc/
scp configs/kerberos/kadm5.acl root@$IP:/etc/krb5kdc/
scp configs/kerberos/interfaces root@$IP:/etc/network/
scp configs/hosts root@$IP:/etc/

lxc-attach -n kerberos -- bash -c 'echo -e "'$KRB5_PASS'\n'$KRB5_PASS'" | krb5_newrealm'
lxc-attach -n kerberos -- bash -c 'echo -e "'$KRB5_ADMIN_PASS'\n'$KRB5_ADMIN_PASS'" | kadmin.local addprinc root/admin'

lxc-attach -n kerberos -- systemctl restart networking
lxc-attach -n kerberos -- systemctl restart krb5-admin-server
lxc-attach -n kerberos -- systemctl restart krb5-kdc