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

NETW-3200 and FILE-6430 do no longer detect blacklisted modules #1502

Open
sbaumgartner75 opened this issue May 19, 2024 · 2 comments
Open

Comments

@sbaumgartner75
Copy link
Contributor

Describe the bug
Both tests NETW-3200 and FILE-6430 do no longer detect blacklisted modules

Version

  • Debian 12.5
  • Lynis version 3.1.2

Expected behavior
Both tests NETW-3200 and FILE-6430 detect blacklisted modules

Output

  * Determine if protocol 'dccp' is really needed on this system [NETW-3200] 
      https://cisofy.com/lynis/controls/NETW-3200/

  * Determine if protocol 'sctp' is really needed on this system [NETW-3200] 
      https://cisofy.com/lynis/controls/NETW-3200/

  * Determine if protocol 'rds' is really needed on this system [NETW-3200] 
      https://cisofy.com/lynis/controls/NETW-3200/

  * Determine if protocol 'tipc' is really needed on this system [NETW-3200] 
      https://cisofy.com/lynis/controls/NETW-3200/

Additional context
Since commit "9819ac4" the REGEX for detecting the blacklist entries is broken.

DATA=$(${GREPBINARY} "^install \+${P} \+/bin/true$" ${ROOTDIR}etc/modprobe.conf)
and
DATA=$(${GREPBINARY} -l -s "^install \+${P} \+/bin/true$" ${ROOTDIR}etc/modprobe.d/*)
respectively, because the "" escapes the "+" and thus the "+" is expected in the output.

I fixed this to read

DATA=$(${GREPBINARY} "^install +${P} +/bin/true$" ${ROOTDIR}etc/modprobe.conf)
and
DATA=$(${GREPBINARY} -l -s "^install +${P} +/bin/true$" ${ROOTDIR}etc/modprobe.d/*)

which fulfills the original intention of allowing any number of blanks.

@SchwarzerA
Copy link

SchwarzerA commented May 19, 2024

That's due to an error in include/consts, GREPBINARY="grep". It should read GREPBINARY="grep -E" because in NETW-3200 and other tests I assume extended regular expressions are used. And the test should be written as:

grep -E "^install[[:space:]]+dccp[[:space:]]+/bin/(true|false)$" /etc/modprobe.d/*

to actually work (openSUSE Tumbleweed). Please be aware that tabulators and/or blanks might be used.

@sbaumgartner75
Copy link
Contributor Author

I have amended my PR to include your very valid remark.

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

No branches or pull requests

2 participants