From 41b3313f7c80f1b86e48094afdcc25b5bf633de0 Mon Sep 17 00:00:00 2001 From: Niko Kivel Date: Fri, 19 Mar 2021 10:21:23 +0100 Subject: [PATCH 1/5] basic debian docs --- docs/docs/debian/Dockerfile | 22 ++++++++++++++++++++++ docs/docs/debian/debian.md | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 docs/docs/debian/Dockerfile create mode 100644 docs/docs/debian/debian.md diff --git a/docs/docs/debian/Dockerfile b/docs/docs/debian/Dockerfile new file mode 100644 index 00000000..32f7f00c --- /dev/null +++ b/docs/docs/debian/Dockerfile @@ -0,0 +1,22 @@ +FROM debian:buster-slim + +RUN apt-get update + +RUN apt-get -y install \ + kmod \ + systemd-sysv \ + openssh-server \ + openssh-client \ + isc-dhcp-client \ + pciutils \ + strace \ + nfs-common \ + ethtool\ + ifupdown + +RUN apt-get -y install --no-install-recommends \ + linux-image-amd64 + +RUN rm -rf /var/lib/apt/lists/* + +RUN echo "root:r00tr00t" | chpasswd diff --git a/docs/docs/debian/debian.md b/docs/docs/debian/debian.md new file mode 100644 index 00000000..6bf5622d --- /dev/null +++ b/docs/docs/debian/debian.md @@ -0,0 +1,21 @@ +# Debian, Buster + +## Docker container + +### build and push + +> PSI specific, change for upstream + +change into your docker build directory +```bash +docker build -t docker.psi.ch:5000/debian:buster-slim . +docker push docker.psi.ch:5000/debian:buster-slim +``` + +### import docker container into warewulf + +```bash +wwctl container import docker://docker.psi.ch:5000/debian:buster-slim debian-10:slim +``` + + From 1affae5bfa875bb7f91dae9c9984ef0916090301 Mon Sep 17 00:00:00 2001 From: Niko Kivel Date: Fri, 19 Mar 2021 10:24:09 +0100 Subject: [PATCH 2/5] initial debian overlay --- overlays/system/debian/etc/hostname.ww | 1 + overlays/system/debian/etc/network/interfaces | 9 +++ .../debian/etc/network/interfaces.d/eno1.ww | 7 +++ .../debian/etc/network/interfaces.d/eno2.ww | 4 ++ .../debian/etc/ssh/ssh_host_dsa_key.pub.ww | 1 + .../system/debian/etc/ssh/ssh_host_dsa_key.ww | 1 + .../debian/etc/ssh/ssh_host_ecdsa_key.pub.ww | 1 + .../debian/etc/ssh/ssh_host_ecdsa_key.ww | 1 + .../etc/ssh/ssh_host_ed25519_key.pub.ww | 1 + .../debian/etc/ssh/ssh_host_ed25519_key.ww | 1 + .../debian/etc/ssh/ssh_host_rsa_key.pub.ww | 1 + .../system/debian/etc/ssh/ssh_host_rsa_key.ww | 1 + overlays/system/debian/etc/ssh/sshd_config.ww | 14 +++++ .../debian/etc/warewulf/warewulf.conf.ww | 1 + overlays/system/debian/init | 57 +++++++++++++++++++ overlays/system/debian/warewulf/config.ww | 9 +++ .../system/debian/warewulf/init.d/20-loopback | 6 ++ .../debian/warewulf/init.d/75-vnfs_fixes | 24 ++++++++ .../system/debian/warewulf/init.d/80-wwclient | 6 ++ .../system/debian/warewulf/init.d/90-selinux | 35 ++++++++++++ .../system/debian/warewulf/init.d/99-test | 15 +++++ overlays/system/debian/warewulf/wwinit | 17 ++++++ 22 files changed, 213 insertions(+) create mode 100644 overlays/system/debian/etc/hostname.ww create mode 100644 overlays/system/debian/etc/network/interfaces create mode 100755 overlays/system/debian/etc/network/interfaces.d/eno1.ww create mode 100755 overlays/system/debian/etc/network/interfaces.d/eno2.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_dsa_key.pub.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_dsa_key.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.pub.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_ed25519_key.pub.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_ed25519_key.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_rsa_key.pub.ww create mode 100644 overlays/system/debian/etc/ssh/ssh_host_rsa_key.ww create mode 100644 overlays/system/debian/etc/ssh/sshd_config.ww create mode 100644 overlays/system/debian/etc/warewulf/warewulf.conf.ww create mode 100755 overlays/system/debian/init create mode 100644 overlays/system/debian/warewulf/config.ww create mode 100644 overlays/system/debian/warewulf/init.d/20-loopback create mode 100644 overlays/system/debian/warewulf/init.d/75-vnfs_fixes create mode 100644 overlays/system/debian/warewulf/init.d/80-wwclient create mode 100644 overlays/system/debian/warewulf/init.d/90-selinux create mode 100644 overlays/system/debian/warewulf/init.d/99-test create mode 100644 overlays/system/debian/warewulf/wwinit diff --git a/overlays/system/debian/etc/hostname.ww b/overlays/system/debian/etc/hostname.ww new file mode 100644 index 00000000..b195826a --- /dev/null +++ b/overlays/system/debian/etc/hostname.ww @@ -0,0 +1 @@ +{{$.Id}} diff --git a/overlays/system/debian/etc/network/interfaces b/overlays/system/debian/etc/network/interfaces new file mode 100644 index 00000000..54b3a2db --- /dev/null +++ b/overlays/system/debian/etc/network/interfaces @@ -0,0 +1,9 @@ +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +source /etc/network/interfaces.d/* + +# The loopback network interface +auto lo +iface lo inet loopback + diff --git a/overlays/system/debian/etc/network/interfaces.d/eno1.ww b/overlays/system/debian/etc/network/interfaces.d/eno1.ww new file mode 100755 index 00000000..79e03697 --- /dev/null +++ b/overlays/system/debian/etc/network/interfaces.d/eno1.ww @@ -0,0 +1,7 @@ +auto eno1 +allow-hotplug eno1 +iface eno1 inet static + address {{.NetDevs.eno1.Ipaddr}} + netmask {{.NetDevs.eno1.Netmask}} + gateway {{.NetDevs.eno1.Gateway}} + diff --git a/overlays/system/debian/etc/network/interfaces.d/eno2.ww b/overlays/system/debian/etc/network/interfaces.d/eno2.ww new file mode 100755 index 00000000..566e1458 --- /dev/null +++ b/overlays/system/debian/etc/network/interfaces.d/eno2.ww @@ -0,0 +1,4 @@ +# The facility network interface +allow-hotplug eno2 +iface eno2 inet dhcp + diff --git a/overlays/system/debian/etc/ssh/ssh_host_dsa_key.pub.ww b/overlays/system/debian/etc/ssh/ssh_host_dsa_key.pub.ww new file mode 100644 index 00000000..4bb82192 --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_dsa_key.pub.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_dsa_key.pub"}} diff --git a/overlays/system/debian/etc/ssh/ssh_host_dsa_key.ww b/overlays/system/debian/etc/ssh/ssh_host_dsa_key.ww new file mode 100644 index 00000000..581f48f4 --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_dsa_key.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_dsa_key"}} diff --git a/overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.pub.ww b/overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.pub.ww new file mode 100644 index 00000000..b6d9aa89 --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.pub.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_ecdsa_key.pub"}} diff --git a/overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.ww b/overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.ww new file mode 100644 index 00000000..fbf8934c --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_ecdsa_key.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_ecdsa_key"}} diff --git a/overlays/system/debian/etc/ssh/ssh_host_ed25519_key.pub.ww b/overlays/system/debian/etc/ssh/ssh_host_ed25519_key.pub.ww new file mode 100644 index 00000000..76dbcfdb --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_ed25519_key.pub.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_ed25519_key.pub"}} diff --git a/overlays/system/debian/etc/ssh/ssh_host_ed25519_key.ww b/overlays/system/debian/etc/ssh/ssh_host_ed25519_key.ww new file mode 100644 index 00000000..e6dec541 --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_ed25519_key.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_ed25519_key"}} diff --git a/overlays/system/debian/etc/ssh/ssh_host_rsa_key.pub.ww b/overlays/system/debian/etc/ssh/ssh_host_rsa_key.pub.ww new file mode 100644 index 00000000..d5b09fa8 --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_rsa_key.pub.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_rsa_key.pub"}} diff --git a/overlays/system/debian/etc/ssh/ssh_host_rsa_key.ww b/overlays/system/debian/etc/ssh/ssh_host_rsa_key.ww new file mode 100644 index 00000000..feffaad5 --- /dev/null +++ b/overlays/system/debian/etc/ssh/ssh_host_rsa_key.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/keys/ssh_host_rsa_key"}} diff --git a/overlays/system/debian/etc/ssh/sshd_config.ww b/overlays/system/debian/etc/ssh/sshd_config.ww new file mode 100644 index 00000000..cc466670 --- /dev/null +++ b/overlays/system/debian/etc/ssh/sshd_config.ww @@ -0,0 +1,14 @@ +{{Include "/etc/warewulf/ssh/sshd_config"}} + +# This is a Warewulf Template file. +# +# This file (suffix '.ww') will be automatically rewritten without the suffix +# when the overlay is rendered for the individual nodes. Here are some examples +# of macros and logic which can be used within this file: +# +# Node FQDN = {{.Id}} +# Node Group = {{.GroupName}} +# Network Config = {{.NetDevs.eth0.Ipaddr}}, {{.NetDevs.eth0.Hwaddr}}, etc. +# +# Goto the documentation pages for more information: http://www.hpcng.org/... + diff --git a/overlays/system/debian/etc/warewulf/warewulf.conf.ww b/overlays/system/debian/etc/warewulf/warewulf.conf.ww new file mode 100644 index 00000000..df0e916e --- /dev/null +++ b/overlays/system/debian/etc/warewulf/warewulf.conf.ww @@ -0,0 +1 @@ +{{Include "/etc/warewulf/warewulf.conf"}} diff --git a/overlays/system/debian/init b/overlays/system/debian/init new file mode 100755 index 00000000..95c67574 --- /dev/null +++ b/overlays/system/debian/init @@ -0,0 +1,57 @@ +#!/bin/sh +# +# This is one of those types of files that you shouldn't edit unless you really +# know what you are doing and even then you should make a backup. +# +# Edit at your own risk! DANGER DANGER. + + +if test -f "/warewulf/config"; then + . /warewulf/config +else + echo "ERROR: Warewulf configuration file not found... rebooting in 1 minute" + sleep 60 + /sbin/reboot +fi + +echo "Warewulf v4 is now booting: ${WWHOSTNAME}" +echo "debian specific overlay" + +echo "Mounting up kernel file systems" +mkdir /proc /dev /sys /run 2>/dev/null +mount -t proc proc /proc +mount -t devtmpfs devtmpfs /dev +mount -t sysfs sysfs /sys +mount -t tmpfs tmpfs /run + +chmod 755 /warewulf/wwinit + +echo "Checking Rootfs type" +ROOTFSTYPE=`stat -f -c "%T" /` + +if test "${WWROOT}" = "initramfs"; then + echo "Provisioned to default initramfs file system: ${ROOTFSTYPE}" + echo "Calling WW Init" + exec /warewulf/wwinit +elif test "${WWROOT}" = "tmpfs"; then + if test "${ROOTFSTYPE}" == "tmpfs"; then + echo "ERROR: Switching the root file system requires the kernel argument: 'rootfstype=ramfs'" + else + echo "Setting up tmpfs root file system" + mkdir /newroot + mount wwroot /newroot -t tmpfs + echo "Moving RAMFS to TMPFS" + tar -cf - --exclude ./proc --exclude ./sys --exclude ./dev --exclude ./newroot . | tar -xf - -C /newroot + mkdir /newroot/proc /newroot/dev /newroot/sys /newroot/run 2>/dev/null + echo "Calling switch_root and invoking WW Init" + exec /sbin/switch_root /newroot /warewulf/wwinit + fi +else + echo "ERROR: Unknown Warewulf Root file system: ${WWROOT}" +fi + +echo +echo "There was a problem with the provisioning process, rebooting in 1 minute..." +sleep 60 +/sbin/reboot + diff --git a/overlays/system/debian/warewulf/config.ww b/overlays/system/debian/warewulf/config.ww new file mode 100644 index 00000000..5a33472a --- /dev/null +++ b/overlays/system/debian/warewulf/config.ww @@ -0,0 +1,9 @@ +WWCONTAINER={{$.Container}} +WWHOSTNAME={{$.Id}} +WWROOT={{$.Root}} +WWINIT={{$.Init}} +WWIPMI_IPADDR="{{$.IpmiIpaddr}}" +WWIPMI_NETMASK="{{$.IpmiNetmask}}" +WWIPMI_GATEWAY="{{$.IpmiGateway}}" +WWIPMI_USER="{{$.IpmiUserName}}" +WWIPMI_PASSWORD="{{$.IpmiPassword}}" diff --git a/overlays/system/debian/warewulf/init.d/20-loopback b/overlays/system/debian/warewulf/init.d/20-loopback new file mode 100644 index 00000000..01791174 --- /dev/null +++ b/overlays/system/debian/warewulf/init.d/20-loopback @@ -0,0 +1,6 @@ +#!/bin/sh + +. /warewulf/config + +echo "Bringing up lo:127.0.0.1" +/sbin/ip link set dev lo up diff --git a/overlays/system/debian/warewulf/init.d/75-vnfs_fixes b/overlays/system/debian/warewulf/init.d/75-vnfs_fixes new file mode 100644 index 00000000..5ce5b735 --- /dev/null +++ b/overlays/system/debian/warewulf/init.d/75-vnfs_fixes @@ -0,0 +1,24 @@ +#!/bin/sh + +. /warewulf/config + +# This will eventually be optional +if true; then + if [ -f "/etc/pam.d/system-auth" ]; then + echo "FIXING: system-auth" + sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/system-auth + fi + + if [ -f "/etc/pam.d/password-auth" ]; then + echo "FIXING: password-auth" + sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/password-auth + fi + + if [ -f "/etc/pam.d/common-account" ]; then + echo "FIXING: common-account" + sed -i -e '/^account.*pam_unix\.so\s*$/s/\s*$/\ broken_shadow/' /etc/pam.d/common-account + fi +fi + + +chmod 755 / diff --git a/overlays/system/debian/warewulf/init.d/80-wwclient b/overlays/system/debian/warewulf/init.d/80-wwclient new file mode 100644 index 00000000..184dac4e --- /dev/null +++ b/overlays/system/debian/warewulf/init.d/80-wwclient @@ -0,0 +1,6 @@ +#!/bin/sh + +. /warewulf/config + +echo "Starting wwclient" +nohup /warewulf/bin/wwclient >/var/log/wwclient.log 2>&1 Date: Fri, 19 Mar 2021 12:38:47 +0100 Subject: [PATCH 3/5] makefile --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index f9573a43..de00672c 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,8 @@ lint: all: vendor wwctl wwclient +debian: all + files: all install -d -m 0755 $(DESTDIR)/usr/bin/ install -d -m 0755 $(DESTDIR)/var/warewulf/ @@ -64,6 +66,13 @@ files: all # cp -r tftpboot/* /var/lib/tftpboot/warewulf/ipxe/ # restorecon -r /var/lib/tftpboot/warewulf +debfiles: debian + chmod +x $(DESTDIR)/var/warewulf/overlays/system/debian/init + chmod 600 $(DESTDIR)/var/warewulf/overlays/system/debian/etc/ssh/ssh* + chmod 644 $(DESTDIR)/var/warewulf/overlays/system/debian/etc/ssh/ssh*.pub.ww + mkdir -p $(DESTDIR)/var/warewulf/overlays/system/debian/warewulf/bin/ + cp wwclient $(DESTDIR)/var/warewulf/overlays/system/debian/warewulf/bin/ + wwctl: cd cmd/wwctl; go build -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../wwctl @@ -85,3 +94,6 @@ clean: rm -f warewulf-$(VERSION).tar.gz install: files + +debinstall: files debfiles + From ace5d9378ab7e1bb7dab5685d95ceab07fdc2800 Mon Sep 17 00:00:00 2001 From: Niko Kivel Date: Tue, 23 Mar 2021 15:25:01 +0100 Subject: [PATCH 4/5] vanilla debian Dockerfile --- docs/docs/debian/Dockerfile | 22 ++++++++++--------- .../system/debian/warewulf/init.d/99-test | 15 ------------- 2 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 overlays/system/debian/warewulf/init.d/99-test diff --git a/docs/docs/debian/Dockerfile b/docs/docs/debian/Dockerfile index 32f7f00c..9904e1bd 100644 --- a/docs/docs/debian/Dockerfile +++ b/docs/docs/debian/Dockerfile @@ -1,22 +1,24 @@ -FROM debian:buster-slim +FROM debian -RUN apt-get update +ENV DEBIAN_FRONTEND noninteractive +ENV RUNLEVEL 1 -RUN apt-get -y install \ +RUN apt-get update && apt-get install -y --no-install-recommends \ kmod \ systemd-sysv \ - openssh-server \ openssh-client \ + openssh-server \ isc-dhcp-client \ pciutils \ strace \ nfs-common \ ethtool\ - ifupdown - -RUN apt-get -y install --no-install-recommends \ - linux-image-amd64 - -RUN rm -rf /var/lib/apt/lists/* + ifupdown \ + linux-image-amd64 \ + ifmetric \ + netbase && \ + rm -rf /var/lib/apt/lists/* RUN echo "root:r00tr00t" | chpasswd + +ENV DEBIAN_FRONTEND teletype diff --git a/overlays/system/debian/warewulf/init.d/99-test b/overlays/system/debian/warewulf/init.d/99-test deleted file mode 100644 index d8fab744..00000000 --- a/overlays/system/debian/warewulf/init.d/99-test +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -. /warewulf/config - -#echo `ls /dev` -#sleep 10 - -#echo `lspci` -#sleep 10 - -#ip a -#sleep 10 - -#ls -la /lib/modules -#sleep 20 From 81780367bbfe7680ba7b9112212d50b0b3040e65 Mon Sep 17 00:00:00 2001 From: Niko Kivel Date: Wed, 24 Mar 2021 12:15:20 +0100 Subject: [PATCH 5/5] Dockerfile with procServ and hacks to use RHEL7 EPICS build --- docs/docs/debian/Dockerfile.EPICS | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/docs/debian/Dockerfile.EPICS diff --git a/docs/docs/debian/Dockerfile.EPICS b/docs/docs/debian/Dockerfile.EPICS new file mode 100644 index 00000000..4480483c --- /dev/null +++ b/docs/docs/debian/Dockerfile.EPICS @@ -0,0 +1,40 @@ +FROM debian + +ENV DEBIAN_FRONTEND noninteractive +ENV RUNLEVEL 1 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + kmod \ + systemd-sysv \ + openssh-client \ + openssh-server \ + isc-dhcp-client \ + pciutils \ + strace \ + nfs-common \ + ethtool\ + ifupdown \ + linux-image-amd64 \ + ifmetric \ + procserv \ + netbase && \ + rm -rf /var/lib/apt/lists/* + +# EPICS hack for libreadline +RUN ln -s /lib/x86_64-linux-gnu/libreadline.so.7 /lib/x86_64-linux-gnu/libreadline.so.6 +RUN ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5 + +# weed out stuff from the internal kernel +#RUN rm -rf \ +# /lib/modules/*/kernel/drivers/gpu \ +# /lib/modules/*/kernel/drivers/hwmon \ +# /lib/modules/*/kernel/drivers/infiniband \ +# /lib/modules/*/kernel/drivers/isdn \ +# /lib/modules/*/kernel/drivers/media \ +# /lib/modules/*/kernel/drivers/scsi \ +# /lib/modules/*/kernel/drivers/usb \ +# /lib/modules/*/kernel/drivers/net/usb \ +# /lib/modules/*/kernel/drivers/net/wireless + +ENV DEBIAN_FRONTEND teletype +