Thread View: linux.debian.bugs.dist
4 messages
4 total messages
Started by R.Scussat - DSP LABS S.r.l.
Mon, 09 Nov 2026 17:20
Bug#1153531: openssh-server: unable to configure tcp-wrappers
Author: 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==--
Bug#1153531: openssh-server: unable to configure tcp-wrappers
Author: Colin Watson
Date: Mon, 09 Nov 2026 18:10
Date: Mon, 09 Nov 2026 18:10
26 lines
3055 bytes
3055 bytes
On Mon, Nov 09, 2026 at 05:58:42PM +0100, R.Scussat - DSP LABS S.r.l. wrote: >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. Hmm, OK, I hadn't realized this. However, support for TCP wrappers in OpenSSH is on life support in Debian, having been removed upstream in OpenSSH 6.7; I definitely don't intend to add more user-facing options for it, and ultimately I'd prefer to move towards dropping it entirely. Please could you explore whether any other approach would be feasible for you? For example, https://fedoraproject.org/wiki/Changes/Deprecate_TCP_wrappers#Documentation suggests several alternatives, none of which should require changes to sshd. Thanks, -- Colin Watson (he/him) [cjwatson@debian.org]
Bug#1153531: openssh-server: unable to configure tcp-wrappers
Author: Colin Watson
Date: Tue, 10 Nov 2026 11:00
Date: Tue, 10 Nov 2026 11:00
30 lines
3268 bytes
3268 bytes
On Mon, Nov 09, 2026 at 07:50:29PM +0100, dsplabs@dsplabs.net wrote: >I had already read that document on fedoraproject.org, but I must >confess that none of the proposed alternatives particularly convince >me--using 'tcpd' least of all. > >Furthermore, an sshd instance without tcp-wrappers doesn't exactly >excite me either; > >while it's clear that a firewall rule provides the best protection >against access from unwanted IPs, tcp-wrappers still serves as a >useful safeguard in the event of configuration errors. > >IMHO it is always better to have multiple layers of protection; anyway >I respect your opinion. OK. Well, I understand your discomfort, but at the same time it's probably not viable for Debian to maintain this patch out-of-tree forever. Initially it was fairly straightforward, but this very bug illustrates why subtle changes over time can make this sort of thing hard to maintain without upstream assistance. Since upstream was pretty determined to drop this - see https://lists.mindrot.org/pipermail/openssh-unix-dev/2014-April/032497.html and thread, where it was litigated at some length - I think users would be well-advised to find a different approach. Regards, -- Colin Watson (he/him) [cjwatson@debian.org]
Bug#1153531: openssh-server: unable to configure tcp-wrappers
Author: dsplabs
Date: Tue, 10 Nov 2026 12:10
Date: Tue, 10 Nov 2026 12:10
128 lines
8800 bytes
8800 bytes
--=_56ab0adc4cfaa1ea2a7c759a5a1cb595 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Ok, as I've already mentioned, I understand your line of reasoning. And not to mention that `libwrap` used to bring along a huge list of dependencies - I can see how that would be negative from a developer's perspective. Still, it's a pity. But don't worry: system administrators will adapt and carry on with their lives (more or less). That said, I was simply asking whether - as long as Debian continues to include OpenSSH with `libwrap` support - it might be possible to make its use a bit easier, even in edge cases like mine. The patch I submitted was intended solely for that purpose. In any case, you are the package maintainer; I trust you will make the best decision for everyone. Regards -- R.Scussat CTO - Systems & Networking coordinator DSP LABS Srl On 2026-11-10 11:56, Colin Watson wrote: > On Mon, Nov 09, 2026 at 07:50:29PM +0100, dsplabs@dsplabs.net wrote: > >> I had already read that document on fedoraproject.org, but I must >> confess that none of the proposed alternatives particularly convince >> me--using 'tcpd' least of all. >> >> Furthermore, an sshd instance without tcp-wrappers doesn't exactly >> excite me either; >> >> while it's clear that a firewall rule provides the best protection >> against access from unwanted IPs, tcp-wrappers still serves as a >> useful safeguard in the event of configuration errors. >> >> IMHO it is always better to have multiple layers of protection; anyway >> I respect your opinion. > > OK. Well, I understand your discomfort, but at the same time it's > probably not viable for Debian to maintain this patch out-of-tree > forever. Initially it was fairly straightforward, but this very bug > illustrates why subtle changes over time can make this sort of thing > hard to maintain without upstream assistance. > > Since upstream was pretty determined to drop this - see > https://lists.mindrot.org/pipermail/openssh-unix-dev/2014-April/032497.html > and thread, where it was litigated at some length - I think users would > be well-advised to find a different approach. > > Regards, --=_56ab0adc4cfaa1ea2a7c759a5a1cb595 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset= =3DUTF-8" /></head><body style=3D'font-size: 10pt; font-family: Verdana,Gen= eva,sans-serif'> <p><span class=3D"HwtZe"><span class=3D"jCAhz ChMk0b"><span class=3D"ryNqvb= ">Ok, as I’ve already mentioned, I understand your line of reasoning.= <br />And n</span></span></span><span class=3D"HwtZe"><span class=3D"jCAhz = ChMk0b"><span class=3D"ryNqvb">ot to mention that `libwrap` used to bring a= long a huge list of dependencies - I can see how that would be negative fro= m a developer’s perspective.</span></span><span class=3D"jCAhz"><span= class=3D"ryNqvb"> </span></span></span></p> <p><span class=3D"HwtZe"><span class=3D"jCAhz"><span class=3D"ryNqvb">Still= , it’s a pity.</span></span> <span class=3D"jCAhz ChMk0b"><span class= =3D"ryNqvb">But don’t worry: system administrators will adapt and car= ry on with their lives (more or less).</span></span><span class=3D"jCAhz Ch= Mk0b"><span class=3D"ryNqvb"> </span></span></span></p> <p><span class=3D"HwtZe"><span class=3D"jCAhz ChMk0b"><span class=3D"ryNqvb= ">That said, I was simply asking whether - as long as Debian continues to i= nclude OpenSSH with `libwrap` support - it might be possible to make its us= e a bit easier, even in edge cases like mine.<br /></span></span><span clas= s=3D"jCAhz ChMk0b"><span class=3D"ryNqvb">The patch I submitted was intende= d solely for that purpose.</span></span></span></p> <p><span class=3D"HwtZe"><span class=3D"jCAhz ChMk0b"><span class=3D"ryNqvb= ">In any case, you are the package maintainer; I trust you will make the be= st decision for everyone.</span></span></span></p> <p><span class=3D"HwtZe"><span class=3D"jCAhz ChMk0b"><span class=3D"ryNqvb= ">Regards</span></span></span></p> <div id=3D"signature"> <div class=3D"pre" style=3D"margin: 0; padding: 0; font-family: monospace">= <span class=3D"sig" style=3D"color: #808080; font-family: verdana, geneva, = sans-serif; font-size: 10pt;">-- <br />R.Scussat</span></div> <div class=3D"pre" style=3D"margin: 0; padding: 0; font-family: monospace">= <span class=3D"sig" style=3D"color: #808080; font-family: verdana, geneva, = sans-serif; font-size: 10pt;">CTO - Systems & Networking coordinator<br= />DSP LABS Srl</span></div> </div> <p><br /></p> <p id=3D"reply-intro">On 2026-11-10 11:56, Colin Watson wrote:</p> <blockquote type=3D"cite" style=3D"padding: 0 0.4em; border-left: #1010ff 2= px solid; margin: 0"> <div class=3D"pre" style=3D"margin: 0; padding: 0; font-family: monospace">= On Mon, Nov 09, 2026 at 07:50:29PM +0100, <a href=3D"mailto:dsplabs@dsplabs= =2Enet">dsplabs@dsplabs.net</a> wrote: <blockquote type=3D"cite" style=3D"padding: 0 0.4em; border-left: #1010ff 2= px solid; margin: 0">I had already read that document on fedoraproject.org,= but I must confess that none of the proposed alternatives particularly con= vince me--using 'tcpd' least of all.<br /><br />Furthermore, an sshd instan= ce without tcp-wrappers doesn't exactly excite me either;<br /><br />while = it's clear that a firewall rule provides the best protection against access= from unwanted IPs, tcp-wrappers still serves as a useful safeguard in the = event of configuration errors.<br /><br />IMHO it is always better to have = multiple layers of protection; anyway I respect your opinion.</blockquote> <br />OK. Well, I understand your discomfort, but at the same time it= 's probably not viable for Debian to maintain this patch out-of-tree foreve= r. Initially it was fairly straightforward, but this very bug illustr= ates why subtle changes over time can make this sort of thing hard to maint= ain without upstream assistance.<br /><br />Since upstream was pretty deter= mined to drop this - see <a href=3D"https://lists.mindrot.org/pipermail/ope= nssh-unix-dev/2014-April/032497.html" target=3D"_blank" rel=3D"noreferrer n= oopener">https://lists.mindrot.org/pipermail/openssh-unix-dev/2014-April/03= 2497.html</a> and thread, where it was litigated at some length - I think u= sers would be well-advised to find a different approach.<br /><br />Regards= ,</div> </blockquote> </body></html> --=_56ab0adc4cfaa1ea2a7c759a5a1cb595--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads