Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final docs devel merge #3356

Open
wants to merge 2 commits into
base: docs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/explanations/how_to_interpret_output_of_fix_plan_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ If we take a look at a CVE object, we will see the following structure:
* **title**: The title of the CVE.
* **error**: Any error captured when creating the CVE plan will appear here.
The error object will be detailed in a following section.
* **current_status**: The current status of the CVE showing if the system is
currently affected by the CVE before the plan is executed.
* **expected_status**: The expected status of the CVE if the plan was to be
executed. There are three possible scenarios: **fixed**, **still-affected**
and **not-affected**.
Expand Down
2 changes: 2 additions & 0 deletions docs/howtoguides/fix_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Fix vulnerabilities
* :ref:`Is my system affected by this specific CVE? <pro-fix-check-cve>`
* :ref:`Resolve a single CVE or USN? <pro-fix-resolve-cve>`
* :ref:`How to know what the fix command would change <pro-fix-dry-run>`
* :ref:`How to know if a system is affected by a list of CVEs? <pro-check-list-cves>`
* :ref:`Skip fixing related USNs <pro-fix-skip-related>`
* :ref:`Better visualise results when fixing multiple CVEs <how_to_better_visualise_fixing_multiple_cves>`

Expand All @@ -16,5 +17,6 @@ Fix vulnerabilities
Is my system affected by this specific CVE? <fix_how_to_know_if_system_affected_by_cve>
Resolve a single CVE or USN <fix_how_to_resolve_given_cve>
Discover what the `fix` command would change <fix_how_to_know_what_the_fix_command_would_change>
How to know if a system is affected by a list of CVEs? <how_to_know_if_system_affected_by_a_list_of_cves>
Skip fixing related USNs <fix_how_to_not_fix_related_usns>
Better visualise results when fixing multiple CVEs <fix_how_to_better_visualise_fixing_multiple_cves>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. _pro-check-list-cves:

Check if a system is affected by a list of CVEs?
*********************************************************

.. include:: ../includes/pro-fix-intro.txt

If you have a list of `Common Vulnerabilities and Exposure <cve_>`_ (CVEs) and `Ubuntu Security Notice <usn_>`_ (USNs) and want to check if your Ubuntu system is affected by it, you can check using the ``u.pro.security.fix.cve.plan.v1`` API endpoint as we'll show you in this guide.

.. note::
The ``u.pro.security.fix.cve.plan`` API is provided as a part of the Ubuntu Pro Client (``pro``), which is a security tool for Ubuntu systems. The Ubuntu Pro Client comes pre-installed on every Ubuntu system. You can run ``pro help`` in your terminal window to see a list of the ``pro`` services and commands available.

Using the ``pro.fix.cve.plan`` API
----------------------------------

To check if your system is affected by a list of CVEs, you need to use the ``u.pro.security.fix.cve.plan.v1`` API endpoint since the
``pro fix --dry-run`` CLI command is only used to check individual CVEs. This endpoint will output a JSON blob containing the current status of each CVE, as can be seen :ref:`in the endpoint documentation<references/api:u.pro.security.fix.cve.execute.v1>`.

To better visualise the current status of each CVE from the JSON output we can use a ``jq`` filter.
The ``jq`` command can parse JSON data directly in the terminal, creating a more readable output.
To know more about it, please refer to `the jq manpage <https://manpages.ubuntu.com/manpages/xenial/man1/jq.1.html>`_

First, we need to install ``jq`` by running the following command:

.. code-block:: bash

sudo apt update & sudo apt install jq -y

Once ``jq`` is installed, we can parse the JSON data returned from the plan API.

For example, if we want to see if our system is affected by the following CVEs: **CVE-2020-28196, CVE-2020-15180**
and **CVE-2017-9233**.

We make use of the plan API by running the following command:

.. code-block:: bash

pro api u.pro.security.fix.cve.plan.v1 --data '{"cves": ["CVE-2020-28196", "CVE-2020-15180", "CVE-2017-9233"]}' \
| jq -r '.data.attributes.cves_data.cves[] | "\(.title) (\(.description)) - Current Status: \(.current_status)"'

This command returns output with the following structure:

.. code-block:: bash

CVE-2020-28196 (Kerberos vulnerability) - Current Status: not-affected
CVE-2020-15180 (MariaDB vulnerabilities) - Current Status: not-affected
CVE-2017-9233 (Coin3D vulnerability) - Current Status: not-affected

Note that each entry in this output consists of three fields:

* **CVE NAME**: The name of the CVE
* **CVE DESCRIPTION**: The description of the CVE
* **CVE STATUS**: The current status of the CVE

.. LINKS
.. include:: ../links.txt
Loading