Bug 1851620 - rkhunter complains about sshd setting after redhat update to sshd_config but does not consider sshd_config.d includes
Summary: rkhunter complains about sshd setting after redhat update to sshd_config but ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rkhunter
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1871812 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-27 15:07 UTC by John Dodson
Modified: 2021-01-25 01:15 UTC (History)
5 users (show)

Fixed In Version: rkhunter-1.4.6-10.fc34 rkhunter-1.4.6-10.fc33 rkhunter-1.4.6-10.fc32
Clone Of:
Environment:
Last Closed: 2021-01-16 19:13:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description John Dodson 2020-06-27 15:07:45 UTC
Description of problem:
rkhunter complains about sshd setting after redhat update to sshd_config but does not consider sshd_config.d includes

--------------------- Start Rootkit Hunter Update ---------------------
[ Rootkit Hunter version 1.4.6 ]

Checking rkhunter data files...
  Checking file mirrors.dat                                  [ No update ]
  Checking file programs_bad.dat                             [ No update ]
  Checking file backdoorports.dat                            [ No update ]
  Checking file suspscan.dat                                 [ No update ]
  Checking file i18n/cn                                      [ No update ]
  Checking file i18n/de                                      [ No update ]
  Checking file i18n/en                                      [ No update ]
  Checking file i18n/tr                                      [ No update ]
  Checking file i18n/tr.utf8                                 [ No update ]
  Checking file i18n/zh                                      [ No update ]
  Checking file i18n/zh.utf8                                 [ No update ]
  Checking file i18n/ja                                      [ No update ]

---------------------- Start Rootkit Hunter Scan ----------------------
Warning: The SSH configuration option 'PermitRootLogin' has not been set.
         The default value may be 'yes', to allow root access.

----------------------- End Rootkit Hunter Scan -----------------------

Version-Release number of selected component (if applicable):
1.4.6

How reproducible:
New error - will it go away or will I need a propupd!?

Steps to Reproduce:
1. Run rkhunter after recent sshd update
2.
3.

Actual results:
Above error message.

Expected results:
No error because I put in my own include file with that PermitRootLogin option as "no" (which was previously in sshd_config)

Additional info:

Comment 1 Kevin Fenzi 2020-06-27 17:46:45 UTC
rkhunter currently has no knowledge of /etc/ssh/sshd_config.d/ and upstream isn't too active. 

Would you be willing to bring the matter up on the upstream list? rkhunter-users.net

Comment 2 Kevin Fenzi 2020-08-25 19:40:07 UTC
*** Bug 1871812 has been marked as a duplicate of this bug. ***

Comment 3 John Dodson 2020-08-28 13:14:01 UTC
I have submitted a "fix" to the above mailing list - there has been no response, is anyone maintaining this?


-------------

looking at the code it
seems that the following changes might alleviate the problem (they do for me)
although could break following uses of grep -i ... ${SSH_CONFIG_FILE} ...

Effectively it includes the /etc/ssh/sshd_config.d/* files in the grep.

Without more detailed debugging, I don't claim to understand all the code
(yet ;-), I can't be certain, perhaps a maintainer can comment?

(This is a cut & paste - so tab's are probably lost or corrupted - beware)
--------------------------------------------------------------------------------
$ diff rkhunter.johnd /usr/bin/rkhunter 
17389,17395d17388
<        # JohnD - include the /etc/ssh/sshd_config.d/* files.
<        if [ -d "${SSH_CONFIG_FILE}.d" ];then
<            SSH_CONFIG_FILE="${SSH_CONFIG_FILE}
${SSH_CONFIG_FILE}.d/*"
<        else
<            :
<        fi
< 
17413,17414c17406,17407
<            # JohnD - add -h to grep opts!
<            RKHTMPVAR=`grep -ih '^[    ]*PermitRootLogin[    
=]' ${SSH_CONFIG_FILE} 2>/dev/null | tail ${TAIL_OPT}1`
---
           RKHTMPVAR=`grep -i '^[    ]*PermitRootLogin[    =]'
"${SSH_CONFIG_FILE}" 2>/dev/null | tail ${TAIL_OPT}1`

--------------------------------------------------------------------------------

It probably should also check that the sshd_config file is doing the
appropriate "Include" or be conditional on it might be better, depending
on how sshd config's are evolving.
In my case I have "PermitRootLogin no" in /etc/ssh/sshd_config.d/99-johnd-
sshd.conf

Comment 4 John Dodson 2020-09-26 03:26:46 UTC
Is there a way to find out if there is any progress on this?

Comment 5 Kevin Fenzi 2020-09-27 17:57:35 UTC
Upstream is not all that active these days it seems. ;( 

If you have used/tested that patch, I can just look at carrying it in the fedora packages?

Comment 6 mark preston 2020-11-12 12:13:28 UTC
just tested in fc33 and still and issue
rkhunter-1.4.6-9.fc33.noarch

Comment 7 John Dodson 2020-11-13 04:02:04 UTC
It was suggested, (Daniel Demus <ddemus.net>)

     It would be preferable to use sshd -T to list the resolved configuration instead of trying to parse the config files.

so use something like,

     sshd -T|grep -i PermitRootLogin

I think that to be consistent that would need to be throughout rkhunter, hence a major rebuild.

When it was said that upstream is very quiet, it was not a joke, could they be deceased or just uninterested?

Maybe that's why.

Comment 8 Fedora Update System 2021-01-16 19:13:37 UTC
FEDORA-2021-611f32a469 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2021-01-16 19:36:28 UTC
FEDORA-2021-024739ab64 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-024739ab64

Comment 10 Fedora Update System 2021-01-16 19:36:28 UTC
FEDORA-2021-9c40a9907e has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-9c40a9907e

Comment 11 Fedora Update System 2021-01-17 01:42:50 UTC
FEDORA-2021-024739ab64 has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-024739ab64`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-024739ab64

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2021-01-17 02:06:58 UTC
FEDORA-2021-9c40a9907e has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-9c40a9907e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-9c40a9907e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2021-01-23 01:30:37 UTC
FEDORA-2021-9c40a9907e has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2021-01-25 01:15:38 UTC
FEDORA-2021-024739ab64 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.