From c23537e74a81ee3bb015f91c6216e1521a8f4c81 Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Thu, 5 Oct 2023 12:28:50 +0200 Subject: [PATCH] don't update ipmi if there is no password Signed-off-by: Christian Goll --- CHANGELOG.md | 1 + .../wwinit/rootfs/warewulf/init.d/50-ipmi | 30 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b2165e8..1fbc2315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). not have a device specified. #1154 - Return non-zero exit code on overlay sub-commands #1423 - Simplify passing of arguments to commands through `wwctl container exec`. #253 +- Don't update IPMI if password isn't set. #638 ## v4.5.8, 2024-10-01 diff --git a/overlays/wwinit/rootfs/warewulf/init.d/50-ipmi b/overlays/wwinit/rootfs/warewulf/init.d/50-ipmi index bea49fc8..02163776 100755 --- a/overlays/wwinit/rootfs/warewulf/init.d/50-ipmi +++ b/overlays/wwinit/rootfs/warewulf/init.d/50-ipmi @@ -22,11 +22,6 @@ echo "IPMI IP address: $WWIPMI_IPADDR" echo "IPMI netmask: $WWIPMI_NETMASK" echo "IPMI gateway: $WWIPMI_GATEWAY" echo "IPMI username: $WWIPMI_USER" -if test -n "$WWIPMI_PASSWORD"; then - echo "IPMI password is defined" -else - echo "IPMI password is undefined" -fi modprobe ipmi_si modprobe ipmi_ssif @@ -58,18 +53,25 @@ if [ "$PREV_IP" != "$WWIPMI_IPADDR" -o "$PREV_NETMASK" != "$WWIPMI_NETMASK" -o " fi # User -if [ "$WWIPMI_USER" != "" ]; then - PREV_USER=$(ipmitool user list | grep "^2 " | awk '{ print $2; }') - TEST_PASSWORD=$(ipmitool user test 2 20 $WWIPMI_PASSWORD) - if [ "$WWIPMI_USER" != "$PREV_USER" -o "$TEST_PASSWORD" != "Success" ]; then - ipmitool user set name 2 $WWIPMI_USER - ipmitool user set password 2 $WWIPMI_PASSWORD - sleep 1 - ipmitool user priv 2 4 1 - ipmitool user enable 2 +if test -n "$WWIPMI_PASSWORD"; then + echo "IPMI password is defined" + if [ "$WWIPMI_USER" != "" ]; then + PREV_USER=$(ipmitool user list | grep "^2 " | awk '{ print $2; }') + TEST_PASSWORD=$(ipmitool user test 2 20 $WWIPMI_PASSWORD) + if [ "$WWIPMI_USER" != "$PREV_USER" -o "$TEST_PASSWORD" != "Success" ]; then + ipmitool user set name 2 $WWIPMI_USER + ipmitool user set password 2 $WWIPMI_PASSWORD + sleep 1 + ipmitool user priv 2 4 1 + ipmitool user enable 2 + fi fi +else + echo "IPMI password is undefined" + exit fi + # Authentication #ipmitool lan set 1 auth user md5,password #ipmitool lan set 1 auth operator md5,password