fbocolowski / sssm

Stupid Simple Server Monitor - UN*X Server monitoring app
MIT License
78 stars 10 forks source link

Available firmware updates? #13

Closed hughsie closed 5 years ago

hughsie commented 5 years ago

Would available firmware updates for your hardware be an interesting thing to support? I'm the maintainer of fwupd and can give you some help if this sounds interesting.

fbocolowski commented 5 years ago

That would be great to add! I'm not experienced with fwupd, I'd need help checking if it is installed, running, checking and returning what is available to update using bash only.

hughsie commented 5 years ago

I don't know how to process the JSON data in bash, but this is what other management frameworks use:

$ /usr/libexec/fwupd/fwupdagent get-devices
{
  "Devices" : [
    {
      "Name" : "Walter p50 Thunderbolt Controller",
      "DeviceId" : "dbdb8d90addcba0d96033140993d87a119a14402",
      "Guid" : [
        "9414852e-fa88-51e7-96f5-45268b29b86c"
      ],
      "Summary" : "Unmatched performance for high-speed I/O",
      "Plugin" : "thunderbolt",
      "Flags" : [
        "internal",
        "updatable",
        "registered"
      ],
      "Vendor" : "Lenovo",
      "VendorId" : "TBT:0x0109",
      "Version" : "16.00",
      "Icons" : [
        "computer"
      ],
      "Created" : 1553769204
    },
    {
      "Name" : "Intel AMT [unprovisioned]",
      "DeviceId" : "e2623122c99d58220498aacbfcfdb1baebbae3c5",
      "Guid" : [
        "2800f812-b7b4-2d4b-aca8-46e0ff65814c"
      ],
      "Summary" : "Hardware and firmware technology for remote out-of-band management",
      "Plugin" : "amt",
      "Flags" : [
        "internal",
        "registered"
      ],
      "Vendor" : "Intel Corporation",
      "Version" : "11.8.55.3510",
      "VersionBootloader" : "11.8.55.3510",
      "Icons" : [
        "computer"
      ],
      "Created" : 1553769204
    },
    {
      "Name" : "20EQS64N0C System Firmware",
      "DeviceId" : "2c1302f31806a0e0d57c377d99e18dae56351413",
      "Guid" : [
        "ddc0ee61-e7f0-4e7d-acc5-c070a398838e"
      ],
      "Plugin" : "uefi",
      "Flags" : [
        "internal",
        "updatable",
        "require-ac",
        "supported",
        "registered",
        "needs-reboot"
      ],
      "Checksums" : [
        "26abbeecd6db22f75caab50c17a9719f87215ab7"
      ],
      "Version" : "0.1.55",
      "VersionLowest" : "0.1.46",
      "Icons" : [
        "computer"
      ],
      "Created" : 1553769204,
      "Releases" : [
        {
          "AppstreamId" : "com.lenovo.ThinkPadN1EET.firmware",
          "RemoteId" : "lvfs",
          "Summary" : "Lenovo ThinkPad P50 System Firmware",
          "Description" : "<p>Lenovo ThinkPad P50 System Firmware Version 1.55</p><p>The computer will be restarted automatically after updating BIOS completely .</p><p>Do NOT turn off your computer or remove the AC adaptor while update is in progress.</p><p>This update also adds the following features:</p><ul><li>Updated the Diagnostics module to full version 04.05.000.</li><li>Fixed an issue where SAMSUNG PM871 SSD might not be detected correctly</li></ul><p>after system restart.</p>",
          "Version" : "0.1.55",
          "Filename" : "6e6634005b16f8fc9d4f9c565513806bb796a7eb",
          "Checksum" : [
            "0fcf95c77272ff5dc865bbf0b90a3715627dc640"
          ],
          "License" : "proprietary",
          "Size" : 9417280,
          "Uri" : "https://fwupd.org/downloads/724ceae1d719a9df967d46fa790e6c8a7541e9ff-Lenovo-ThinkPad-P50-SystemFirmware-1.55.cab",
          "Homepage" : "http://www.lenovo.com/",
          "Vendor" : "Lenovo Ltd."
        },
        {
          "AppstreamId" : "com.lenovo.ThinkPadN1EET.firmware",
          "RemoteId" : "lvfs",
          "Summary" : "Lenovo ThinkPad P50 System Firmware",
          "Description" : "<p>Lenovo ThinkPad P50 System Firmware Version 1.54</p><p>The computer will be restarted automatically after updating BIOS completely . Do NOT turn off your computer or remove the AC adaptor while update is in progress.</p><p>This update also adds the following features:</p><ul><li>Update includes a security fix.</li><li>Updated the Diagnostics module to version 04.05.000.</li></ul>",
          "Version" : "0.1.54",
          "Filename" : "0b21baecfec04863055be220d340b8c7b399d4f9",
          "Checksum" : [
            "9e4412f7c117b5c2037133375a7a3d4c16d52687"
          ],
          "License" : "proprietary",
          "Size" : 9417280,
          "Uri" : "https://fwupd.org/downloads/bbc0f26e38dcab777f601b05371af4ea783c6b91-Lenovo-ThinkPad-P50-SystemFirmware-1.54.cab",
          "Homepage" : "http://www.lenovo.com/",
          "Vendor" : "Lenovo Ltd.",
          "Flags" : [
            "is-downgrade"
          ]
        },
        {
          "AppstreamId" : "com.lenovo.ThinkPadN1EET.firmware",
          "RemoteId" : "lvfs",
          "Summary" : "Lenovo ThinkPad P50 System Firmware",
          "Description" : "<p>The computer will be restarted automatically after updating BIOS completely. Do NOT turn off your computer or remove the AC adaptor while update is in progress.</p><p>This update fixes the following important problems:</p><ul><li>Update includes a security fix.</li><li>Security fix addresses LEN-23848 Insecure Handling of BIOS and AMT Passwords in Intel Platform Sample Firmware (CVE-2017-5704). Refer to Lenovo&apos;s Security Advisory page for additional information.</li></ul><p>This update fixes the following problems:</p><ul><li>Fixed an issue where the system may not unlock by TPM pin code.</li></ul>",
          "Version" : "0.1.53",
          "Filename" : "f1f0ec02ac5448e891adb1f3e5d1406d4e82043b",
          "Checksum" : [
            "75d00d8561d575deec6697f1f924267dd80350f2"
          ],
          "License" : "proprietary",
          "Size" : 9417280,
          "Uri" : "https://fwupd.org/downloads/1ff6c29e2af399121417316e24781bb25f6712b8-Lenovo-ThinkPad-P50-SystemFirmware-1.53.cab",
          "Homepage" : "http://www.lenovo.com/",
          "Vendor" : "Lenovo Ltd.",
          "Flags" : [
            "is-downgrade"
          ]
        },
        {
          "AppstreamId" : "com.lenovo.ThinkPadN1EET.firmware",
          "RemoteId" : "lvfs",
          "Summary" : "Lenovo ThinkPad P50 System Firmware",
          "Description" : "<p>The computer will be restarted automatically after updating BIOS completely. Do NOT turn off your computer or remove the AC adaptor while update is in progress.</p><p>This update also adds the following features:</p><ul><li>Updated the Diagnostics module to version 04.00.001.</li></ul><p>This update fixes the following problems:</p><ul><li>Fixed an issue where BIOS POST might display the error message &quot;Boot Manager recover from an error.&quot;</li></ul>",
          "Version" : "0.1.52",
          "Filename" : "5751003d5e563a09b0d0771abb34fa6cdf35bc44",
          "Checksum" : [
            "eaa39283a0f75dddf9f98409258e3a09027b3f9d"
          ],
          "License" : "proprietary",
          "Size" : 9417280,
          "Uri" : "https://fwupd.org/downloads/1c03e1b5491094429129b3eef952816c21777281-Lenovo-ThinkPad-P50-SystemFirmware-1.52.cab",
          "Homepage" : "http://www.lenovo.com/",
          "Vendor" : "Lenovo Ltd.",
          "Flags" : [
            "is-downgrade"
          ]
        }
      ]
    },
    {
      "Name" : "UEFI Device Firmware",
      "DeviceId" : "1f9ed21ce218ebcd0e1c803b7da08dd4e33d01a3",
      "Guid" : [
        "671d19d0-d43c-4852-98d9-1ce16f9967e4"
      ],
      "Plugin" : "uefi",
      "Flags" : [
        "internal",
        "updatable",
        "require-ac",
        "supported",
        "registered",
        "needs-reboot"
      ],
      "Version" : "184.55.3510",
      "VersionLowest" : "0.0.1",
      "Icons" : [
        "audio-card"
      ],
      "Created" : 1553769204,
      "Releases" : [
        {
          "AppstreamId" : "com.lenovo.ThinkPadN1DRMP50.firmware",
          "RemoteId" : "lvfs",
          "Summary" : "Lenovo ThinkPad P50 Corporate ME Firmware",
          "Description" : "<ul><li>8 Quarterly Security Release</li></ul><p>Version 11.8.60.3561 (LVFS: 184.60.3561)</p><p>Problem Fixes</p><ul><li>Intel CSME PSIRT-TA-201810-004 Q4 2018 QSR:</li><li>Mitigated the following security vulnerabilities:</li><li>CVE-2018-12188, CVE-2018-12189, CVE-2018-12190, CVE-2018-12191, CVE-2018-12192, CVE-2018-12199, CVE-2018-12187, CVE-2018-12196 and CVE-2018-12185.</li><li>Disabling &quot;User CAPS STATE&quot; in BIOS will issue a global reset.</li><li>A mismatch between the FW and the SMBIOS table when displaying the Processor upgrade info value.</li><li>Intel(R) ME does not work properly after performing FW Update.</li><li>PKI Provisioning fails.</li><li>Wrong device ID is displayed in FParts.txt file.</li><li>Firmware reset occurs when loading web storage, when using MeshCommander.</li><li>Wrong Intel(R) LMS version is displayed when executing &quot;Meinfowin64.exe&quot;</li><li>When starting user consent flow, MEBX Consent is not displayed.</li><li>Wrong values displayed In Intel(R) MEInfo:&quot;FPF HW Source value&quot; and &quot;ME FPF Fusing Patch Status&quot;</li><li>Intel(R) FPT, FPT Operation fails when executing &quot;Fpt.efi -i&quot;.</li></ul>",
          "Version" : "184.60.3561",
          "Filename" : "0e3597967f2295dc6dd60b0933849d8da8b93584",
          "Checksum" : [
            "d62c96be9b35a077b9433f9207d1b0781131d93c"
          ],
          "License" : "proprietary",
          "Size" : 7522928,
          "Uri" : "https://fwupd.org/downloads/9b37cecbcf73a7dcf5588e11d8063da06d6d05ce-Lenovo-ThinkPad-P50-CorporateMEFirmware-11.8.60.3561.cab",
          "Homepage" : "http://www.lenovo.com/",
          "Vendor" : "Lenovo Ltd.",
          "Flags" : [
            "is-upgrade"
          ]
        },
        {
          "AppstreamId" : "com.lenovo.ThinkPadP50RM.firmware",
          "RemoteId" : "lvfs",
          "Summary" : "Lenovo ThinkPad P50 ME Firmware",
          "Description" : "<ul><li>8 Quarterly Security Release, version 11.8.55.3510 (LVFS: 184.55.3510)</li></ul><p>Problem Fixes:</p><ul><li>Intel CSME PSIRT-TA-201805-001-Q2-2018-CSME-QSR:</li><li>Fixed an issue where Intel(R) AMT might fail to connect to 802.1x WLAN Environment.</li></ul><p>Mitigated the following security vulnerabilities:</p><ul><li>CVE-2018-3655, CVE-2018-3657, CVE-2018-3658, CVE-2018-3659, CVE-2018-3616, CVE-2018-3643 and CVE-2018-3644</li></ul>",
          "Version" : "184.55.3510",
          "Filename" : "c90fd4503a283875a40981e1445e281cd782b546",
          "Checksum" : [
            "f8b479ff16b5740f736f52528dc52a9df122c204"
          ],
          "License" : "proprietary",
          "Size" : 7522848,
          "Uri" : "https://fwupd.org/downloads/9f717f783a0df21160465908c5b271cd999fc4fb-Lenovo-ThinkPad-P50-MEFirmware-11.8.55.3510.cab",
          "Homepage" : "http://www.lenovo.com/",
          "Vendor" : "Lenovo Ltd."
        }
      ]
    },
    {
      "Name" : "UEFI Device Firmware",
      "DeviceId" : "6c8326bcda55dc53571921c60da36f320d3efa3f",
      "Guid" : [
        "a9971959-9246-4a5b-b2f2-ba6fdcb19349"
      ],
      "Plugin" : "uefi",
      "Flags" : [
        "internal",
        "updatable",
        "require-ac",
        "registered",
        "needs-reboot"
      ],
      "Version" : "0.1.17",
      "VersionLowest" : "0.0.1",
      "Icons" : [
        "audio-card"
      ],
      "Created" : 1553769204
    },
    {
      "Name" : "LITEONIT LCS-256M6S",
      "DeviceId" : "948241a24320627284597ec95079cc1341c90518",
      "Guid" : [
        "d8f956ce-c4fc-5e9d-99f9-2458b03008f0",
        "603577bb-08f5-54b2-a824-f6fe008cad98",
        "6cfdfbc5-2f74-59d8-8729-3c55daf02bee"
      ],
      "Summary" : "ATA Drive",
      "Plugin" : "ata",
      "Flags" : [
        "internal",
        "updatable",
        "require-ac",
        "registered",
        "needs-reboot"
      ],
      "Version" : "1C85205",
      "Icons" : [
        "drive-harddisk"
      ],
      "Created" : 1553769204
    },
    {
      "Name" : "SATA SSD",
      "DeviceId" : "612faa85309fec62ddfdce9f4635cdfef838d74e",
      "Guid" : [
        "a8e0709c-5214-53df-bd41-5faf36394126",
        "e6fd9e43-61db-5303-9fb5-8a997cbbe585",
        "ef0645fb-0011-5566-b655-ab24bb26b354"
      ],
      "Summary" : "ATA Drive",
      "Plugin" : "ata",
      "Flags" : [
        "internal",
        "updatable",
        "require-ac",
        "registered",
        "needs-reboot"
      ],
      "Version" : "SBFM61.3",
      "Icons" : [
        "drive-harddisk"
      ],
      "Created" : 1553769204
    },
    {
      "Name" : "THNSN5512GPU7 TOSHIBA",
      "DeviceId" : "c82980cd3fe66f7d0a8bb83b353cbc271177efd4",
      "Guid" : [
        "e22c4520-43dc-5bb3-8245-5787fead9b63",
        "83991323-9951-5adf-b743-d93e882a41e1",
        "ad9fe8f7-cdc4-52c9-9fea-31b6f4988ffa",
        "e1409b09-50cf-5aef-8ad8-760b9022f88d"
      ],
      "Summary" : "NVM Express Solid State Drive",
      "Plugin" : "nvme",
      "Flags" : [
        "internal",
        "updatable",
        "require-ac",
        "registered",
        "needs-reboot"
      ],
      "Vendor" : "Toshiba America Info Systems",
      "VendorId" : "NVME:0x1179",
      "Version" : "410557LA",
      "Icons" : [
        "drive-harddisk"
      ],
      "Created" : 1553769204
    },
    {
      "Name" : "GM107GLM [Quadro M1000M]",
      "DeviceId" : "71b677ca0f1bc2c5b804fa1d59e52064ce589293",
      "Guid" : [
        "b2d2c546-663a-557d-9c41-e2ec822aead2",
        "d38b33db-30ea-5ea1-a848-38d116c3d57b",
        "924bbf24-f21c-5c11-939e-e8c56e7c74af"
      ],
      "Plugin" : "udev",
      "Flags" : [
        "internal",
        "registered"
      ],
      "Vendor" : "NVIDIA Corporation",
      "VendorId" : "PCI:0x10DE",
      "Version" : "a2",
      "Icons" : [
        "audio-card"
      ],
      "Created" : 1553769205
    },
    {
      "Name" : "HD Graphics 530",
      "DeviceId" : "bbbf1ce3d1cf15550c3760b354592040292415bb",
      "Guid" : [
        "fb0e4398-241c-5c36-ab78-398aa4ed66e5",
        "be415cfb-b50d-5724-9483-7a56f16d0d70",
        "afb8c4ec-b9a5-5cd3-aaef-cc976ce37eb8"
      ],
      "Plugin" : "udev",
      "Flags" : [
        "internal",
        "registered"
      ],
      "Vendor" : "Intel Corporation",
      "VendorId" : "PCI:0x8086",
      "Version" : "06",
      "Icons" : [
        "audio-card"
      ],
      "Created" : 1553769205
    },
    {
      "Name" : "Unifying Receiver",
      "DeviceId" : "73a5277eb354722415213d7aaf3b8bbd22546cc9",
      "Guid" : [
        "cc4cbfa9-bf9d-540b-b92b-172ce31013c1",
        "279ed287-3607-549e-bacc-f873bb9838c4",
        "21e75d9a-5ce6-5da2-b7ab-910c7f3f6836"
      ],
      "Summary" : "A miniaturised USB wireless receiver",
      "Plugin" : "unifying",
      "Flags" : [
        "updatable",
        "supported",
        "registered"
      ],
      "Vendor" : "Logitech",
      "VendorId" : "USB:0x046D",
      "Version" : "RQR24.06_B0030",
      "VersionBootloader" : "BOT03.01_B0008",
      "Icons" : [
        "preferences-desktop-keyboard"
      ],
      "InstallDuration" : 7,
      "Created" : 1553784884,
      "Releases" : [
        {
          "AppstreamId" : "com.logitech.Unifying.RQR24.firmware",
          "RemoteId" : "lvfs",
          "Summary" : "Firmware for the Logitech Unifying receiver",
          "Description" : "<p>This release addresses an unencrypted keystroke injection issue known as Bastille security issue #11. The vulnerability is complex to replicate and would require a hacker to be physically close to a target.</p>",
          "Version" : "RQR24.05_B0029",
          "Filename" : "96a92915c9ebaf3dd232cfc7dcc41c1c6f942877",
          "Checksum" : [
            "0e7e9dafeb4dcc144d1434759ebf7bd71ea2a4d7"
          ],
          "License" : "Proprietary",
          "Size" : 86406,
          "Uri" : "https://fwupd.org/downloads/4511b9b0d123bdbe8a2007233318ab215a59dfe6-Logitech-Unifying-RQR24.05_B0029.cab",
          "Homepage" : "http://support.logitech.com/en-us/software/unifying",
          "Vendor" : "Logitech",
          "Flags" : [
            "is-downgrade"
          ],
          "InstallDuration" : 7
        }
      ]
    }
  ]
}
fbocolowski commented 5 years ago

Tested this command on my Fedora machine and it worked! Waiting help to parse this JSON and generate the data to show up.

hughsie commented 5 years ago

What kind of data are you expecting to output? I don't know what the "destination" is :)

fbocolowski commented 5 years ago

I'm thinking of reading this JSON and outputing to the SysAdmin that some firmware has an update available - then show up which one, etc.