Commit Graph

16 Commits

Author SHA1 Message Date
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Gary Lin
b54f4706cb redfish: Add an option for CA verification
Since the Redfish service may use a self-signed certificate without
specifying the hostname, we could have the problem to verify such
certificate. A new option, CACheck, is introduced so that the user can
decide whether to ignore the CA verification or not.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
986c0ebe77 redfish: Check validity of the json objects
We might get a NULL json object.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
7f79aa9ea7 redfish: Upload the firmware blob through HttpPushUri
Create a multipart request to upload the firmware blob

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
e5154d3ac3 redfish: Assume the device is updatable by default
The "Updateable" field may not be available.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
2e0e179298 redfish: Read options from redfish.conf
This commit adds redfish.conf to configure the IP and username/password
in case those are not available in SMBIOS and the EFI variables.

Since we can configure the IP in the conf file, the environment
variable, FWUPD_REDFISH_URI, is removed.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
27986ebf3e redfish: Generate IDs for redfish devices
Generate IDs for redfish devices and skip the devices without a
proper GUID.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
213bdf0637 redfish: Fetch the inventory collection
All inventory members are in the inventory collection.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
ce8aa4f84a redfish: Always use Basic Auth
Although SoupAuthManager can create a proper SoupAuth from the
WWW-Authenticate header, some redfish implementations didn't provide
such header, and we would get a 401 response in the end.

In DSP0266, it mentions that "HTTP BASIC authentication as defined by
RFC7235 shall be supported", so it shall be safe to use Basic Auth
by default.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
95ee874b2e redfish: Remove the json object of Links
UpdateService is in the root json object, so we don't need the Links
json object.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
701b46bbb2 redfish: Adjust the first redfish path
Change the redfish path from "/redfish/v1" to "/redfish/v1/" so that we
don't have to handle 308 redirect.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
3456238f0a redfish: Detect the HPE DeviceClass
DeviceClass in Oem/Hpe indicates the type of device in the HPE machine.
In case SoftwareId is absent, we can use DeviceClass instead.

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
ad594286b2 redfish: Check "Updateable" and "SoftwareId" before using them
Although "Updateable" is defined in SoftwareInventory schema since
redfish v1.0.0, some machines(*) didn't support the field.

"SoftwareId" is defined in SoftwareInventory schema since v1.1.0, so
it probably isn't supported by every redfish machines.

(*) Try "/redfish/v1/UpdateService/FirmwareInventory/1/" with HPE DL380
    Gen 10 in https://ilorestfulapiexplorer.ext.hpe.com/

Signed-off-by: Gary Lin <glin@suse.com>
2018-08-06 06:19:56 +01:00
Gary Lin
af71145c67 redfish: Fetch the inventory member correctly
In the Members array of FirmwareInventory or SoftwareInventory, each
element of the array only contains the URI to the member. For example:

  "Members":
  [
    {
      "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/1/"
    },
    {
      "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/2/"
    },
    {
      "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/3/"
    }
  ]

We have to get the real member object through the given URI.
2018-07-23 09:19:18 +01:00
Gary Lin
aeaf444835 redfish: Amend the retrieval of version
In the redfish emulator, "/redfish/v1" returns "ServiceVersion".
However, in the HPE API explorer(*), it returns "RedfishVersion".
This commit checks both member and print the one that is available.

(*) https://ilorestfulapiexplorer.ext.hpe.com/
2018-07-06 08:48:58 +01:00
Richard Hughes
ba103483fa redfish: Add a plugin that uses the Redfish API
Redfish is an open industry standard specification and schema that helps enable
simple and secure management of modern scalable platform hardware.

This has only ever been tested using an emulator and not on real hardware.
2018-06-29 20:17:45 +01:00