oob bios config password and bios reset
Tested:
1. Bios reset flag can be modified throw redfish
POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios
{
"ResetFlag": "Factory"
}
root@intel-obmc:~# busctl call xyz.openbmc_project.BIOSConfigManager /xyz/openbmc_project/bios_config/manager org.freedesktop.DBus.Properties Get ss xyz.openbmc_project.BIOSConfig.Manager ResetBIOSSettings
v s "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults"
2. Bios change password:
root@intel-obmc:~# cat /var/lib/bios-settings-manager/seedData
{
"UserPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D",
"AdminPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D",
"Seed": "123456",
"HashAlgo": "SHA384"
}
POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword
{
"NewPassword": "12345678",
"OldPassword": "1234567890",
"PasswordName": "Administrator"
}
root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData
{
"CurrentPassword": "1234567890",
"IsAdminPwdChanged": 1,
"IsUserPwdChanged": 0,
"NewPassword": "2DD65D57EB60B1D92C5F3D2DC84724FCEE7BC02E57AA75E834712266ED94CAC704047B2FF7CEC1C36BED280B36BB5AC6",
"UserName": "Administrator"
}
Change-Id: Ib54b36819e49c891c6169c95d9cdaebd5bcb06f3
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
diff --git a/src/manager.cpp b/src/manager.cpp
index c173ee4..c92205f 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -20,6 +20,7 @@
#include "xyz/openbmc_project/Common/error.hpp"
#include <boost/asio.hpp>
+#include <phosphor-logging/elog-errors.hpp>
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/object_server.hpp>
@@ -117,12 +118,16 @@
// BIOS attribute not found in the BaseBIOSTable
if (iter == biosTable.end())
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "BIOS attribute not found in the BaseBIOSTable");
throw AttributeNotFound();
}
// BIOS attribute is read only
if (std::get<static_cast<uint8_t>(Index::readOnly)>(iter->second))
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "BIOS attribute is read only");
throw AttributeReadOnly();
}
@@ -130,15 +135,19 @@
std::get<static_cast<uint8_t>(Index::attributeType)>(iter->second);
if (attributeType != std::get<0>(pair.second))
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "attributeType is not same with bios base table");
throw InvalidArgument();
}
// Validate enumeration BIOS attributes
if (attributeType == AttributeType::Enumeration)
{
- // For enumeration the expected variant types is std::string
+ // For enumeration the expected variant types is Enumeration
if (std::get<1>(pair.second).index() == 0)
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Enumeration property value is not enum");
throw InvalidArgument();
}
@@ -161,6 +170,8 @@
if (!found)
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "No valid attribute");
throw InvalidArgument();
}
}
@@ -170,6 +181,8 @@
// For enumeration the expected variant types is std::string
if (std::get<1>(pair.second).index() == 0)
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "String property value is not string");
throw InvalidArgument();
}
@@ -198,15 +211,19 @@
if ((attrValue.length() < static_cast<size_t>(minStringLength)) ||
(attrValue.length() > static_cast<size_t>(maxStringLength)))
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "std::string, length is invalid");
throw InvalidArgument();
}
}
if (attributeType == AttributeType::Integer)
{
- // For enumeration the expected variant types is std::string
+ // For enumeration the expected variant types is Integer
if (std::get<1>(pair.second).index() == 1)
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Enumeration property value is not int");
throw InvalidArgument();
}
@@ -237,11 +254,16 @@
if ((attrValue < lowerBound) || (attrValue > upperBound))
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Integer, bound is invalid");
throw InvalidArgument();
}
if (((std::abs(attrValue - lowerBound)) % scalarIncrement) != 0)
{
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "((std::abs(attrValue - lowerBound)) % scalarIncrement) != "
+ "0");
throw InvalidArgument();
}
}