diff --git a/misc/autoyast.suse15 b/misc/autoyast.suse15 new file mode 100644 index 00000000..ff56a689 --- /dev/null +++ b/misc/autoyast.suse15 @@ -0,0 +1,152 @@ + + + + + + UTC + + + + false + + + + + sle-module-basesystem/Module-Basesystem + sle-module-hpc/Module-HPC + sle-module-server-applications/Module-Server-Applications + sle-module-containers/Module-Containers + SLE_HPC/Product-HPC + Legacy-Module/Module-Legacy + + + + + SLE_HPC + + + base + + + openssl + chrony + rsync + screen + vim + binutils + pciutils + usbutils + nfs-client + ethtool + + + + + %%INSTDISK%% + true + all + CT_LVM + + + + + root + %%ROOTPASSWORD%% + true + + + + + + %%NODENAME%% + + true + + + + + sshd + + + + + + + + + + + + + + diff --git a/misc/kickstart.el8 b/misc/kickstart.el8 new file mode 100644 index 00000000..d6835d25 --- /dev/null +++ b/misc/kickstart.el8 @@ -0,0 +1,73 @@ +%include /tmp/rootpw +%include /tmp/timezone +%include /tmp/partitioning +reboot + +%packages +@^minimal-environment +chrony +rsync +python3 +%end + +%pre +nodename=$(grep ^NODENAME /etc/confluent.info|awk '{print $2}') +mgr=$(grep ipv4_server /etc/confluent.deploycfg |awk '{print $2}') +tz=$(grep ^timezone: /etc/confluent.deploycfg) +tz=${tz#*: } +echo timezone $tz --utc > /tmp/timezone +rootpw=$(grep ^rootpassword /etc/confluent.deploycfg | awk '{print $2}') +if [ "$rootpw" = null ]; then + echo "rootpw --lock" > /tmp/rootpw +else + echo "rootpw --iscrypted $rootpw" > /tmp/rootpw +fi +for pubkey in /etc/ssh/ssh_host*key.pub; do + certfile=${pubkey/.pub/-cert.pub} + curl -f -X POST -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $(cat /etc/confluent.apikey)" -d @$pubkey https://$mgr/confluent-api/self/sshcert > $certfile + echo HostCertificate $certfile >> /etc/ssh/sshd_config.anaconda +done +/usr/sbin/sshd -f /etc/ssh/sshd_config.anaconda +if [ -f "/run/install/cmdline.d/01-autocons.conf" ]; then + consoledev=$(cat /run/install/cmdline.d/01-autocons.conf | sed -e 's!console=!/dev/!' -e 's/,.*//') + tmux a <> $consoledev >&0 2>&1 & +fi +curl https://$mgr/confluent-public/confluent/util/getinstalldisk > /tmp/getinstalldisk +/usr/libexec/platform-python /tmp/getinstalldisk +if [ -e /tmp/installdisk ]; then + echo clearpart --all --initlabel >> /tmp/partitioning + echo ignoredisk --only-use $(cat /tmp/installdisk) >> /tmp/partitioning + echo autopart --nohome >> /tmp/partitioning +fi +curl -f -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $(cat /etc/confluent.apikey)" https://$mgr/confluent-api/self/nodelist > /tmp/allnodes +%end + +%post --nochroot +# need to copy over ssh key info +grep HostCert /etc/ssh/sshd_config.anaconda >> /mnt/sysimage/etc/ssh/sshd_config +echo HostbasedAuthentication yes >> /mnt/sysimage/etc/ssh/sshd_config +echo HostbasedUsesNameFromPacketOnly yes >> /mnt/sysimage/etc/ssh/sshd_config +echo IgnoreRhosts no >> /mnt/sysimage/etc/ssh/sshd_config +sshconf=/etc/ssh/ssh_config +if [ -d /mnt/sysimage/etc/ssh/ssh_config.d/ ]; then + sshconf=/mnt/sysimage/etc/ssh/ssh_config.d/01-confluent.conf +fi +echo 'Host *' >> $sshconf +echo ' HostbasedAuthentication yes' >> $sshconf +echo ' EnableSSHKeysign yes' >> $sshconf +echo ' HostbasedKeyTypes *ed25519*' >> $sshconf + +cp /etc/ssh/ssh_host_* /mnt/sysimage/etc/ssh/ +mkdir /mnt/sysimage/root/.ssh/ +chmod 700 /mnt/sysimage/root/.ssh/ +cp /root/.ssh/authorized_keys /mnt/sysimage/root/.ssh/ +chmod 600 /mnt/sysimage/root/.ssh/authorized_keys +cp /etc/ssh/ssh_known_hosts /mnt/sysimage/etc/ssh/ +cp /tmp/allnodes /mnt/sysimage/etc/ssh/shosts.equiv +cp /tmp/allnodes /mnt/sysimage/root/.shosts +%end + +%post +chgrp ssh_keys /etc/ssh/ssh*key +restorecon /etc/ssh/ssh*key /root/.shosts /etc/ssh/shosts.equiv /etc/ssh/ssh_config.d/* +%end diff --git a/misc/suseagent.sh b/misc/suseagent.sh new file mode 100755 index 00000000..740c3b33 --- /dev/null +++ b/misc/suseagent.sh @@ -0,0 +1,89 @@ +#!/bin/bash +echo "Installing certificates" +echo '' > /tmp/rootkeys.xml +for pub in /ssh/*.rootpubkey; do + echo ''$(cat $pub)'' >> /tmp/rootkeys.xml +done +echo '' >> /tmp/rootkeys.xml +/usr/bin/cp /tls/*.0 /var/lib/ca-certificates/openssl/ +/usr/bin/cp /tls/*.0 /etc/ssl/certs/ +echo "LineMode: 1" > /etc/linuxrc.d/01-confluent +autocons="" +if ! grep console /proc/cmdline > /dev/null; then + autocons=$(/opt/confluent/bin/autocons) + if [ ! -z "$autocons" ]; then + echo "ConsoleDevice: ${autocons%,*}" >> /etc/linuxrc.d/01-confluent + fi +fi +cd /sys/class/net +for nic in *; do + ip link set $nic up +done +echo -n "Discovering confluent..." +/opt/confluent/bin/copernicus -t > /tmp/confluent.info +while ! grep MANAGER: /tmp/confluent.info > /dev/null; do + /opt/confluent/bin/copernicus -t > /tmp/confluent.info +done +nodename=$(grep ^NODENAME: /tmp/confluent.info | head -n 1 | sed -e 's/NODENAME: //') +echo "done ($nodename)" +echo "Hostname: $nodename" >> /etc/linuxrc.d/01-confluent +mgr=$(grep ^MANAGER: /tmp/confluent.info | head -n 1 | sed -e 's/MANAGER: //') +echo -n "Acquiring configuration from $mgr..." +bootifidx=${mgr#*%} +for nic in *; do + if [ "$(cat $nic/ifindex)" = "$bootifidx" ]; then + bootif=$nic + fi +done +cd - +echo "NetDevice: $bootif" >> /etc/linuxrc.d/01-confluent +/opt/confluent/bin/clortho $nodename $mgr > /tmp/confluent.apikey +mgr="[$mgr]" +curl -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $(cat /tmp/confluent.apikey)" https://$mgr/confluent-api/self/deploycfg > /tmp/confluent.deploycfg + +tz=$(grep timezone: /tmp/confluent.deploycfg | awk '{print $2}') +echo "${tz}" > /tmp/timezone +autoconfigmethod=$(grep ipv4_method /tmp/confluent.deploycfg) +autoconfigmethod=${autoconfigmethod#ipv4_method: } +if [ "$autoconfigmethod" = "dhcp" ]; then + echo "DHCP: 1" >> /etc/linuxrc.d/01-confluent +else + v4addr=$(grep ^ipv4_address: /tmp/confluent.deploycfg) + v4addr=${v4addr#ipv4_address: } + v4gw=$(grep ^ipv4_gateway: /tmp/confluent.deploycfg) + v4gw=${v4gw#ipv4_gateway: } + v4nm=$(grep ipv4_netmask: /tmp/confluent.deploycfg) + v4nm=${v4nm#ipv4_netmask: } + echo "HostIP: $v4addr" >> /etc/linuxrc.d/01-confluent + echo "Netmask: $v4nm" >> /etc/linuxrc.d/01-confluent + if [ "$v4gw" != "null" ]; then + echo "Gateway: $v4gw" >> /etc/linuxrc.d/01-confluent + fi + nameserversec=0 + while read -r entry; do + if [ $nameserversec = 1 ]; then + if [[ $entry == "-"* ]]; then + echo Nameserver: ${entry#- } >> /etc/linuxrc.d/01-confluent + continue + fi + fi + nameserversec=0 + if [ ${entry%:*} = "nameservers" ]; then + nameserversec=1 + continue + fi + done < /tmp/confluent.deploycfg +fi +echo done +mgr=$(grep ^ipv4_server: /tmp/confluent.deploycfg) +mgr=${mgr#ipv4_server: } +profilename=$(grep ^profile: /tmp/confluent.deploycfg) +profilename=${profilename#profile: } +proto=$(grep ^protocol: /tmp/confluent.deploycfg) +proto=${proto#protocol: } + +echo "${proto}://${mgr}/confluent-public/os/${profilename}/distribution/2" > /tmp/pkgurl + +echo "AutoYaST: $proto://$mgr/confluent-public/os/$profilename/autoyast" >> /etc/linuxrc.d/01-confluent +echo "Install: $proto://$mgr/confluent-public/os/$profilename/distribution/1" >> /etc/linuxrc.d/01-confluent +exec /init