Skip to content

Commit 8d397cd

Browse files
committed
More updating of auparse normalizer for new syscalls
1 parent c408dd5 commit 8d397cd

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

auparse/normalize-internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@
9393
#define NORM_WHAT_SYSTEM 15
9494
#define NORM_WHAT_AUDIT_RULE 16
9595
#define NORM_WHAT_AUDIT_CONFIG 17
96-
#define NORM_WHAT_MAC_CONFIG 18
96+
#define NORM_WHAT_SECURITY_POLICY 18
9797
#define NORM_WHAT_FILESYSTEM 19
9898
#define NORM_WHAT_MEMORY 20
9999
#define NORM_WHAT_KEYSTROKES 21
100100
#define NORM_WHAT_DEVICE 22
101101
#define NORM_WHAT_SOFTWARE 23
102+
#define NORM_WHAT_INTEGRITY_POLICY 24
102103

103104
// This enum is used to map events to what kind they are
104105
#define NORM_EVTYPE_UNKNOWN 0

auparse/normalize.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ static int normalize_syscall(auparse_state_t *au, const char *syscall)
619619
if (objtype == NORM_UNKNOWN)
620620
normalize_syscall_map_s2i(syscall, &objtype);
621621

622+
// FIXME: Need to address: landlock_*, lsm_*, map_shadow_stack, pkey_*,
623+
// kexec_file_load, They likely need new NORM_* types. Also, these suggest
624+
// that NORM_WHAT_ may need some new types.
622625
switch (objtype)
623626
{
624627
case NORM_FILE:
@@ -778,7 +781,7 @@ static int normalize_syscall(auparse_state_t *au, const char *syscall)
778781
case NORM_MAC_LOAD:
779782
act = normalize_record_map_i2s(ttype);
780783
// FIXME: What is the object?
781-
D.thing.what = NORM_WHAT_MAC_CONFIG;
784+
D.thing.what = NORM_WHAT_SECURITY_POLICY;
782785
break;
783786
case NORM_MAC_CONFIG:
784787
act = normalize_record_map_i2s(ttype);
@@ -789,7 +792,7 @@ static int normalize_syscall(auparse_state_t *au, const char *syscall)
789792
D.thing.primary = set_field(D.thing.primary,
790793
auparse_get_field_num(au));
791794
}
792-
D.thing.what = NORM_WHAT_MAC_CONFIG;
795+
D.thing.what = NORM_WHAT_SECURITY_POLICY;
793796
break;
794797
case NORM_MAC_ENFORCE:
795798
act = normalize_record_map_i2s(ttype);
@@ -800,7 +803,7 @@ static int normalize_syscall(auparse_state_t *au, const char *syscall)
800803
D.thing.primary = set_field(D.thing.primary,
801804
auparse_get_field_num(au));
802805
}
803-
D.thing.what = NORM_WHAT_MAC_CONFIG;
806+
D.thing.what = NORM_WHAT_SECURITY_POLICY;
804807
break;
805808
case NORM_MAC_ERR:
806809
// FIXME: What could the object be?
@@ -1109,7 +1112,10 @@ static int normalize_compound(auparse_state_t *au)
11091112

11101113
otype = type = auparse_get_type(au);
11111114

1112-
// All compound events have a syscall record, find it
1115+
// All compound events have a syscall record, find it. After this
1116+
// loop, type should be syscall, and otype is the original type.
1117+
// Traditionally, the first record is the purpose of the event and
1118+
// the syscall is added on next to support/enhance information content.
11131119
if (type != AUDIT_SYSCALL) {
11141120
do {
11151121
// If we go off the end without finding a syscall
@@ -1359,17 +1365,17 @@ static value_t find_simple_object(auparse_state_t *au, int type)
13591365
break;
13601366
case AUDIT_MAC_CONFIG_CHANGE:
13611367
f = auparse_find_field(au, "bool");
1362-
D.thing.what = NORM_WHAT_MAC_CONFIG;
1368+
D.thing.what = NORM_WHAT_SECURITY_POLICY;
13631369
break;
13641370
case AUDIT_MAC_STATUS:
13651371
f = auparse_find_field(au, "enforcing");
1366-
D.thing.what = NORM_WHAT_MAC_CONFIG;
1372+
D.thing.what = NORM_WHAT_SECURITY_POLICY;
13671373
break;
13681374
// These deal with policy, not sure about object yet
13691375
case AUDIT_MAC_POLICY_LOAD:
13701376
case AUDIT_LABEL_OVERRIDE:
13711377
case AUDIT_DEV_ALLOC ... AUDIT_USER_MAC_CONFIG_CHANGE:
1372-
D.thing.what = NORM_WHAT_MAC_CONFIG;
1378+
D.thing.what = NORM_WHAT_SECURITY_POLICY;
13731379
break;
13741380
case AUDIT_USER:
13751381
f = auparse_find_field(au, "addr");
@@ -1861,7 +1867,7 @@ static int normalize_simple(auparse_state_t *au)
18611867
}
18621868

18631869
// Object type
1864-
D.thing.what = NORM_WHAT_MAC_CONFIG;
1870+
D.thing.what = NORM_WHAT_SECURITY_POLICY;
18651871

18661872
// Results
18671873
set_results(au, 0);

auparse/normalize_obj_kind_map.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* normalize_obj_kind_map.h
3-
* Copyright (c) 2016-18,21 Red Hat Inc.
3+
* Copyright (c) 2016-24 Red Hat Inc.
44
* All Rights Reserved.
55
*
66
* This library is free software; you can redistribute it and/or
@@ -41,9 +41,10 @@ _S(NORM_WHAT_PRINTER, "printer")
4141
_S(NORM_WHAT_SYSTEM, "system")
4242
_S(NORM_WHAT_AUDIT_RULE, "admin-defined-rule")
4343
_S(NORM_WHAT_AUDIT_CONFIG, "audit-config")
44-
_S(NORM_WHAT_MAC_CONFIG, "mac-config")
44+
_S(NORM_WHAT_SECURITY_POLICY, "security-policy")
4545
_S(NORM_WHAT_MEMORY, "memory")
4646
_S(NORM_WHAT_KEYSTROKES, "keystrokes")
4747
_S(NORM_WHAT_DEVICE, "device")
4848
_S(NORM_WHAT_SOFTWARE, "software")
49+
_S(NORM_WHAT_INTEGRITY_POLICY, "integrity-policy")
4950
//_S(, "")

auparse/normalize_syscall_map.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* normalize_syscall_map.h
3-
* Copyright (c) 2016-17,2021-23 Red Hat Inc.
3+
* Copyright (c) 2016-17,2021-24 Red Hat Inc.
44
* All Rights Reserved.
55
*
66
* This library is free software; you can redistribute it and/or
@@ -29,16 +29,19 @@ _S(NORM_FILE_STAT, "faccessat2")
2929
_S(NORM_FILE_CHPERM, "chmod")
3030
_S(NORM_FILE_CHPERM, "fchmod")
3131
_S(NORM_FILE_CHPERM, "fchmodat")
32+
_S(NORM_FILE_CHPERM, "fchmodat2")
3233
_S(NORM_FILE_CHOWN, "chown")
3334
_S(NORM_FILE_CHOWN, "fchown")
3435
_S(NORM_FILE_CHOWN, "fchownat")
36+
_S(NORM_FILE_CHOWN, "fchownat2")
3537
_S(NORM_FILE_CHOWN, "lchown")
3638
_S(NORM_FILE_LDMOD, "finit_module")
3739
_S(NORM_FILE_LDMOD, "init_module")
3840
_S(NORM_FILE_UNLDMOD, "delete_module")
3941
_S(NORM_FILE_CHATTR, "setxattr")
4042
_S(NORM_FILE_CHATTR, "fsetxattr")
4143
_S(NORM_FILE_CHATTR, "lsetxattr")
44+
_S(NORM_FILE_CHATTR, "mount_setattr")
4245
_S(NORM_FILE_DIR, "mkdir")
4346
_S(NORM_FILE_DIR, "mkdirat")
4447
_S(NORM_FILE_MOUNT, "fsconfig")
@@ -55,16 +58,20 @@ _S(NORM_FILE_STAT, "stat64")
5558
_S(NORM_FILE_STAT, "statx")
5659
_S(NORM_FILE_SYS_STAT, "statfs")
5760
_S(NORM_FILE_SYS_STAT, "fstatfs")
61+
_S(NORM_FILE_SYS_STAT, "statmount")
5862
_S(NORM_FILE, "creat")
5963
_S(NORM_FILE, "fallocate")
6064
_S(NORM_FILE, "truncate")
6165
_S(NORM_FILE, "ftruncate")
6266
_S(NORM_FILE, "memfd_create")
67+
_S(NORM_FILE, "memfd_secret")
6368
_S(NORM_FILE, "open")
6469
_S(NORM_FILE, "openat")
6570
_S(NORM_FILE, "openat2")
6671
_S(NORM_FILE, "readlink")
6772
_S(NORM_FILE, "readlinkat")
73+
_S(NORM_FILE, "open_by_handle_at")
74+
_S(NORM_FILE, "pidfd_getfd")
6875
_S(NORM_FILE_CHATTR, "removexattr")
6976
_S(NORM_FILE_CHATTR, "fremovexattr")
7077
_S(NORM_FILE_CHATTR, "lremovexattr")

0 commit comments

Comments
 (0)