Skip to content

FILE-6430: fix blacklisted filesystems detection and modprobe paths - #1807

Open
rafaelsoje wants to merge 1 commit into
CISOfy:masterfrom
rafaelsoje:fix-file-6430-blacklisted-filesystems
Open

rafaelsoje wants to merge 1 commit into
CISOfy:masterfrom
rafaelsoje:fix-file-6430-blacklisted-filesystems

Conversation

@rafaelsoje

Copy link
Copy Markdown
Contributor

Summary

Fixes blacklisted filesystem detection and modprobe path evaluation in test FILE-6430.

Closes #1794

Details

  • include/tests_filesystems:
    • Remove quotes around the glob in "${SUBDIR}/modprobe.d/*" (line 887). The quotes prevented shell globbing, causing ls to search for a literal asterisk * and fail, leaving FIND empty on directories with files.
    • In lines 889-890, replace hardcoded ${ROOTDIR}etc/modprobe.d/* with ${SUBDIR}/modprobe.d/* and add -s so both /etc/modprobe.d and /usr/lib/modprobe.d are properly searched.
    • In line 868, anchor the module name check in lsmod with a trailing space/whitespace delimiter (^${FS}[[:space:]]) to prevent prefix matches (e.g. hfsplus matching hfs).
  • CHANGELOG.md:
    • Added entry under ## Lynis 3.1.8 (not released yet) -> ### Changed.

Verification

  • Tested FILE-6430 via ./lynis audit system --tests FILE-6430 --cronjob:
    • Verified audit execution and log outputs without errors.
  • Verified syntax with both bash -n include/tests_filesystems and sh -n include/tests_filesystems.

In include/tests_filesystems (test FILE-6430):
- Remove quotes around the glob in ${SUBDIR}/modprobe.d/* so the shell
  correctly expands existing modprobe configuration files.
- Replace hardcoded ${ROOTDIR}etc/modprobe.d/* with ${SUBDIR}/modprobe.d/*
  so both /etc/modprobe.d and /usr/lib/modprobe.d are checked for blacklists.
- Anchor lsmod match with trailing whitespace [[:space:]] to avoid
  prefix false positives (e.g. hfsplus matching hfs).
- Add changelog entry under Lynis 3.1.8.

Closes CISOfy#1794
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FILE-6430 never recognises a blacklisted filesystem in 3.0.9 or 3.1.5+

1 participant