Secured every user-accessible variable with double quotes

This commit is contained in:
Tigerblue77 2025-10-26 19:31:48 +00:00
parent b2ec8afc67
commit b92b18159a
3 changed files with 19 additions and 19 deletions

View file

@ -7,16 +7,16 @@
source functions.sh
# Check if the iDRAC host is set to 'local' or not then set the IDRAC_LOGIN_STRING accordingly
if [[ $IDRAC_HOST == "local" ]]; then
if [[ "$IDRAC_HOST" == "local" ]]; then
# Check that the Docker host IPMI device (the iDRAC) has been exposed to the Docker container
if [ ! -e "/dev/ipmi0" ] && [ ! -e "/dev/ipmi/0" ] && [ ! -e "/dev/ipmidev/0" ]; then
print_error_and_exit "Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0, check that you added the device to your Docker container or stop using local mode"
fi
IDRAC_LOGIN_STRING='open'
else
echo "iDRAC/IPMI username: $IDRAC_USERNAME"
#echo "iDRAC/IPMI password: $IDRAC_PASSWORD"
IDRAC_LOGIN_STRING="lanplus -H $IDRAC_HOST -U $IDRAC_USERNAME -P $IDRAC_PASSWORD"
echo "iDRAC/IPMI username: \"$IDRAC_USERNAME\""
#echo "iDRAC/IPMI password: \"$IDRAC_PASSWORD\""
IDRAC_LOGIN_STRING="lanplus -H \"$IDRAC_HOST\" -U \"$IDRAC_USERNAME\" -P \"$IDRAC_PASSWORD\""
fi
ipmitool -I $IDRAC_LOGIN_STRING sdr type temperature