ipmitool工具
当在使用ipmitool进行链接openbmc设备时,某些版本的ipmitool会进行报错,内容为:Error in open session response message : invalid authentication algorithm。此问题为ipmitool版本过低,下载一个高版本ipmitool就可以解决。详情可以参考以下链接中的内容:
https://bugs.centos.org/view.php?id=17653
非ipmitool工具
当我们其他版本的工具来链接openbmc设备时,invalid authentication algorithm问题可能依旧会发生,或者说大概率会发生:)。此时我们需要分析源代码和ipmi协议来进行更改解决这个问题。为此,我们需要以下代码和工具:
1-phosphor-ipmi-net
2-wireshark
3-ipmi-second-gen-interface-spec-v2-rev1-1手册
我们先开宗明义的说明该问题出现的具体原因以及解决方法,再进行详细介绍该问题定位的方法。
问题的原因
(csdn传入图片一直失败,奇怪!)
在ipmi协议手册第318页,介绍了authentication algorithm、integrity algorithm、confidentiality algorithm三种类型共20中情况的算法组合。openbmc和类ipmitool工具必须要包含同一种算法组合,双方才可以验证成功。openbmc端只支持编号为17的算法组合(RAKP_HMAC_SHA256 + HMAC_SHA256_128 + AES_CBC_128)。类ipmitool工具支持什么类型的算法组合,需要参考问题定位
问题解决方法
在phosphor-ipmi-net工程下,open_session.cpp文件中,openSession函数里,进行修改如何内容:
修改authentication algorithm算法认证:
if (!cipher::rakp_auth::Interface::isAlgorithmSupported(
static_cast<cipher::rakp_auth::Algorithms>(request->authAlgo)))
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_AUTH_ALGO);
return outPayload;
}
在函数isAlgorithmSupported中,添加所需的算法内容即可:
static bool isAlgorithmSupported(Algorithms algo)
{
if (algo == Algorithms::RAKP_HMAC_SHA256)
{
return true;
}
else
{
return false;
}
}
修改integrity algorithm算法认证:
if (!cipher::integrity::Interface::isAlgorithmSupported(
static_cast<cipher::integrity::Algorithms>(request->intAlgo)))
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_INTEGRITY_ALGO);
return outPayload;
}
修改confidentiality algorithm算法认证:
if (!cipher::crypt::Interface::isAlgorithmSupported(
static_cast<cipher::crypt::Algorithms>(request->confAlgo)))
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_CONF_ALGO);
return outPayload;
}
问题如何定位
这个时候就需要用到wireshark,我们需要进行抓取通信的报文(图片无法上传。。。)
发送至openbmc设备的报文:
00 00 00 00 49 4d 50 49
00 00 00 08 01 00 00 00
01 00 00 08 01 00 00 00
02 00 00 08 01 00 00 00(此为数据区域的32字节)
我们可以在ipmi 手册13.17小节中找到该字段的介绍,第十三个字节的0::5为authentication algorithm,第二十一字节的0::5字节为integrity algorithm,第二十九字节的0::5为confidentiality algorithm。
openbmc设备发送出去的报文:
00 04 00 00 49 4d 50 49
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00
我们可以在ipmi手册13.18小节中找到该字段的介绍,第二字节为错误码介绍,可以看到标号为04,错误类型为invalid authentication algorithm.