From 33510dc40cd4c89054ef048a4ad9f2fc85484058 Mon Sep 17 00:00:00 2001 From: Graham Williams Date: Mon, 17 Nov 2025 10:04:16 +0000 Subject: [PATCH] Add Ubuntu Advantage Query to Library (#35680) Adds the Ubuntu Advantage policy to the policy library that checks to see if the file exists, and that it is attached, and expiry date has not passed. This can be used in combination with a script automation running `pro attach `, with a tokenID configured in Fleet Variables. E.g: `pro attach $FLEET_SECRET_UBUNTUPRO` for remediation. --------- Co-authored-by: Noah Talerman <47070608+noahtalerman@users.noreply.github.com> --- .../standard-query-library/standard-query-library.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/01-Using-Fleet/standard-query-library/standard-query-library.yml b/docs/01-Using-Fleet/standard-query-library/standard-query-library.yml index f00f447606..dfa8705551 100644 --- a/docs/01-Using-Fleet/standard-query-library/standard-query-library.yml +++ b/docs/01-Using-Fleet/standard-query-library/standard-query-library.yml @@ -184,6 +184,15 @@ spec: contributors: zwass --- apiVersion: v1 +kind: policy +spec: + name: Get Ubuntu Advantage (Ubuntu Pro) attachment status + platform: linux + description: Checks to see if the Ubuntu Pro status file exists, and ensures attachment and expiry are as expected. Combine with a script automation to run the attach command for remediation. + query: SELECT 1 FROM parse_json WHERE path = '/var/lib/ubuntu-advantage/status.json' AND ((key = 'attached' AND value = 'true') OR (key = 'expires' AND datetime(value) > datetime('now'))) GROUP BY path HAVING SUM(CASE WHEN key = 'attached' AND value = 'true' THEN 1 ELSE 0 END) = 1 AND SUM(CASE WHEN key = 'expires' AND datetime(value) > datetime('now') THEN 1 ELSE 0 END) = 1; + contributors: GrayW +--- +apiVersion: v1 kind: query spec: name: Get authorized SSH keys