-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ilo ripple20 vulnerabilities
- Loading branch information
Philipp Dorschner
committed
May 6, 2021
1 parent
317f359
commit 2a71c41
Showing
7 changed files
with
195 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package ilo | ||
|
||
import ( | ||
"fmt" | ||
"github.com/NETWAYS/check_hp_firmware/hp/mib" | ||
"github.com/NETWAYS/check_hp_firmware/nagios" | ||
"github.com/gosnmp/gosnmp" | ||
"github.com/hashicorp/go-version" | ||
) | ||
|
||
type Ilo struct { | ||
Model string | ||
RomRevision string | ||
} | ||
|
||
func GetIloInformation(client gosnmp.Handler) (int, string) { | ||
oidModel := []string{mib.CpqSm2CntlrModel + ".0"} | ||
oidRev := []string{ mib.CpqSm2CntlrRomRevision + ".0"} | ||
|
||
ilo := &Ilo{} | ||
parseErr := "" | ||
|
||
iloModel, err := client.Get(oidModel) | ||
if err != nil { | ||
return nagios.Critical, parseErr + "could not get model for Ilo" | ||
} | ||
|
||
iloRev, err := client.Get(oidRev) | ||
if err != nil { | ||
return nagios.Critical, parseErr + "could not get revision for Ilo" | ||
} else { | ||
ilo.RomRevision = iloRev.Variables[0].Value.(string) | ||
} | ||
|
||
if iloModel, ok := mib.CpqSm2CntlrModelMap[iloModel.Variables[0].Value.(int)]; ok { | ||
ilo.Model = iloModel | ||
} else { | ||
return nagios.Critical, parseErr + "unknown Ilo model" | ||
} | ||
|
||
description := fmt.Sprintf("Integrated Lights-Out=%s Revision=%s ", ilo.Model, ilo.RomRevision) | ||
|
||
if ilo.Model == "3" { | ||
if ( ! CompareVer("1.93", iloRev.Variables[0].Value.(string))) { | ||
return nagios.Critical, description + | ||
fmt.Sprintf("The Revision: %s does not satisfies constraints 1.93. Update Firmware immediately!", | ||
ilo.RomRevision) | ||
} | ||
} else if ilo.Model == "4" { | ||
if ( ! CompareVer("2.75", iloRev.Variables[0].Value.(string))) { | ||
return nagios.Critical, description + | ||
fmt.Sprintf("The Revision: %s does not satisfies constraints 2.75 Update Firmware immediately!", | ||
ilo.RomRevision) | ||
} | ||
} else if ilo.Model == "5" { | ||
if ( ! CompareVer("2.18", iloRev.Variables[0].Value.(string))) { | ||
return nagios.Critical, description + | ||
fmt.Sprintf("The Revision: %s does not satisfies constraints 2.18 Update Firmware immediately!", | ||
ilo.RomRevision) | ||
} | ||
} else { | ||
return nagios.Critical, description + fmt.Sprintf("the Ilo Version is to old") | ||
} | ||
|
||
return nagios.OK, description + fmt.Sprintf("The Revision:%s satisfies constraints", ilo.RomRevision) | ||
} | ||
|
||
func CompareVer(constr, vers string) (ret bool) { | ||
v, err := version.NewVersion(vers) | ||
if err != nil{ | ||
return false | ||
} | ||
|
||
c, err := version.NewConstraint(">=" + constr) | ||
if err != nil { | ||
return false | ||
} | ||
|
||
if c.Check(v) { | ||
return true | ||
} | ||
|
||
return false | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package mib | ||
|
||
//noinspection GoUnusedConst,SpellCheckingInspection | ||
const ( | ||
CpqSm2Cntlr = `.1.3.6.1.4.1.232.9.2.2` | ||
CpqSm2CntlrRomDate = `.1.3.6.1.4.1.232.9.2.2.1` | ||
CpqSm2CntlrRomRevision = `.1.3.6.1.4.1.232.9.2.2.2` | ||
CpqSm2CntlrVideoStatus = `.1.3.6.1.4.1.232.9.2.2.3` | ||
CpqSm2CntlrBatteryEnabled = `.1.3.6.1.4.1.232.9.2.2.4` | ||
CpqSm2CntlrBatteryStatus = `.1.3.6.1.4.1.232.9.2.2.5` | ||
CpqSm2CntlrBatteryPercentCharged = `.1.3.6.1.4.1.232.9.2.2.6` | ||
CpqSm2CntlrAlertStatus = `.1.3.6.1.4.1.232.9.2.2.7` | ||
CpqSm2CntlrPendingAlerts = `.1.3.6.1.4.1.232.9.2.2.8` | ||
CpqSm2CntlrSelfTestErrors = `.1.3.6.1.4.1.232.9.2.2.9` | ||
CpqSm2CntlrAgentLocation = `.1.3.6.1.4.1.232.9.2.2.10` | ||
CpqSm2CntlrLastDataUpdate = `.1.3.6.1.4.1.232.9.2.2.11` | ||
CpqSm2CntlrDataStatus = `.1.3.6.1.4.1.232.9.2.2.12` | ||
CpqSm2CntlrColdReboot = `.1.3.6.1.4.1.232.9.2.2.13` | ||
CpqSm2CntlrBadLoginAttemptsThresh = `.1.3.6.1.4.1.232.9.2.2.14` | ||
CpqSm2CntlrBoardSerialNumber = `.1.3.6.1.4.1.232.9.2.2.15` | ||
CpqSm2CntlrRemoteSessionStatus = `.1.3.6.1.4.1.232.9.2.2.16` | ||
CpqSm2CntlrInterfaceStatus = `.1.3.6.1.4.1.232.9.2.2.17` | ||
CpqSm2CntlrSystemId = `.1.3.6.1.4.1.232.9.2.2.18` | ||
CpqSm2CntlrKeyboardCableStatus = `.1.3.6.1.4.1.232.9.2.2.19` | ||
CpqSm2ServerIpAddress = `.1.3.6.1.4.1.232.9.2.2.20` | ||
CpqSm2CntlrModel = `.1.3.6.1.4.1.232.9.2.2.21` | ||
CpqSm2CntlrSelfTestErrorMask = `.1.3.6.1.4.1.232.9.2.2.22` | ||
CpqSm2CntlrMouseCableStatus = `.1.3.6.1.4.1.232.9.2.2.23` | ||
CpqSm2CntlrVirtualPowerCableStatus = `.1.3.6.1.4.1.232.9.2.2.24` | ||
CpqSm2CntlrExternalPowerCableStatus = `.1.3.6.1.4.1.232.9.2.2.25` | ||
CpqSm2CntlrHostGUID = `.1.3.6.1.4.1.232.9.2.2.26` | ||
CpqSm2CntlriLOSecurityOverrideSwitchState = `.1.3.6.1.4.1.232.9.2.2.27` | ||
CpqSm2CntlrHardwareVer = `.1.3.6.1.4.1.232.9.2.2.28` | ||
CpqSm2CntlrAction = `.1.3.6.1.4.1.232.9.2.2.29` | ||
CpqSm2CntlrLicenseActive = `.1.3.6.1.4.1.232.9.2.2.30` | ||
CpqSm2CntlrLicenseKey = `.1.3.6.1.4.1.232.9.2.2.31` | ||
) | ||
|
||
var CpqSm2CntlrModelMap = StringMap{ | ||
1: "other", | ||
2: "eisaRemoteInsightBoard", // This is the EISA Remote Insight | ||
3: "pciRemoteInsightBoard", // This is the PCI Remote Insight | ||
4: "pciLightsOutRemoteInsightBoard", // This is the Remote Insight Lights-Out Edition | ||
5: "pciIntegratedLightsOutRemoteInsight", // This is Integrated Remote Insight Lights-Out Edition. | ||
6: "pciLightsOutRemoteInsightBoardII", // This is the Remote Insight Lights-Out Edition version II | ||
7: "2", // This is the Integrated Lights-Out 2 Edition | ||
// "pciIntegratedLightsOutRemoteInsight2" | ||
|
||
8: "pciLightsOut100series", // This is the Lights-Out 100 Edition for 100 Series of ProLiant servers | ||
9: "3", // This is the Integrated Lights-Out 3 Edition | ||
// "pciIntegratedLightsOutRemoteInsight3" | ||
|
||
10: "4", // This is the Integrated Lights-Out 4 Edition | ||
// "pciIntegratedLightsOutRemoteInsight4" | ||
|
||
11: "5", // This is the Integrated Lights-Out 5 Edition | ||
// "pciIntegratedLightsOutRemoteInsight5" | ||
} |
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