setup user, pass, ssh, etc
authorIan Kelling <ian@iankelling.org>
Sun, 17 Jan 2016 07:55:01 +0000 (23:55 -0800)
committerIan Kelling <ian@iankelling.org>
Mon, 6 Feb 2017 06:21:40 +0000 (22:21 -0800)
fai-redep
fai/config/class/50-host-classes
fai/config/class/FAIBASE.var
fai/config/distro-install-common/end [new file with mode: 0755]
fai/config/scripts/DEMO/10-misc [deleted file]
fai/config/scripts/GRUB_PC/11-ian [new file with mode: 0755]

index 64368e420fab64767893b1970a66dae2b8995819..935e96c5af2b696ac375b70ab6ff00f4d8962250 100755 (executable)
--- a/fai-redep
+++ b/fai-redep
@@ -8,11 +8,19 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
 
 ssh root@faiserver rm -rf /srv/fai/config/\*
 scp -r /a/bin/fai/fai/config root@faiserver:/srv/fai
-ssh root@faiserver tee -a /srv/fai/config/class/DESKTOP.var <<EOF
+# fai example pass: fai
+#ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
+
+# generating a hashed password:
+# under debian, you can do
+# echo "yoursecrectpassword" | mkpasswd -m sha-512 -s
+# On arch, best seems to be copy your shadow file to a temp location,
+# then passwd, get out the new pass, then copy the shadow file back.
+ssh root@faiserver tee -a /srv/fai/config/class/DEFAULT.var <<EOF
 ROOTPW='$(cat /p/shadow/standard)'
 EOF
 scp ~/.ssh/id_rsa.pub \
-    root@faiserver:/srv/fai/config/files/home/ian/.ssh/authorized_keys/DESKTOP
+    root@faiserver:/srv/fai/config/files/home/ian/.ssh/authorized_keys/GRUB_PC
 s scp -r /q/root/luks root@faiserver:/srv/fai/config/distro-install-common
 ssh root@faiserver chmod -R a+r /srv/fai/config/distro-install-common
 
index 0922b2f710f84c351607117e3c25d0b46420d037..f7bda8a1afeda876c5d3391733247cc22cb80bda 100755 (executable)
@@ -9,8 +9,8 @@
 case $HOSTNAME in
     faiserver)
         echo "FAIBASE DEBIAN DEMO FAISERVER" ;;
-    demohost|client*)
-        echo "FAIBASE DEBIAN DEMO" ;;
+    demohost)
+        echo "FAIBASE DEBIAN" ;;
     xfcehost)
         echo "FAIBASE DEBIAN DEMO XORG XFCE LVM";;
     gnomehost)
@@ -29,3 +29,8 @@ case $HOSTNAME in
     *)
         echo "FAIBASE DEBIAN" ;;
 esac
+
+if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
+    # if our eth0 mac is in the kvm range, we are a vm.
+    echo "VM"
+fi
index 7f0684e21941b81b74f3302a79233cb2b3e0ba5d..f02f58a307f5351e62ebafc395bf8fe89f4c0164 100644 (file)
@@ -10,10 +10,6 @@ UTC=yes
 ## changed from upstream. found in /usr/share/zoneinfo/, via fai-guide
 TIMEZONE=US/Pacific
 
-# the hash of the root password for the new installed linux system
-# pw is "fai"
-ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
-
 # errors in tasks greater than this value will cause the installation to stop
 STOP_ON_ERROR=700
 
diff --git a/fai/config/distro-install-common/end b/fai/config/distro-install-common/end
new file mode 100755 (executable)
index 0000000..666b781
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash -x
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
+
+
+
+
+# based on unison error, with 8192 from
+# sysctl -a | grep fs.inotify.max_user_watches
+#http://stackoverflow.com/questions/535768/what-is-a-reasonable-amount-of-inotify-watches-with-linux
+echo "fs.inotify.max_user_watches = 1000000" >> $target/etc/sysctl.d/99-sysctl.conf
+# if we weren't rebooting, you could apply it now with:
+# sysctl --system
+
+echo 'ian  ALL=(ALL)  NOPASSWD: ALL' >> $target/etc/sudoers
diff --git a/fai/config/scripts/DEMO/10-misc b/fai/config/scripts/DEMO/10-misc
deleted file mode 100755 (executable)
index 45f0573..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#! /bin/bash
-
-# (c) Thomas Lange, 2001-2013, lange@debian.org
-
-error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
-
-ifclass XORG && {
-    fcopy -M /etc/X11/xorg.conf
-}
-
-if ifclass UBUNTU; then
-     groups="adm cdrom sudo dip plugdev lpadmin sambashare"
-     $ROOTCMD addgroup --system lpadmin || true
-     $ROOTCMD addgroup --system sambashare || true
-fi
-
-# add a demo user account
-if ! $ROOTCMD getent passwd demo ; then
-    $ROOTCMD adduser --disabled-login --gecos "fai demo user" demo
-    $ROOTCMD usermod -p "$ROOTPW" demo
-    for g in $groups; do
-       $ROOTCMD adduser demo $g
-    done
-fi
diff --git a/fai/config/scripts/GRUB_PC/11-ian b/fai/config/scripts/GRUB_PC/11-ian
new file mode 100755 (executable)
index 0000000..24a10ae
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash -x
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
+
+$ROOTCMD adduser --disabled-password --gecos ian ian
+$ROOTCMD usermod -p "$ROOTPW" ian
+
+/var/lib/fai/config/distro-install-common/end
+
+fcopy -r -m 1000,1000,700 -i /home/ian/.ssh
+
+# the defaults in wheezy
+$ROOTCMD usermod -aG cdrom,floppy,sudo,audio,dip,video,plugdev,netdev ian