Skip to contentSkip to conversation

Does the order / position of audit rule's arguments matter?

DISCUSSION Jan Lieskovsky 3 participants 6 messages Jan 19, 2015 – Jan 25, 2015 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hello folks,

wasn't able to find answer to the following question in the auditctl
manual page, thus checking here - does the order / position in which the auditctl's | /etc/audit/audit.rules' audit rule arguments are listed in the rule matter or all permutations of the arguments are allowed?

IOW suppose the following rule:
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295 -k privileged

Is
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295 -k privileged

the only allowed form or are all the other possible argument permutations [*] also valid / supported (under assumption there isn't some option missing or some new option added of course when compared to the original rule)?

Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team

[*] For example suppose five different /etc/audit/audit.rules configurations would use the
forms as follows below - do all of them represent equivalent requirement / setting? (regardless how much it's likely they would be expressed in that form of)

-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295 -k privileged -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295 -k privileged -a always,exit -F perm=x -F auid>=500 -F auid!=4294967295 -k privileged -a always, exit -F path/bin/ping -F auid>=500 -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid>=500 ..

#2 lore raw
Quoted 6 lines · Jan Lieskovsky

Hello folks,

wasn't able to find answer to the following question in the auditctl
manual page, thus checking here - does the order / position in which the auditctl's | /etc/audit/audit.rules' audit rule arguments are listed in the rule matter or all permutations of the arguments are allowed?

Yes, its a first match wins system. I tell people to order from specific to general. IOW, put a watch on /etc/shadow before a watch on /etc.

-Steve

Quoted 34 lines

IOW suppose the following rule:
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F
auid!=4294967295 -k privileged

Is
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F
auid!=4294967295 -k privileged

the only allowed form or are all the other possible argument permutations [*] also valid / supported (under assumption there isn't some option missing or some new option added of course when compared to the original rule)?

Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team

[*] For example suppose five different /etc/audit/audit.rules configurations would use the forms as follows below - do all of them represent equivalent requirement / setting? (regardless how much it's likely they would be expressed in that form of)

(quoted diff) +0 -3
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295
-k privileged -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295
-k privileged -a always,exit -F perm=x -F auid>=500 -F auid!=4294967295 -k

privileged -a always, exit -F path/bin/ping -F auid>=500 -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid>=500 ..

--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit

#3 lore raw
Quoted 10 lines · Steve Grubb
Quoted 6 lines · Jan Lieskovsky

Hello folks,

wasn't able to find answer to the following question in the auditctl
manual page, thus checking here - does the order / position in which the auditctl's | /etc/audit/audit.rules' audit rule arguments are listed in the rule matter or all permutations of the arguments are allowed?

Yes, its a first match wins system. I tell people to order from specific to general. IOW, put a watch on /etc/shadow before a watch on /etc.

I don't think that answers Jan's question. I understood the question to be the ordering of arguments *within* a rule. I believe the answer is "no".

so:

	-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295 -k privileged
would be equivalent to:
	-a always,exit -F path=/bin/ping -F perm=x -F auid!=4294967295 -F auid>=500 -k privileged
Quoted 24 lines

-Steve

Quoted 22 lines

IOW suppose the following rule:
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F
auid!=4294967295 -k privileged

Is
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F
auid!=4294967295 -k privileged

the only allowed form or are all the other possible argument permutations [*] also valid / supported (under assumption there isn't some option missing or some new option added of course when compared to the original rule)?

Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team

[*] For example suppose five different /etc/audit/audit.rules configurations would use the forms as follows below - do all of them represent equivalent requirement / setting? (regardless how much it's likely they would be expressed in that form of)

Quoted 7 lines
Quoted 7 lines
(quoted diff) +0 -3
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295
-k privileged -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295
-k privileged -a always,exit -F perm=x -F auid>=500 -F auid!=4294967295 -k

privileged -a always, exit -F path/bin/ping -F auid>=500 -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid>=500 ..

- RGB

--
Richard Guy Briggs <[email protected]>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545

#4 lore raw
Quoted 14 lines · Richard Guy Briggs
Quoted 5 lines · Steve Grubb
Quoted 4 lines · Jan Lieskovsky

Hello folks,

wasn't able to find answer to the following question in the auditctl

Quoted 7 lines
Quoted 3 lines

manual page, thus checking here - does the order / position in which the auditctl's | /etc/audit/audit.rules' audit rule arguments are listed in the rule matter or all permutations of the arguments are allowed?

Yes, its a first match wins system. I tell people to order from specific to
general. IOW, put a watch on /etc/shadow before a watch on /etc.

Quoted 6 lines

I don't think that answers Jan's question. I understood the question to be the ordering of arguments *within* a rule. I believe the answer is "no".

so:

	-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F 

auid!=4294967295

Quoted 2 lines

-k privileged would be equivalent to:

	-a always,exit -F path=/bin/ping -F perm=x -F auid!=4294967295 -F 

auid>=500

Quoted 1 line

-k privileged

If that is the case, then you want to have the fields in the order in which the system can decide "no" as fast as possible.

-Steve

Quoted 47 lines
Quoted 28 lines

-Steve

Quoted 26 lines

IOW suppose the following rule:
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F

auid!=4294967295 -k privileged

Is

-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F

auid!=4294967295 -k privileged

the only allowed form or are all the other possible argument permutations
[*] also valid / supported (under assumption there isn't some option missing or some new option added of course when compared to the original rule)?

Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team

[*] For example suppose five different /etc/audit/audit.rules configurations would use the forms as follows below - do all of them represent equivalent requirement / setting? (regardless how much it's likely they would be expressed in that form of)

Quoted 11 lines
Quoted 11 lines

-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295
-k privileged -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295

(quoted diff) +0 -2
-k privileged -a always,exit -F perm=x -F auid>=500 -F auid!=4294967295
-k

privileged -a always, exit -F path/bin/ping -F auid>=500 -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x
-F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid>=500 ..

- RGB

--
Richard Guy Briggs <[email protected]>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545

#5 lore raw

Thank you both for quick replies.

----- Original Message -----

Quoted 6 lines

From: "Steve Grubb" <[email protected]>
To: "Richard Guy Briggs" <[email protected]>
Cc: [email protected], "Jan Lieskovsky" <[email protected]>, "Shawn Wells" <[email protected]>
Sent: Monday, January 19, 2015 7:11:10 PM
Subject: Re: Does the order / position of audit rule's arguments matter?

Quoted 18 lines
Quoted 17 lines · Richard Guy Briggs
Quoted 5 lines · Steve Grubb
Quoted 4 lines · Jan Lieskovsky

Hello folks,

wasn't able to find answer to the following question in the auditctl

Quoted 8 lines
Quoted 4 lines

manual page, thus checking here - does the order / position in which the
auditctl's | /etc/audit/audit.rules' audit rule arguments are listed in the rule matter or all permutations of the arguments are allowed?

Yes, its a first match wins system. I tell people to order from specific to
general. IOW, put a watch on /etc/shadow before a watch on /etc.

I don't think that answers Jan's question. I understood the question to be the ordering of arguments *within* a rule.

Yes, was about this case. But good to know also order of rules matters (to list them that way).

Quoted 6 lines

I believe the answer is

Quoted 4 lines

"no".

so:

	-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F

auid!=4294967295

Quoted 8 lines
Quoted 2 lines

-k privileged would be equivalent to:

	-a always,exit -F path=/bin/ping -F perm=x -F auid!=4294967295 -F

auid>=500

Quoted 1 line

-k privileged

If that is the case, then you want to have the fields in the order in which the
system can decide "no" as fast as possible.

Meaning the audit rule's arguments to be sorted? Or just follow the form as it's listed for example in /usr/share/doc/audit-2.3.7/stig.rules file? (IOW action first, then path to binary, then other -F arguments - for these to be listed in ascending alphabetical order?)

Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team

Quoted 54 lines

-Steve

Quoted 48 lines
Quoted 29 lines

-Steve

Quoted 27 lines

IOW suppose the following rule:
-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F

auid!=4294967295 -k privileged

Is

-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F

auid!=4294967295 -k privileged

the only allowed form or are all the other possible argument permutations
[*] also valid / supported (under assumption there isn't some option missing or some new option added of course when compared to the original
rule)?

Thank you && Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team

[*] For example suppose five different /etc/audit/audit.rules configurations would use the forms as follows below - do all of them represent equivalent requirement / setting? (regardless how much it's likely they would be expressed in that form of)

Quoted 11 lines
Quoted 11 lines

-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295
-k privileged -F path=/bin/ping -F perm=x -F auid>=500 -F auid!=4294967295

(quoted diff) +0 -2
-k privileged -a always,exit -F perm=x -F auid>=500 -F auid!=4294967295
-k

privileged -a always, exit -F path/bin/ping -F auid>=500 -F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x
-F auid!=4294967295 -k privileged -a always,exit -F path=/bin/ping -F perm=x -F auid>=500 ..

- RGB

--
Richard Guy Briggs <[email protected]>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545

#6 lore raw
Quoted 56 lines · Jan Lieskovsky

Thank you both for quick replies.

----- Original Message -----

Quoted 6 lines

From: "Steve Grubb" <[email protected]>
To: "Richard Guy Briggs" <[email protected]>
Cc: [email protected], "Jan Lieskovsky" <[email protected]>, "Shawn Wells" <[email protected]> Sent: Monday, January 19, 2015 7:11:10 PM
Subject: Re: Does the order / position of audit rule's arguments matter?

Quoted 21 lines
Quoted 20 lines · Richard Guy Briggs
Quoted 12 lines · Steve Grubb
Quoted 10 lines · Jan Lieskovsky

Hello folks,

wasn't able to find answer to the following question in the auditctl

manual page, thus checking here - does the order / position in which the
auditctl's | /etc/audit/audit.rules' audit rule arguments are listed in
the rule matter or all permutations of the arguments are allowed?

Quoted 4 lines

Yes, its a first match wins system. I tell people to order from specific
to
general. IOW, put a watch on /etc/shadow before a watch on /etc.

I don't think that answers Jan's question. I understood the question to be the ordering of arguments *within* a rule.

Yes, was about this case. But good to know also order of rules matters (to list them that way).

Quoted 12 lines

I believe the answer is

Quoted 4 lines

"no".

so:

	-a always,exit -F path=/bin/ping -F perm=x -F auid>=500 -F

auid!=4294967295

Quoted 2 lines

-k privileged would be equivalent to:

	-a always,exit -F path=/bin/ping -F perm=x -F auid!=4294967295 -F
Quoted 8 lines

auid>=500

Quoted 1 line

-k privileged

If that is the case, then you want to have the fields in the order in which
the
system can decide "no" as fast as possible.

Quoted 4 lines

Meaning the audit rule's arguments to be sorted? Or just follow the form as it's listed for example in /usr/share/doc/audit-2.3.7/stig.rules file? (IOW action first, then path to binary, then other -F arguments - for these to be listed in ascending alphabetical order?)

Yes, the audit system is like
for each rule
if (syscall & mask)
for each field
if fval != rval
next rule
endif
done
record event
endif
done

So, by deciding "no" quickly, it can move on to the next rule to iterate over the fields.

The stig.rules is ordered correctly and is intended that anyone that needs to STIG a box simply copies the file "as is" to the rules.d directory. Any problems between what the file has and what's needed should be reported here so the file can be corrected.

-Steve