summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2020-02-14 04:23:57 -0600
committerTom Barrett <tom@tombarrett.xyz>2020-02-14 04:23:57 -0600
commit8ca998d9c27188e491761c3b99a222e842d6e44e (patch)
tree4f402bb5e4b7e13e373263f3c1a5d6671794893a
parent814f256f9055fd4c90ef19ffbde3f852f2927939 (diff)
krb5 server and client successfully starts
-rw-r--r--.gitignore2
-rwxr-xr-xcreate4
-rwxr-xr-xdestroy5
-rwxr-xr-xkerberos6
-rw-r--r--logs/.gitignore0
-rwxr-xr-xscripts/debian_roll13
-rwxr-xr-xscripts/kerberos19
7 files changed, 38 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ef2917b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+logs/*
+!logs/.gitignore
diff --git a/create b/create
new file mode 100755
index 0000000..0e40b65
--- /dev/null
+++ b/create
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -e
+
+scripts/kerberos > logs/kerberos
diff --git a/destroy b/destroy
new file mode 100755
index 0000000..5c6cb31
--- /dev/null
+++ b/destroy
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -e
+
+lxc-stop -n kerberos
+lxc-destroy -n kerberos
diff --git a/kerberos b/kerberos
deleted file mode 100755
index 296f7eb..0000000
--- a/kerberos
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-set -e
-
-scripts/debian_roll kerberos
-lxc-attach -n kerberos -v DEBIAN_FRONTEND=noninteractive -- apt-get -y install krb5-admin-server
-scp configs/kerberos/krb5.conf root@???
diff --git a/logs/.gitignore b/logs/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/logs/.gitignore
diff --git a/scripts/debian_roll b/scripts/debian_roll
index 56c5e5b..041baf4 100755
--- a/scripts/debian_roll
+++ b/scripts/debian_roll
@@ -3,7 +3,8 @@ set -e
NAME=$1
USER=tom
-PASS=durr
+PASS=tom
+ROOT_PASS=root
# init
lxc-create -n $NAME -t download -- --dist debian --release buster --arch amd64
@@ -12,11 +13,13 @@ lxc-start -n $NAME
sleep 15
# install basics
-lxc-attach -n $NAME -- apt update
-lxc-attach -n $NAME -- apt dist-upgrade
-lxc-attach -n $NAME -- apt install -y sudo openssh-server x11-xserver-utils
+lxc-attach -n $NAME -- apt-get update
+lxc-attach -n $NAME -- apt-get dist-upgrade
+lxc-attach -n $NAME -- apt-get install -y apt-utils
+lxc-attach -n $NAME -- apt-get install -y sudo openssh-server x11-xserver-utils
-# setup user
+# setup users
+lxc-attach -n $NAME -- bash -c 'echo -e "'$ROOT_PASS'\n'$ROOT_PASS'" | passwd'
lxc-attach -n $NAME -- adduser $USER --gecos "" --disabled-password
lxc-attach -n $NAME -- bash -c 'echo -e "'$PASS'\n'$PASS'" | passwd $USER'
diff --git a/scripts/kerberos b/scripts/kerberos
new file mode 100755
index 0000000..8ecfde4
--- /dev/null
+++ b/scripts/kerberos
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -e
+
+ROOT_PASS=root
+KRB5_PASS=krb5
+
+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/
+
+lxc-attach -n kerberos -- bash -c 'echo -e "'$KRB5_PASS'\n'$KRB5_PASS'" | krb5_newrealm'
+
+lxc-attach -n kerberos -- systemctl restart krb5-admin-server
+lxc-attach -n kerberos -- systemctl restart krb5-kdc