Article View: linux.debian.bugs.dist
Article #3910Bug#1153531: openssh-server: unable to configure tcp-wrappers
From: R.Scussat - DSP LABS S.r.l.
Date: Mon, 09 Nov 2026 17:20
Date: Mon, 09 Nov 2026 17:20
284 lines
12435 bytes
12435 bytes
This is a multi-part MIME message sent by reportbug.
--===============7494175437184272271==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Package: openssh-server
Version: 1:10.0p1-7+deb13u4
Severity: normal
Dear Maintainer,
some time ago, OpenSSH server was modified to separate session related
operations into a separate program (`sshd-session`) in order to improve
security.
However, this change altered TCP wrappers behavior: previously, the key used
for `libwrap` was derived from the executable's name, whereas now it is
static and fixed as "sshd."
Unfortunately, if two separate instances of `sshd` are installed on the same
machine, it becomes impossible to configure TCP wrappers appropriately, as
both instances use the same key.
Previously, one could create a symbolic link to `sshd` with a different name,
so allowing the second instance to use a distinct key for `libwrap`.
Now, however, because `libwrap` is invoked by a program separate from the
main executable, this approach no longer works.
The PAM service name identifier faces a similar issue, which led developers
to the introduction of a new configuration parameter: `PAMServiceName`.
Regrettably, no such measure was adopted for TCP wrappers; the key for
`libwrap` remains statically assigned.
I propose adding a new configuration parameter, `TCPWrappersName`, which
would allow the `libwrap` key to be set as desired.
To this end, I have developed a patch for the Debian source code for OpenSSH
server.
The patch adds the aforementioned parameter and also allows for the value
"none," which completely disables TCP wrappers for that instance - a feature
that is otherwise impossible, as TCP wrappers are mandatorily enabled.
-- System Information:
Debian Release: 13.7
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.12.115+deb13.1-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages openssh-server depends on:
ii debconf [debconf-2.0] 1.5.91
ii init-system-helpers 1.69~deb13u1
ii libaudit1 1:4.0.2-2+deb13u1
ii libc6 2.41-12+deb13u4
ii libcom-err2 1.47.2-3+b12
ii libcrypt1 1:4.4.38-1
ii libgssapi-krb5-2 1.21.3-5+deb13u1
ii libkrb5-3 1.21.3-5+deb13u1
ii libpam-modules 1.7.0-5
ii libpam-runtime 1.7.0-5
ii libpam0g 1.7.0-5
ii libselinux1 3.8.1-1
ii libssl3t64 3.5.7-1~deb13u3
ii libwrap0 7.6.q-36
ii libwtmpdb0 0.73.0-3+deb13u1
ii openssh-client 1:10.0p1-7+deb13u4
ii openssh-sftp-server 1:10.0p1-7+deb13u4
ii procps 2:4.0.4-9
ii runit-helper 2.16.4
ii systemd [systemd-sysusers] 257.13-1~deb13u1
ii sysvinit-utils [lsb-base] 3.14-4
ii ucf 3.0052
ii zlib1g 1:1.3.dfsg+really1.3.1-1+deb13u1
Versions of packages openssh-server recommends:
ii libpam-systemd [logind] 257.13-1~deb13u1
ii ncurses-term 6.5+20250216-2
ii xauth 1:1.1.2-1.1
Versions of packages openssh-server suggests:
pn molly-guard <none>
pn monkeysphere <none>
pn ssh-askpass <none>
pn ufw <none>
-- debconf information:
openssh-server/permit-root-login: false
openssh-server/password-authentication: true
--===============7494175437184272271==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="tcp_wrappers_config.patch"
Description: add a new config parameter to control TCP-wrappers behavior
In recent versions of `openssh`, a separate program (`sshd-session`) has been
introduced to handle session startup operations within an independent and
more secure context. This change has altered the previous behavior of the
`sshd` program, which used to determine the PAM service name and the key for
`libwrap` based on the name of the executable.
To address this issue, a new configuration parameter, `PAMServiceName`, has
been introduced; however, no corresponding option was provided for the
default TCP-wrappers key, which remains statically set to "sshd".
The purpose of this patch is to add a new configuration parameter,
`TCPWrappersName`, which can be used in two ways:
- to set an arbitrary `libwrap` key (i.e., the service name);
- to completely disable TCP-wrappers processing (by setting it to "none").
.
openssh (1:10.0p1-7+deb13u4) trixie; urgency=medium
Author: Riccardo Scussat DSP LABS S.r.l. <dsplabs@dsplabs.net>
---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2026-11-09
--- openssh-10.0p1.orig/servconf.c
+++ openssh-10.0p1/servconf.c
@@ -75,6 +75,10 @@
# define SSHD_PAM_SERVICE "sshd"
#endif
+#if !defined(SSHD_LIBWRAP_NAME)
+# define SSHD_LIBWRAP_NAME "sshd"
+#endif
+
static void add_listen_addr(ServerOptions *, const char *,
const char *, int);
static void add_one_listen_addr(ServerOptions *, const char *,
@@ -95,6 +99,9 @@ initialize_server_options(ServerOptions
/* Portable-specific options */
options->use_pam = -1;
options->pam_service_name = NULL;
+#ifdef LIBWRAP
+ options->tcp_wrappers_name = NULL;
+#endif
/* Standard Options */
options->num_ports = 0;
@@ -307,6 +314,10 @@ fill_default_server_options(ServerOption
options->use_pam = 0;
if (options->pam_service_name == NULL)
options->pam_service_name = xstrdup(SSHD_PAM_SERVICE);
+#ifdef LIBWRAP
+ if (options->tcp_wrappers_name == NULL)
+ options->tcp_wrappers_name = xstrdup(SSHD_LIBWRAP_NAME);
+#endif
/* Standard Options */
if (options->num_host_key_files == 0) {
@@ -563,6 +574,9 @@ typedef enum {
sBadOption, /* == unknown option */
/* Portable-specific options */
sUsePAM, sPAMServiceName,
+#ifdef LIBWRAP
+ sTcpWrappersName,
+#endif
/* Standard Options */
sPort, sHostKeyFile, sLoginGraceTime,
sPermitRootLogin, sLogFacility, sLogLevel, sLogVerbose,
@@ -622,6 +636,9 @@ static struct {
{ "usepam", sUnsupported, SSHCFG_GLOBAL },
{ "pamservicename", sUnsupported, SSHCFG_ALL },
#endif
+#ifdef LIBWRAP
+ { "tcpwrappersname", sTcpWrappersName, SSHCFG_GLOBAL },
+#endif
{ "pamauthenticationviakbdint", sDeprecated, SSHCFG_GLOBAL },
/* Standard Options */
{ "port", sPort, SSHCFG_GLOBAL },
@@ -1430,6 +1447,18 @@ process_server_config_line_depth(ServerO
if (*activep && *charptr == NULL)
*charptr = xstrdup(arg);
break;
+#ifdef LIBWRAP
+ case sTcpWrappersName:
+ charptr = &options->tcp_wrappers_name;
+ arg = argv_next(&ac, &av);
+ if (!arg || *arg == '\0') {
+ fatal("%s line %d: missing argument.",
+ filename, linenum);
+ }
+ if (*activep && *charptr == NULL)
+ *charptr = xstrdup(arg);
+ break;
+#endif
/* Standard Options */
case sBadOption:
@@ -3290,6 +3319,9 @@ dump_config(ServerOptions *o)
dump_cfg_fmtint(sUsePAM, o->use_pam);
dump_cfg_string(sPAMServiceName, o->pam_service_name);
#endif
+#ifdef LIBWRAP
+ dump_cfg_string(sTcpWrappersName, o->tcp_wrappers_name);
+#endif
dump_cfg_int(sLoginGraceTime, o->login_grace_time);
dump_cfg_int(sX11DisplayOffset, o->x11_display_offset);
dump_cfg_int(sMaxAuthTries, o->max_authtries);
--- openssh-10.0p1.orig/servconf.h
+++ openssh-10.0p1/servconf.h
@@ -216,6 +216,8 @@ typedef struct {
int use_pam; /* Enable auth via PAM */
char *pam_service_name;
+ char *tcp_wrappers_name;
+
int permit_tun;
char **permitted_opens; /* May also be one of PERMITOPEN_* */
--- openssh-10.0p1.orig/sshd-session.c
+++ openssh-10.0p1/sshd-session.c
@@ -1247,22 +1247,25 @@ main(int ac, char **av)
audit_connection_from(remote_ip, remote_port);
#endif
#ifdef LIBWRAP
- allow_severity = options.log_facility|LOG_INFO;
- deny_severity = options.log_facility|LOG_WARNING;
- /* Check whether logins are denied from this host. */
- if (ssh_packet_connection_is_on_socket(ssh)) {
- struct request_info req;
+ if (strncmp(options.tcp_wrappers_name, "none", 4) != 0) {
+ allow_severity = options.log_facility|LOG_INFO;
+ deny_severity = options.log_facility|LOG_WARNING;
+ /* Check whether logins are denied from this host. */
+ if (ssh_packet_connection_is_on_socket(ssh)) {
+ struct request_info req;
- request_init(&req, RQ_DAEMON, "sshd", RQ_FILE, sock_in, 0);
- fromhost(&req);
+ request_init(&req, RQ_DAEMON, options.tcp_wrappers_name, RQ_FILE, sock_in, 0);
+ fromhost(&req);
- if (!hosts_access(&req)) {
- debug("Connection refused by tcp wrapper");
- refuse(&req);
- /* NOTREACHED */
- fatal("libwrap refuse returns");
+ if (!hosts_access(&req)) {
+ debug("Connection refused by tcp wrapper");
+ refuse(&req);
+ /* NOTREACHED */
+ fatal("libwrap refuse returns");
+ }
}
- }
+ } else
+ debug("tcp-wrappers are disabled by config");
#endif /* LIBWRAP */
rdomain = ssh_packet_rdomain_in(ssh);
--- openssh-10.0p1.orig/sshd_config.5
+++ openssh-10.0p1/sshd_config.5
@@ -1966,6 +1966,14 @@
.Pp
To disable TCP keepalive messages, the value should be set to
.Cm no .
+.It Cm TCPWrappersName
+Specifies the key (service name) used for TCP-wrappers matching to allow or
+deny user access; if set to
+.Cm none
+then TCP-wrappers will be disabled.
+Further details are described in hosts_access(5).
+The default is
+.Cm sshd .
.It Cm TrustedUserCAKeys
Specifies a file containing public keys of certificate authorities that are
trusted to sign user certificates for authentication, or
--===============7494175437184272271==--
Technical Details
Message-ID:
<NXBcd-aQQz-7@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!news.servidellagleba.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!news.servidellagleba.it!bofh.it!news.nic.it!robomod From: "R.Scussat - DSP LABS S.r.l." <dsplabs@dsplabs.net> Newsgroups: linux.debian.bugs.dist Subject: Bug#1153531: openssh-server: unable to configure tcp-wrappers Date: Mon, 09 Nov 2026 18:20:01 +0100 Message-ID: <NXBcd-aQQz-7@gated-at.bofh.it> X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org> X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Mon Nov 9 17:11:10 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -1.65 Reply-To: "R.Scussat - DSP LABS S.r.l." <dsplabs@dsplabs.net>, 1153531@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: debian-ssh@lists.debian.org X-Debian-Pr-Message: report 1153531 X-Debian-Pr-Package: openssh-server X-Debian-Pr-Source: openssh Content-Type: multipart/mixed; boundary="===============7494175437184272271==" MIME-Version: 1.0 X-Mailer: reportbug 13.2.0 X-Virus-Status: Clean X-Greylist: delayed 529 seconds by postgrey-1.37 at buxtehude; Mon, 09 Nov 2026 17:10:23 UTC X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001689 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 284 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Mon, 09 Nov 2026 17:58:42 +0100 X-Original-Message-ID: <179424352290.361273.5402073262830677757.reportbug@gw1.local.lan>