| commit | e5a99777b8710cdcc82bffb25a7a248e18705e2d | [log] [tgz] |
|---|---|---|
| author | Albert Zhang <zhanghaodi@inspur.com> | Tue Jun 15 17:53:56 2021 +0800 |
| committer | Ed Tanous <ed@tanous.net> | Fri Jun 18 18:19:19 2021 +0000 |
| tree | a04425d3aebfc7dc778edfd76927c7703099d473 | |
| parent | 0256b69420e2b99eb0494334da71dd50f457a8e8 [diff] |
Redfish: Allow disabling and enabling SSH
This patch adds support for disabling and enabling SSH using
Redfish API.
Tested:Validator passes
1.Disabled SSH from Redfish and verified cannot open a new SSH
connection to the machine, but the original SSH connection still
takes effect and verified ProtocolEnabled is false for SSH.
curl -k -H "X-Auth-Token: $token" -X GET
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol/
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
...
"SSH": {
"Port": 22,
"ProtocolEnabled": true
},
...
}
curl -k -H "X-Auth-Token: $token" -X PATCH '-d
{"SSH": {"ProtocolEnabled": false}}'
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol/
Open a new SSH connection:
sudo ssh username@<IP>
ssh: connect to host <IP> port 22: Connection refused
curl -k -H "X-Auth-Token: $token" -X GET
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol/
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
...
"SSH": {
"Port": 22,
"ProtocolEnabled": false
},
...
}
D-bus has changed to :
busctl introspect xyz.openbmc_project.Control.Service.Manager
/xyz/openbmc_project/control/service/dropbear
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
... ... ...
xyz.openbmc_project.Control.Service.Attributes interface
.Enabled property b false emits-change writable
.Masked property b false emits-change writable
.Running property b false emits-change writable
...
2.Abled SSH from Redfish, verified can open a new SSH
connection to the machine and ProtocolEnabled is true for SSH.
curl -k -H "X-Auth-Token: $token" -X GET
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol/
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
...
"SSH": {
"Port": 22,
"ProtocolEnabled": false
},
...
}
curl -k -H "X-Auth-Token: $token" -X PATCH '-d
{"SSH": {"ProtocolEnabled": false}}'
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol/
Open a new SSH connection:
sudo ssh username@<IP>
Successfully connected
curl -k -H "X-Auth-Token: $token" -X GET
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol/
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
...
"SSH": {
"Port": 22,
"ProtocolEnabled": true
},
...
}
D-bus has changed to :
busctl introspect xyz.openbmc_project.Control.Service.Manager
/xyz/openbmc_project/control/service/dropbear
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
... ... ...
xyz.openbmc_project.Control.Service.Attributes interface
.Enabled property b true emits-change writable
.Masked property b false emits-change writable
.Running property b true emits-change writable
...
Signed-off-by: Albert Zhang <zhanghaodi@inspur.com>
Change-Id: Ifd80db4d33934e83d4e5f337e5dfd02b4ba39018
This component attempts to be a "do everything" embedded webserver for openbmc.
At this time, the webserver implements a few interfaces:
BMCWeb is configured by setting -D flags that correspond to options in bmcweb/meson_options.txt and then compiling. For example, meson <builddir> -Dkvm=disabled ... followed by ninja in build directory. The option names become C++ preprocessor symbols that control which code is compiled into the program.
meson builddir ninja -C builddir
meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled ninja -C buildir
If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in bmcweb/subprojects.
meson builddir -Dwrap_mode=nofallback ninja -C builddir
meson builddir -Dbuildtype=debug ninja -C builddir
meson builddir -Db_coverage=true -Dtests=enabled ninja coverage -C builddir test
When BMCWeb starts running, it reads persistent configuration data (such as UUID and session data) from a local file. If this is not usable, it generates a new configuration.
When BMCWeb SSL support is enabled and a usable certificate is not found, it will generate a self-sign a certificate before launching the server. The keys are generated by the secp384r1 algorithm. The certificate
C=US, O=OpenBMC, CN=testhost,SHA-256 algorithm.