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

Firewalls [x] but nftables #1478

Open
internethering opened this issue Apr 1, 2024 · 2 comments
Open

Firewalls [x] but nftables #1478

internethering opened this issue Apr 1, 2024 · 2 comments
Assignees

Comments

@internethering
Copy link

internethering commented Apr 1, 2024

I installed Lynis 3.1.11 and the audit says:

  Components:
  - Firewall               [X]

and:

[+] Software: Firewalls
------------------------------------
libkmod: kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory
Error: could not get list of modules: No such file or directory
  - Checking iptables kernel module                           [ NICHT GEFUNDEN ]
  - Checking iptables in config file                          [ NICHT GEFUNDEN ]
libkmod: kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory
Error: could not get list of modules: No such file or directory
  - Checking host based firewall 

this is wrong:

# nft list ruleset
table inet filter {
        chain services {
[...]

you know nftables? ;)
http://nftables.org/projects/nftables/index.html

@mboelen
Copy link
Member

mboelen commented Apr 1, 2024

What OS and version are you using? What nftables version?

Also, what is wrong? The output, the used commands within Lynis?

Although I'm sure you meant well (and included a wink), please note that the nftables project is known for changing its syntax without backwards compatibility. So most likely Lynis uses a syntax that used to work (and still does on older systems), but changed. So with the questions above we can hopefully see what goes wrong.

@mboelen mboelen self-assigned this Apr 1, 2024
@internethering
Copy link
Author

internethering commented Apr 2, 2024

What OS and version are you using? What nftables version?

Gentoo Linux (23.0 profile)

# nft -v
nftables v1.0.9 (Old Doc Yak #3)

Kernel 6.8.2-gentoo

Also, what is wrong? The output, the used commands within Lynis?

lynis audit system

Although I'm sure you meant well (and included a wink), please note that the nftables project is known for changing its syntax without backwards compatibility. So most likely Lynis uses a syntax that used to work (and still does on older systems), but changed. So with the questions above we can hopefully see what goes wrong.

ok, thanks for this hint, I tried something more:

lynis --debug --verbose --developer audit system

[...]
[+] Software: Firewalls
------------------------------------
[DEBUG] Performing test ID FIRE-4502 (Check iptables kernel module)
libkmod: kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory
Error: could not get list of modules: No such file or directory
  - Checking iptables kernel module                           [ NICHT GEFUNDEN ]
  - Checking iptables in config file                          [ NICHT GEFUNDEN ]
[DEBUG] Performing test ID FIRE-4524 (Check for CSF presence)
[DEBUG] Performing test ID FIRE-4536 (Check nftables status)
libkmod: kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory
Error: could not get list of modules: No such file or directory
[DEBUG] Performing test ID FIRE-4538 (Check nftables basic configuration)
[DEBUG] Performing test ID FIRE-4540 (Check for empty nftables configuration)
[DEBUG] Performing test ID FIRE-4590 (Check firewall status)
  - Checking host based firewall                              [ NOT ACTIVE ]
[DEBUG] Performing test ID FIRE-4594 (Check for APF presence)

Then I had a look in https://github.com/CISOfy/lynis/blob/master/include/tests_firewalls for FIRE-4538 & FIRE-4540:

# AWKBINARY=awk
# TRBINARY=tr
# NFTBINARY=nft
# NFT_VERSION=$(${NFTBINARY} --version 2> /dev/null | ${AWKBINARY} '{ if ($1=="nftables") { print $2 }}' | ${TRBINARY} -d 'v')
# echo $NFT_VERSION
1.0.9
# NFTBINARY=nft
# GREPBINARY=grep
# WCBINARY=wc
# NFT_RULES_LENGTH=$(${NFTBINARY} --stateless list ruleset 2> /dev/null | ${GREPBINARY} -E -v "table|chain|;$|}$|^$" | ${WCBINARY} -l)
# echo $NFT_RULES_LENGTH
14

seems like a bug in lynis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants