@@ -28,9 +28,13 @@ system("auditctl -D >& /dev/null");
28
28
UNLINK => 1);
29
29
(my $fh_err , my $stderr ) = tempfile(TEMPLATE => ' /tmp/audit-testsuite-err-XXXX' ,
30
30
UNLINK => 1);
31
- (my $fh_ses , my $sesout ) = tempfile(TEMPLATE => ' /tmp/audit-testsuite-tmp-XXXX' ,
31
+ (my $fh_out_set , my $stdout_set ) = tempfile(TEMPLATE => ' /tmp/audit-testsuite-out-set-XXXX' ,
32
+ UNLINK => 1);
33
+ (my $fh_err_set , my $stderr_set ) = tempfile(TEMPLATE => ' /tmp/audit-testsuite-err-set-XXXX' ,
34
+ UNLINK => 1);
35
+ (my $fh_ses , my $sesout ) = tempfile(TEMPLATE => ' /tmp/audit-testsuite-ses-XXXX' ,
32
36
UNLINK => 1);
33
- (my $fh_pid , my $pidout ) = tempfile(TEMPLATE => ' /tmp/audit-testsuite-tmp -XXXX' ,
37
+ (my $fh_pid , my $pidout ) = tempfile(TEMPLATE => ' /tmp/audit-testsuite-pid -XXXX' ,
34
38
UNLINK => 1);
35
39
36
40
# ##
@@ -47,19 +51,24 @@ chomp($sessionid);
47
51
my $key = key_gen();
48
52
$result = system (" auditctl -a always,exit -F arch=b64 -F path=/tmp/$key -F sessionid=$sessionid -k $key " );
49
53
ok($result , 0);
54
+ $result = system (" auditctl -a always,exit -F arch=b64 -F path=/tmp/${key} _set -F sessionid_set=1 -k ${key} _set" );
55
+ ok($result , 0);
50
56
51
57
# send the userspace message (NOTE: requires bash)
52
- system (" echo \$\$ > $pidout ; exec touch /tmp/$key " );
58
+ system (" echo \$\$ > $pidout ; exec touch /tmp/$key /tmp/ ${key} _set " );
53
59
my $pid = <$fh_pid >;
54
60
chomp ($pid );
55
61
56
62
# test for the SYSCALL message
57
63
$result = system (" ausearch -i -m SYSCALL -sc open -p $pid --session $sessionid -k $key > $stdout 2> $stderr " );
58
64
ok($result , 0);
65
+ $result = system (" ausearch -i -m SYSCALL -sc open -p $pid --sessionid_set 1 -k ${key} _set > $stdout_set 2> $stderr_set " );
66
+ ok($result , 0);
59
67
60
68
# test if we generate the SYSCALL record correctly
61
69
my $line ;
62
70
my $syscall_msg_match = 0;
71
+ my $syscall_msg_match_set = 0;
63
72
while ($line = <$fh_out >) {
64
73
# test if SYSCALL record matches
65
74
if ($line =~ m ? ^type=SYSCALL ? and
@@ -71,6 +80,17 @@ while ($line = <$fh_out>) {
71
80
}
72
81
}
73
82
ok($syscall_msg_match );
83
+ while ($line = <$fh_out_set >) {
84
+ # test if SYSCALL record matches
85
+ if ($line =~ m ? ^type=SYSCALL ? and
86
+ $line =~ m ? pid=$pid ? and
87
+ $line =~ m ? ses=$sessionid ? and
88
+ $line =~ m ? key=${key} _set ? ) {
89
+ $syscall_msg_match_set = 1;
90
+ last ;
91
+ }
92
+ }
93
+ ok($syscall_msg_match_set );
74
94
75
95
# ##
76
96
# cleanup
0 commit comments