Bug 1222467 - sshd displays error when binding to custom port
Summary: sshd displays error when binding to custom port
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-08 12:37 UTC by Luca Billi
Modified: 2024-07-17 12:40 UTC (History)
4 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
santiago.zarate: needinfo? (hpj)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Billi 2024-04-08 12:37:41 UTC
Starting with tw 20240404, sshd.service logs the following error:

sshd[1566]: Server listening on 0.0.0.0 port 2222.
sshd[1566]: Server listening on :: port 2222.
sshd[1566]: error: Bind to port 2222 on 0.0.0.0 failed: Address already in use.
sshd[1566]: error: Bind to port 2222 on :: failed: Address already in use.

when a drop-in conf file is placed in /etc/ssh/sshd_config.d.

> cat /etc/ssh/sshd_config.d/myport.conf
Port 2222

Despite the error message, sshd seems to work as expected.

The error message is not present if no file is placed in /etc/ssh/sshd_config.d/ and it was not present before tw 20240404.
Comment 1 Santiago Zarate 2024-04-08 17:32:39 UTC
(In reply to Luca Billi from comment #0)
> Starting with tw 20240404, sshd.service logs the following error:
> 
> sshd[1566]: Server listening on 0.0.0.0 port 2222.
> sshd[1566]: Server listening on :: port 2222.
> sshd[1566]: error: Bind to port 2222 on 0.0.0.0 failed: Address already in
> use.
> sshd[1566]: error: Bind to port 2222 on :: failed: Address already in use.
> 
> when a drop-in conf file is placed in /etc/ssh/sshd_config.d.
> 
> > cat /etc/ssh/sshd_config.d/myport.conf
> Port 2222
> 
> Despite the error message, sshd seems to work as expected.
> 
> The error message is not present if no file is placed in
> /etc/ssh/sshd_config.d/ and it was not present before tw 20240404.

that's odd, but I can confirm that it happens on one of my tw systems with the latest updates (openssh 9.6p1)

Asking the bugowner
Comment 2 Arnav Singh 2024-04-10 05:23:23 UTC
I was about to file a different bug, but it has the same root cause as this one
so I will post here. The problem is that /usr/etc/ssh/sshd_config contains
two copies of the directive to include /etc/ssh/sshd_config.d/*.conf ,
so dropins get included twice.

    # To modify the system-wide sshd configuration, create a "*.conf" file under
    # "/etc/ssh/sshd_config.d/" which will be automatically included below.
    # Don't edit this configuration file itself if possible to avoid update
    # problems.
    Include /etc/ssh/sshd_config.d/*.conf

    # The strategy used for options in the default sshd_config shipped with
    # OpenSSH is to specify options with their default value where
    # possible, but leave them commented.  Uncommented options override the
    # default value.
    Include /usr/etc/ssh/sshd_config.d/*.conf

    # To modify the system-wide sshd configuration, create a  *.conf  file under
    #  /etc/ssh/sshd_config.d/  which will be automatically included below
    Include /etc/ssh/sshd_config.d/*.conf

It started happening now because the second copy is added by
the new openssh-9.6p1-crypto-policies.patch while the first copy was being
added by openssh-8.4p1-ssh_config_d.patch

My case was that my dropin contains `HostKey /etc/ssh/ssh_host_ed25519_key`
to force the use of only ED25519 key, but because the dropin gets included twice
the server also advertises the key twice, which leads to clients printing:

    client_input_hostkeys: received duplicated ssh-ed25519 host key
Comment 3 Arnav Singh 2024-04-11 06:43:12 UTC
https://build.opensuse.org/request/show/1166764
Comment 6 Luca Billi 2024-04-16 14:34:52 UTC
Fixed in tw 20240414