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

ENT-9931: Guard against /sys/hypervisor/uuid not being readable (3.18) #2718

Merged
merged 1 commit into from
Sep 5, 2023
Merged
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
9 changes: 9 additions & 0 deletions inventory/any.cf
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,15 @@ bundle common cfe_autorun_inventory_aws
scope => "namespace",
if => isvariable("cfe_autorun_inventory_dmidecode.dmi[bios-vendor]");

@if minimum_version(3.22.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a feature registered for the function? Would be nice to be able to so if feature isreadable.

"sys_hypervisor_uuid_readable" -> { "ENT-9931" }
expression => isreadable("/sys/hypervisor/uuid", 1);
@else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay else

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I considered adding a comment like "this could be dangerous, with cat waiting forever, but not likely and certainly not by experimentation, either the file is there or not, and readable, or mysteriously: not."

"sys_hypervisor_uuid_readable" -> { "ENT-9931" }
expression => returnszero("${paths.cat} /sys/hypervisor/uuid 2>/dev/null", "useshell");
@endif

!disable_inventory_aws.sys_hypervisor_uuid_readable::
"ec2_instance" -> { "CFE-2924" }
expression => regline( "^ec2.*", "/sys/hypervisor/uuid" ),
scope => "namespace",
Expand Down
Loading