core icon indicating copy to clipboard operation
core copied to clipboard

SSHd fails to start if MAX_LISTEN_SOCKS limit exceeded

Open leprasmurf opened this issue 6 years ago • 0 comments

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

[x] I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md

[x] I have searched the existing issues and I'm convinced that mine is new.

Describe the bug SSHd has a built-in limit to listening connections. When selecting interfaces for sshd to listen on, if 8+ interfaces are selected sshd fails to start. The MAX_LISTEN_SOCKS value is defined upstream (https://github.com/freebsd/freebsd/blob/master/crypto/openssh/sshd.c#L198). I don't know if this was working in previous versions.

To Reproduce Steps to reproduce the behavior:

  1. Go to '/system_advanced_admin.php'
  2. Under 'Listen Interfaces' choose 8+ interfaces
  3. Start sshd
  4. Filter logging by 'sshd' at '/ui/diagnostics/log/core/system'

Expected behavior SSHd should start and listen on the selected interfaces or prevent the user from selecting more interfaces than MAX_LISTEN_SOCKS allows.

Screenshots image

Relevant log files

2020-10-08T13:23:44	sshd[14611]	fatal: Too many listen sockets. Enlarge MAX_LISTEN_SOCKS
2020-10-08T13:23:44	sshd[14611]	fatal: Too many listen sockets. Enlarge MAX_LISTEN_SOCKS
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.3 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.1 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.2.3 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.2.1 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.131 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.129 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.195 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.193 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.67 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.65 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.99 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.1.97 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.2.131 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 192.168.2.129 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on 127.0.0.1 port 22.
2020-10-08T13:23:44	sshd[14611]	Server listening on ::1 port 22.
2020-10-08T13:23:43	sshd[470]	Received signal 15; terminating.

Additional context High availability setup with CARP, sliced up into vLans. Reducing the number of interfaces selected or default / empty selection starts sshd without issue.

Environment OPNsense 20.7.3-amd64 FreeBSD 12.1-RELEASE-p10-HBSD OpenSSL 1.1.1g 21 Apr 2020

$ uname -a
FreeBSD firewall-blue.my.tld 12.1-RELEASE-p10-HBSD FreeBSD 12.1-RELEASE-p10-HBSD #0  517e44a00df(stable/20.7)-dirty: Mon Sep 21 16:21:17 CEST 2020     root@sensey64:/usr/obj/usr/src/amd64.amd64/sys/SMP  amd64

openssh-portable - 8.2.p1_1,1

leprasmurf avatar Oct 08 '20 13:10 leprasmurf