Bug 2169693
| Summary: | Cannot login when sshd configuration is larger than 256KB | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Renaud Métrich <rmetrich> |
| Component: | openssh | Assignee: | Dmitry Belyavskiy <dbelyavs> |
| Status: | CLOSED MIGRATED | QA Contact: | BaseOS QE Security Team <qe-baseos-security> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 8.7 | CC: | jjelen |
| Target Milestone: | rc | Keywords: | MigratedToJIRA, Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-09-19 23:55:59 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug. This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there. Due to differences in account names between systems, some fields were not replicated. Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information. To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer. You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like: "Bugzilla Bug" = 1234567 In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information. |
Description of problem: When the sshd configuration file is larger than 256K (main /etc/ssh/sshd_config + includes), it's not possible to log in to the system anymore and the following message is recorded in the journal: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Feb 14 12:10:48 vm-rhel8 sshd[2979]: error: ssh_msg_recv: read: bad msg_len 618704 Feb 14 12:10:48 vm-rhel8 sshd[2979]: fatal: recv_rexec_state: ssh_msg_recv failed -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- On the client side, the *ssh* process hangs forever. The root cause for this is the size of the configuration which cannot be sent to the ssh connection handler, due to the size being larger than 256KB: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 139 void 140 mm_request_receive(int sock, struct sshbuf *m) 141 { : 153 msg_len = PEEK_U32(buf); 154 if (msg_len > 256 * 1024) 155 fatal("%s: read: bad msg_len %d", __func__, msg_len); : -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- The ssh connection handler exits on error, but the main *sshd* process hangs on sending the configuration. This additionally leads to not handling incoming connections anymore and restart of the service to take a long time (1min30) due to Stop timeout. Version-Release number of selected component (if applicable): openssh-server-8.0p1-16.el8.x86_64 How reproducible: Always Steps to Reproduce: 1. Generate a large configuration file -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # for i in $(seq 1 10000); do echo -e "Match Group GRP$i\nChrootDirectory /some/path/for/group/$i" >> /etc/ssh/sshd_config; done -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 2. Restart the service -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # systemctl restart sshd -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 3. Try connecting -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- $ ssh localhost -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Actual results: Hang of ssh client and message on sshd side Expected results: No hang, prompt being displayed Additional info: Doesn't affect RHEL9.