Skip to content
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

🧹 Rework of Linux related queries focusing on robustness and using native resources #88

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

mm-weber
Copy link
Contributor

@mm-weber mm-weber commented Dec 5, 2022

Improvement on many queries using native resources instead of the command resource.
More robustness due to using regular expressions instead of plain text .contains queries.

I intend to split auditd related queries into a separate block of scoring_queries: to avoid the repeated use of this construct:

file('/etc/audit/audit.rules').exists
      if (file('/etc/audit/audit.rules').exists) {
        <query>
}

Would that be preferable?

** Overview of Commits **
Signed-off-by: Manuel Weber manuel@mondoo.com

fixed,regex: Ensure auditing for processes that start prior to auditd is enabled++

fixed,regex: Ensure changes to system administration scope (sudoers) is collected

fixed,replaced command: Ensure changes to system administration scope (sudoers) is collected

added,regex: Ensure login and logout events are collected

fixed,regex: Ensure session initiation information is collected

fixed,regex: Ensure events that modify date and time information are collected

fixed,regex: Ensure events that modify the systems Mandatory Access Controls are collected

fixed,regex: Ensure events that modify the systems network environment are collected

fixed,regex: Ensure unsuccessful unauthorized file access attempts are collected

fixed,regex:Ensure discretionary access control permission modification events are collected

fixed,regex: Ensure events that modify user/group information are collected

fixed,regex: Ensure file deletion events by users are collected

fixed,regex: Ensure kernel module loading and unloading is collected

added: Ensure system administrator actions (sudolog) are collected

added: Ensure the audit configuration is immutable

regex start changed to include potential whitespace

regex end changed to include potential whitespace

fixed,regex: Ensure sudo logging is enabled

@mm-weber mm-weber requested a review from atomic111 December 5, 2022 16:52
@mm-weber mm-weber changed the title fixed,regex: Ensure auditing for processes that start prior to auditd… 🧹 Rework of Linux related queries focusing on robustness and using native resources Dec 5, 2022
@tas50
Copy link
Member

tas50 commented Dec 5, 2022

@mm-weber @atomic111 I'd love to get this one into tomorrow's release. It would really help with container and k8s node scanning.

@mm-weber
Copy link
Contributor Author

mm-weber commented Dec 6, 2022

Changing remediations to fit the checks

@mm-weber mm-weber force-pushed the manuel/linux-policy-improvements branch 3 times, most recently from b3e58d1 to b0cf97f Compare December 6, 2022 14:44
… is enabled

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure auditing for processes that start prior to auditd is enabled++

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure changes to system administration scope (sudoers) is collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,replaced command: Ensure changes to system administration scope (sudoers) is collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

added,regex: Ensure login and logout events are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure session initiation information is collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

added: manuel/linux-policy-improvements

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure events that modify date and time information are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex:  Ensure events that modify the systems Mandatory Access Controls are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure events that modify the systems network environment are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure unsuccessful unauthorized file access attempts are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex:Ensure discretionary access control permission modification events are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure events that modify user/group information are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure file deletion events by users are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure kernel module loading and unloading is collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

added: Ensure system administrator actions (sudolog) are collected

Signed-off-by: Manuel Weber <manuel@mondoo.com>

added: Ensure the audit configuration is immutable

Signed-off-by: Manuel Weber <manuel@mondoo.com>

regex start changed to include potential whitespace

Signed-off-by: Manuel Weber <manuel@mondoo.com>

regex end changed to include potential whitespace

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed,regex: Ensure sudo logging is enabled

Signed-off-by: Manuel Weber <manuel@mondoo.com>

fixed first remedeation

Signed-off-by: Manuel Weber <manuel@mondoo.com>

added remediation fixes

Signed-off-by: Manuel Weber <manuel@mondoo.com>

added remediation fixes++

Signed-off-by: Manuel Weber <manuel@mondoo.com>

removed superflous description block

Signed-off-by: Manuel Weber <manuel@mondoo.com>

added remediation fixes+++

Signed-off-by: Manuel Weber <manuel@mondoo.com>
@mm-weber mm-weber force-pushed the manuel/linux-policy-improvements branch from b0cf97f to a2e34da Compare December 6, 2022 15:06
@atomic111 atomic111 merged commit d8afcff into main Dec 6, 2022
@atomic111 atomic111 deleted the manuel/linux-policy-improvements branch December 6, 2022 15:08
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants