Last active
June 30, 2022 02:22
-
-
Save zry98/47ba59dd607b0115f30ac7d45583c699 to your computer and use it in GitHub Desktop.
Silence HPE server fans using hacked iLO firmware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# iLO4 hacking: https://github.com/kendallgoto/ilo4_unlock | |
sshPrivateKey="/root/.ssh/id_rsa" | |
iloPort=22 | |
iloUser="Administrator" | |
iloAddress="10.2.2.2" | |
jumpHost="-J [email protected]" # set this to a jump host if your iLO is using a shared network port | |
fanMaxSpeed_global="40" | |
fanMaxSpeed_0=${fanMaxSpeed_global} | |
fanMaxSpeed_1=${fanMaxSpeed_global} | |
fanMaxSpeed_2=${fanMaxSpeed_global} | |
fanMaxSpeed_3=${fanMaxSpeed_global} | |
sshCommand="/usr/bin/ssh -i ${sshPrivateKey} -oKexAlgorithms=+diffie-hellman-group1-sha1 -p ${iloPort} ${jumpHost} ${iloUser}@${iloAddress}" | |
# check SSH connection by running `time` to get an output like `time\r\r\n01:23:45\r\n\r\r\n` | |
timeOutput=$(${sshCommand} "time") | |
timeOutputRegex=$'^time\r\r\n[0-9]{2}:[0-9]{2}:[0-9]{2}\r\n\r\r' | |
if [[ ! "${timeOutput}" =~ ${timeOutputRegex} ]]; then | |
echo "SSH connection to iLO failed" | |
exit 1 | |
fi | |
# adjust the fan speed maximums | |
#${sshCommand} "fan p 0 max ${fanMaxSpeed_0}" | |
#${sshCommand} "fan p 1 max ${fanMaxSpeed_1}" | |
#${sshCommand} "fan p 2 max ${fanMaxSpeed_2}" | |
${sshCommand} "fan p 3 max ${fanMaxSpeed_3}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment