Skip to content

Commit 2384986

Browse files
audit: Do not audit ephemeral users
Ephemeral users are used by auditing and schema registry. There is no reason to audit the auditing ephemeral user as that does not correspond to a user derived action. For schema registry, there are already audit events tracked when the user access SR via the SR API. It isn't necessary to audit that the SR client has performed an action. Signed-off-by: Michael Boquard <michael@redpanda.com>
1 parent 9898ba9 commit 2384986

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

src/v/security/audit/audit_log_manager.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,12 +1081,21 @@ audit_log_manager::should_enqueue_audit_event(
10811081
return should_enqueue_audit_event();
10821082
}
10831083

1084+
namespace {
1085+
bool is_ignored_ephemeral_user(const security::acl_principal& principal) {
1086+
return principal == security::audit_principal
1087+
|| principal == security::schema_registry_principal;
1088+
}
1089+
} // namespace
1090+
10841091
std::optional<audit_log_manager::audit_event_passthrough>
10851092
audit_log_manager::should_enqueue_audit_event(
10861093
event_type type,
10871094
const security::acl_principal& principal,
10881095
ignore_enabled_events ignore_events) const {
1089-
if (_audit_excluded_principals.contains(principal)) {
1096+
if (
1097+
_audit_excluded_principals.contains(principal)
1098+
|| is_ignored_ephemeral_user(principal)) {
10901099
return std::make_optional(audit_event_passthrough::yes);
10911100
}
10921101

tests/rptest/tests/audit_log_test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,27 @@ def test_authn_messages(self):
16121612
assert len(
16131613
records) == 1, f"Expected only one record got {len(records)}"
16141614

1615+
@skip_fips_mode
1616+
@cluster(num_nodes=5)
1617+
def test_no_ephemeral_user(self):
1618+
"""
1619+
Verifies that ephemeral users do not generate audit messages
1620+
"""
1621+
self.setup_cluster()
1622+
1623+
user_rpk = self.get_rpk()
1624+
1625+
_ = user_rpk.list_topics()
1626+
1627+
start_time = time.time()
1628+
1629+
# Read all records that have the audit log user for two seconds - should not get any records
1630+
records = self.read_all_from_audit_log(partial(self.authn_filter_function, self.kafka_rpc_service_name, "__auditing", 99, "SASL-SCRAM"),
1631+
lambda records: time.time() >= start_time + 2)
1632+
1633+
assert len(records) == 0, f'Expected 0 records: {records}'
1634+
1635+
16151636
@skip_fips_mode
16161637
@cluster(num_nodes=5)
16171638
def test_authn_failure_messages(self):

0 commit comments

Comments
 (0)