CISOfy / lynis

Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.
https://cisofy.com/lynis/
GNU General Public License v3.0
13.43k stars 1.48k forks source link

egrep: warning: egrep is obsolescent; using grep -E #1338

Open Obema12 opened 2 years ago

Obema12 commented 2 years ago

The execution of lynis audit system is accompanied by a whole bunch of messages related to grep

egrep: warning: egrep is obsolescent; using grep -E
  - Total without nodev:8 noexec:13 nosuid:6 ro or noexec (W^X): 13 of total 27
  - Disable kernel support of some filesystems
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E

Fix it at last.

mboelen commented 2 years ago

On what operating system and version are you running Lynis?

Obema12 commented 2 years ago

Archlinux.

konstruktoid commented 2 years ago

man grep(1) on Ubuntu 20.04.5: "the variant programs egrep, fgrep and rgrep are the same as grep -E, grep -F, and grep -r, respectively. These variants are deprecated, but are provided for backward compatibility."

mboelen commented 2 years ago

Looks like we have some conversion to do. The reason to use egrep was that grep on Solaris did not support the -E flag. A shame that the command is spewing messages now and therefore breaking that backward compatibility.

@Obema12 Thanks for your feedback. Next time when you report an issue, please leave off the "Fix it at last." at the end of your issue. It sounds unfriendly, while it may or may not be intended.

konstruktoid commented 2 years ago

Just to clarify; egrep, fgrep or rgrep don't spew any messages regarding deprecation on Ubuntu.

mboelen commented 2 years ago

Yup. Looks like someone decided to turn on this message in a recent version of the package that contains the related utilities. Similar messages show up, most of them are from this month. With Arch Linux using often the newest packages it is no surprise it pops up there first. So it definitely makes sense to convert now that the compatibility starts to break.

Obema12 commented 2 years ago

@mboelen tried to be polite. But dozens of problems found and sent show that politeness does not achieve anything.

I sent rougher questions and it got a much faster developer response. It got to the point that rudeness, published immediately after politeness, was decided immediately! Whereas the polite message remained open for months.

I don't know how it works.

mboelen commented 2 years ago

So it was intended. In that case, let me be very clear: we have a Code of Conduct (listed here on GitHub, including under the comment form "Remember, contributions to this repository...").

The CoC states that we expect people to be welcoming and friendly within this community, and also my duties as a project owner. It would be nice to treat people how you want to be treated yourself.

If you can't (or won't like to) accept these rules within the CoC, please don't be part of our community.

ghost commented 1 year ago

There are countless executeables that behave differently according to how they are named. This whole deprecated thing is developers who can't find something useful to do. 30+ years of scripts with egrep and fgrep. If Linux folks keep this stuff up it will eventually be as nasty as Wyndoze. If It Ain't Broke, Don't "Fix" it. Pure pedantry.

ghost commented 1 year ago

I guess I can set up a shell alias. :|

webcaptcha commented 1 year ago

@fw-ops-automation-imprivata were you success in writing that alias? I am looking for workaround too.

OckhamOdyssey commented 1 year ago

@webcaptcha I tried right now. I add the alias in the bashrc, zshrc, root bashrc and root zshrc. Nothing worked :/

mlude commented 1 year ago

the warning message was introduced in gnu grep 3.8

jokeyrhyme commented 1 year ago

The reason to use egrep was that grep on Solaris did not support the -E flag.

Could we do a one-time test at the very beginning that checks whether grep -E works, and if it does not then fallback to egrep ?

konstruktoid commented 1 year ago

agreed @jokeyrhyme and then replace `${EGREPBINARY} with a working command, so it doesn't need such a big rewrite.

XenGi commented 1 year ago

I added a EGREPBINARY var to my pull request. Let me know over there if this is a good approach.

wileyhy commented 1 year ago

This bug is still an issue.

** # lynis --version egrep: warning: egrep is obsolescent; using grep -E egrep: warning: egrep is obsolescent; using grep -E 3.0.8

wileyhy commented 1 year ago

egrep isn't POSIX any more, as it happens.

The Open Group Base Specifications Issue 7, 2018 edition IEEE Std 1003.1-2017 ... C.4.2 Utilities Removed in the Previous Version The following utilities were removed in the previous version of this standard: ...egrep fgrep..

https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap04.html

xnoguer commented 1 year ago

@mboelen This issue can probably be closed now after these commits: https://github.com/CISOfy/lynis/commit/e816df538fee086927bb12d97eec16532baeb4c0 https://github.com/CISOfy/lynis/commit/1dad487318f36398b3873c07ac157aa7e3d75351