-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix audit rule removal upon osquery exit #7221
Fix audit rule removal upon osquery exit #7221
Conversation
22a85ad
to
4cf4dcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prateeknischal thanks for looking into this!
There's only one correction to be done and then it's good to go!
} else if (FLAGS_audit_debug) { | ||
VLOG(1) << "Audit rule installed for all queued syscalls"; | ||
} | ||
|
||
if (FLAGS_audit_force_unconfigure) { | ||
if (FLAGS_audit_force_reconfigure || rule_add_error >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FLAGS_audit_force_reconfigure
should be FLAGS_audit_force_unconfigure
.
Reconfigure is a "stronger" operation than unconfigure and it lists all the rules currently active on it's own and removes them (among other things).
Unconfigure is meant to remove all rules that osquery has ever added, even if they have not been added in the current run. But rules that have been added by an administrator should not be touched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah, the autocomplete, I had intended to write unconfigure
, I would have accepted this suggestion from the autocomplete. I should have been more careful. Thank you for the review. I have updated the pull request.
The audit rules were not getting removed when osquery exits as part of the cleanup process. This was due to not adding the audit rule to the cleanup list unless osquery was run with --audit_force_unconfigure. The force unconfigure option is to remove the rules irrespective of the their install exit code which was not followed in the osquery#7063. The current fix is going to install the rule for cleanup either the error code is non-negative or osquery is asked to force reconfigure. This would also fix the double adding of the audit rules as mentioned in osquery#7205.
4cf4dcc
to
24fcf05
Compare
…1 to master * commit 'f72b7c5510b8cd78c9d0450cbd1f31903681caa5': (53 commits) Add `TimeoutStopSec` to systemd unit files (osquery#7190) Prevent osquery from killing itself when the --force flag is used (osquery#7295) Linux: Support AF_PACKET sockets. (osquery#7282) libs: update openssl to 1.1.1l (osquery#7293) Correct macOS installed app bundle path in osqueryctl and doc (osquery#7289) macos path fix in launchd plist (osquery#7288) Update osquery installed artifacts default paths in code (osquery#7285) Update osquery installed artifacts paths in the documentation (osquery#7286) Update packaging SHA (osquery#7279) Change to the `disk_encryption` table to support QueryContext (osquery#7209) Add feature to skip denylist for event-based queries (osquery#7158) Support pid_with_namespace in more tables (osquery#7132) audit: socket_events improvements (osquery#7269) [linux][packaging] Update packaging paths (osquery#7271) Change logger_mode flag to be actually interpreted as an octal (osquery#7273) Update `uptime` table descrption (osquery#7270) [macOS][packaging] Create an app bundle along with other package_data (osquery#7263) Add case sensitive pragma to the pragma/actions authorizer allow list (osquery#7267) Fix audit rule removal upon osquery exit (osquery#7221) Fix osquery_info build_platform column value on Linux (osquery#7254) ...
The audit rules were not getting removed when osquery exits as part of
the cleanup process. This was due to not adding the audit rule to the
cleanup list unless osquery was run with
--audit_force_unconfigure
. Theforce unconfigure option is to remove the rules irrespective of the their
install exit code which was not followed in the #7063.
The current fix is going to install the rule for cleanup either the error
code is non-negative or osquery is asked to force reconfigure. This would
also fix the double adding of the audit rules as mentioned in #7205.