From ba2a6b887fe5a9ed627e9f0947265b37abbcf7aa Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 21 Jan 2018 20:54:49 -0500 Subject: [PATCH] formatting and dns changes --- arch-pxe | 2 +- chost | 2 +- debian-preseed | 2 +- fai-redep | 2 +- fai-revm | 3 ++ fai/config/scripts/GRUB_PC/11-iank | 5 ++ faiserver-setup | 80 ++++++++++++++---------------- wrt-setup | 27 ++++++---- 8 files changed, 67 insertions(+), 56 deletions(-) diff --git a/arch-pxe b/arch-pxe index 52885b3..7820544 100755 --- a/arch-pxe +++ b/arch-pxe @@ -64,7 +64,7 @@ s rm -rf squashfs-root # remove any existing folder s unsquashfs $sfs s mkdir -p squashfs-root/root/.ssh s chmod 755 squashfs-root/root/.ssh -s cp ~/.ssh/id_rsa.pub squashfs-root/root/.ssh/authorized_keys +s cp ~/.ssh/home.pub squashfs-root/root/.ssh/authorized_keys s cp $script_dir/arch-iso-init squashfs-root/root s rm $sfs diff --git a/chost b/chost index 6168741..c02c8c2 100755 --- a/chost +++ b/chost @@ -10,4 +10,4 @@ host=$1 addr=$(host $host | sed -rn 's/^\S+ has address //p;T;q') h=$(host $addr) h=${h##* } -echo ${h%%.*} +echo $h diff --git a/debian-preseed b/debian-preseed index ea1e847..e3df0dc 100755 --- a/debian-preseed +++ b/debian-preseed @@ -136,7 +136,7 @@ d-i pkgsel/update-policy select unattended-upgrades d-i preseed/late_command string \ in-target sed -i 's/^%sudo.*$/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' /etc/sudoers; \ in-target mkdir -p /home/$user/.ssh; \ -in-target /bin/sh -c "echo '$(cat ~/.ssh/id_rsa.pub)' >> /home/$user/.ssh/authorized_keys"; \ +in-target /bin/sh -c "echo '$(cat ~/.ssh/home.pub)' >> /home/$user/.ssh/authorized_keys"; \ in-target chown -R $user:$user /home/$user; \ in-target chmod -R go-rwx /home/$user/.ssh/authorized_keys; \ in-target cp -r /home/$user/.ssh /root; \ diff --git a/fai-redep b/fai-redep index 840f2c4..7dc0d09 100755 --- a/fai-redep +++ b/fai-redep @@ -41,7 +41,7 @@ faiserver_host=$(chost $host) || faiserver_host=$host rsync -rlp --delete --relative --exclude /fai/config/basefiles/ fai/config root@$faiserver_host:/srv -scp -q ~/.ssh/id_rsa.pub \ +scp -q ~/.ssh/home.pub \ root@$faiserver_host:/srv/fai/config/files/root/.ssh/authorized_keys/GRUB_PC # todo: automatically disable faiserver after a period so # these files are not exposed. diff --git a/fai-revm b/fai-revm index 2dbae8f..bd9a9d6 100755 --- a/fai-revm +++ b/fai-revm @@ -120,6 +120,9 @@ if [[ $SSH_CLIENT ]]; then console_arg=--noautoconsole fi +# docker makes forward default to drop, which blocks the vm pxe on flidas. easiest solution: +s iptables -P FORWARD ACCEPT + # --cpu host: this causes mkfs.btrfs to fail with a stack trace which began # something like: # init_module+0x108/0x1000 [raid6_pq] diff --git a/fai/config/scripts/GRUB_PC/11-iank b/fai/config/scripts/GRUB_PC/11-iank index c6948e7..12d5182 100755 --- a/fai/config/scripts/GRUB_PC/11-iank +++ b/fai/config/scripts/GRUB_PC/11-iank @@ -61,6 +61,7 @@ $ROOTCMD apt-get update chroot $FAI_ROOT bash <<'EOF' +#### begin .ssh setup ### set -eE -o pipefail mkdir -p /home/iank/.ssh f=/root/.ssh/authorized_keys @@ -75,7 +76,11 @@ find /home/iank/.ssh -xtype l -exec rm '{}' \; cp -rL /home/iank/.ssh /root chown -R root:root /root/.ssh chmod 700 /root/.ssh +#### end .ssh setup ### +# this is needed to enable resolvconf, making /etc/resolv.conf be a symlink. +# why? i dun know, it\'s really dumb. +dpkg-reconfigure -fnoninteractive resolvconf # default jessie groups + kvm, systemd-journal, adm usermod -aG adm,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev iank diff --git a/faiserver-setup b/faiserver-setup index 491cfda..f1ede11 100755 --- a/faiserver-setup +++ b/faiserver-setup @@ -20,7 +20,7 @@ x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace" [[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE}" "$@" usage() { - cat </dev/null; then fi armhf() { - [[ $(dpkg --print-architecture) == armhf ]] + [[ $(dpkg --print-architecture) == armhf ]] } if armhf; then @@ -91,16 +91,12 @@ elif grep -xFq 'VERSION="9 (stretch)"' /etc/os-release; then cat >/etc/apt/sources.list.d/fai.list <<'EOF' deb http://fai-project.org/download stretch koeln EOF +elif grep -iE 'flidas|xenail' /etc/os-release; then + add-apt-repository -y ppa:fai/ppa else - rm -f /etc/apt/sources.list.d/fai.list + rm -f /etc/apt/sources.list.d/fai.list fi -# for ubuntu: -#add-apt-repository -y ppa:fai/ppa - -# for debian: - - apt-get update # Relevant packages from fai-quickstart depends and fai-server recommends. @@ -111,7 +107,7 @@ pkgs=(fai-doc tftpd-hpa tar reprepro squashfs-tools binutils) if modprobe nfsd &>/dev/null; then pkgs+=(nfs-kernel-server) else - pkgs+=(apache2) + pkgs+=(apache2) fi @@ -129,13 +125,13 @@ EOF case $base in - jessie|stretch) - cat >>/etc/fai/apt/sources.list <>/etc/fai/apt/sources.list <