RyChannel
02/25/2026, 4:15 PMHeston Snodgrass
02/25/2026, 5:00 PMSce_audit_rule[SCE audit privileged commands]. If you look at the puppetserver debug logs and agent run debug logs it may give more info as to what's going onRyChannel
02/25/2026, 5:02 PMHeston Snodgrass
02/25/2026, 5:22 PMRyChannel
02/25/2026, 5:23 PMRyChannel
02/25/2026, 5:23 PMHeston Snodgrass
02/25/2026, 5:24 PMHeston Snodgrass
02/25/2026, 5:25 PMRyChannel
02/25/2026, 5:25 PMHeston Snodgrass
02/25/2026, 5:26 PMHeston Snodgrass
02/25/2026, 5:30 PM# This class provides a set of heuristics for determining if a rule is
# roughly equivalent to another rule. This is used by the `sce_audit_rule`
# provider class method `#find_provider_for_resource` to determine if a
# rule on the system is already managed by a resource.
# Currently, this is robust enough to handle the rules created when
# specifying `$for_all_privileged_commands = true`, but may not be
# robust enough to handle all cases.
class RuleHeuristics
SIMILARITY_ATTRS = %i[key dir path].freeze
def initialize(rule)
@rule = Rules::Parser.parse_rule(rule)
end
# @param rule [String, Hash, PuppetX::Puppetlabs::Sce::AuditdHelper::Rules::Parser::Rule]
# The rule to compare against. If a string or hash is given, it will be parsed
# into a rule object. If a rule object is given, it will be used as-is.
def similar?(rule)
other_h = RuleHeuristics.new(rule)
SIMILARITY_ATTRS.all? { |attr| attr_eq?(attr, other_h) }
end
def key
@key ||= find_flag_or_field_value('key')
end
def dir
@dir ||= find_field_value('dir')
end
def path
@path ||= find_field_value('path')
end
private
def attr_eq?(attribute, other_h)
send(attribute) == other_h.send(attribute)
end
def find_field_value(field_name)
find_flag_value do |f|
f.option_name == 'field' && f.value_parts[:field_name] == field_name
end
end
# @yield [PuppetX::Puppetlabs::Sce::AuditdHelper::Rules::Parser::Flag] A flag object
def find_flag_value
return unless block_given?
value(@rule.flags.find { |f| yield(f) })
end
# @param flag_name [String] The name of the flag to find
# @param field_name [String] The name of the field to find, if different from the flag name
# @return [Any] The value of the flag or field, if found
def find_flag_or_field_value(flag_name, field_name = nil)
field_name ||= flag_name
found = @rule.flags.find do |f|
f.option_name == flag_name || (f.option_name == 'field' && f.value_parts[:field_name] == field_name)
end
value(found)
end
def value(flag_obj)
flag_obj&.value
end
endHeston Snodgrass
02/25/2026, 5:31 PMRyChannel
02/25/2026, 5:32 PMHeston Snodgrass
02/25/2026, 5:35 PM'Auditd is configured to be immutable, unable to load rules without a machine reboot.'RyChannel
02/25/2026, 5:36 PMHeston Snodgrass
02/25/2026, 5:36 PMRyChannel
02/25/2026, 5:37 PMHeston Snodgrass
02/25/2026, 5:41 PMHeston Snodgrass
02/25/2026, 5:41 PM