slackware-current/source/n/openssh/openssh.tcp_wrappers.diff
Patrick J Volkerding 617b679ca8 Fri Feb 25 00:03:28 UTC 2022
ap/inxi-3.3.13_1-noarch-1.txz:  Upgraded.
d/parallel-20220222-noarch-1.txz:  Upgraded.
d/patchelf-0.14.5-x86_64-1.txz:  Upgraded.
d/rust-1.59.0-x86_64-1.txz:  Upgraded.
n/cyrus-sasl-2.1.28-x86_64-1.txz:  Upgraded.
  This update fixes bugs and security issues.
  For more information, see:
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19906
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24407
  (* Security fix *)
n/nftables-1.0.2-x86_64-1.txz:  Upgraded.
n/nghttp2-1.47.0-x86_64-1.txz:  Upgraded.
n/openssh-8.9p1-x86_64-1.txz:  Upgraded.
n/whois-5.5.12-x86_64-1.txz:  Upgraded.
x/mesa-21.3.7-x86_64-1.txz:  Upgraded.
x/xf86-video-amdgpu-22.0.0-x86_64-1.txz:  Upgraded.
xap/freerdp-2.6.0-x86_64-1.txz:  Upgraded.
xap/gftp-2.9.1b-x86_64-1.txz:  Upgraded.
extra/xv/xv-3.10a-x86_64-10.txz:  Rebuilt.
  Drop JasPer support until xv can be ported to the new JasPer library (or
  preferably to openjpeg).
2022-02-25 06:59:43 +01:00

139 lines
3.9 KiB
Diff

--- ./sshd.8.orig 2022-02-23 05:31:11.000000000 -0600
+++ ./sshd.8 2022-02-24 13:28:36.533888569 -0600
@@ -908,6 +908,12 @@
This file should be writable only by the user, and need not be
readable by anyone else.
.Pp
+.It Pa /etc/hosts.allow
+.It Pa /etc/hosts.deny
+Access controls that should be enforced by tcp-wrappers are defined here.
+Further details are described in
+.Xr hosts_access 5 .
+.Pp
.It Pa /etc/hosts.equiv
This file is for host-based authentication (see
.Xr ssh 1 ) .
@@ -1010,6 +1016,7 @@
.Xr ssh-keygen 1 ,
.Xr ssh-keyscan 1 ,
.Xr chroot 2 ,
+.Xr hosts_access 5 ,
.Xr login.conf 5 ,
.Xr moduli 5 ,
.Xr sshd_config 5 ,
--- ./configure.ac.orig 2022-02-23 05:31:11.000000000 -0600
+++ ./configure.ac 2022-02-24 13:30:10.535883370 -0600
@@ -1599,6 +1599,62 @@
AC_MSG_RESULT([no])
fi
+# Check whether user wants TCP wrappers support
+TCPW_MSG="no"
+AC_ARG_WITH([tcp-wrappers],
+ [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
+ [
+ if test "x$withval" != "xno" ; then
+ saved_LIBS="$LIBS"
+ saved_LDFLAGS="$LDFLAGS"
+ saved_CPPFLAGS="$CPPFLAGS"
+ if test -n "${withval}" && \
+ test "x${withval}" != "xyes"; then
+ if test -d "${withval}/lib"; then
+ if test -n "${need_dash_r}"; then
+ LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
+ else
+ LDFLAGS="-L${withval}/lib ${LDFLAGS}"
+ fi
+ else
+ if test -n "${need_dash_r}"; then
+ LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
+ else
+ LDFLAGS="-L${withval} ${LDFLAGS}"
+ fi
+ fi
+ if test -d "${withval}/include"; then
+ CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
+ else
+ CPPFLAGS="-I${withval} ${CPPFLAGS}"
+ fi
+ fi
+ LIBS="-lwrap -lnsl $LIBS"
+ AC_MSG_CHECKING([for libwrap])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <tcpd.h>
+int deny_severity = 0, allow_severity = 0;
+ ]], [[
+ hosts_access(0);
+ ]])], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([LIBWRAP], [1],
+ [Define if you want
+ TCP Wrappers support])
+ SSHDLIBS="$SSHDLIBS -lwrap -lnsl"
+ TCPW_MSG="yes"
+ ], [
+ AC_MSG_ERROR([*** libwrap missing])
+
+ ])
+ LIBS="$saved_LIBS"
+ fi
+ ]
+)
+
# Check whether user wants to use ldns
LDNS_MSG="no"
AC_ARG_WITH(ldns,
@@ -5593,6 +5649,7 @@
echo " OSF SIA support: $SIA_MSG"
echo " KerberosV support: $KRB5_MSG"
echo " SELinux support: $SELINUX_MSG"
+echo " TCP Wrappers support: $TCPW_MSG"
echo " libedit support: $LIBEDIT_MSG"
echo " libldns support: $LDNS_MSG"
echo " Solaris process contract support: $SPC_MSG"
--- ./sshd.c.orig 2022-02-23 05:31:11.000000000 -0600
+++ ./sshd.c 2022-02-24 13:28:36.533888569 -0600
@@ -129,6 +129,13 @@
#include "srclimit.h"
#include "dh.h"
+#ifdef LIBWRAP
+#include <tcpd.h>
+#include <syslog.h>
+int allow_severity;
+int deny_severity;
+#endif /* LIBWRAP */
+
/* Re-exec fds */
#define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1)
#define REEXEC_STARTUP_PIPE_FD (STDERR_FILENO + 2)
@@ -2138,6 +2145,26 @@
the_active_state = ssh;
ssh_packet_set_server(ssh);
+/* Moved LIBWRAP check here */
+#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)) { /* This check must be after ssh_packet_set_connection() */
+ struct request_info req;
+
+ request_init(&req, RQ_DAEMON, __progname, RQ_FILE, sock_in, 0);
+ fromhost(&req);
+
+ if (!hosts_access(&req)) {
+ debug("Connection refused by tcp wrapper");
+ refuse(&req);
+ /* NOTREACHED */
+ fatal("libwrap refuse returns");
+ }
+ }
+#endif /* LIBWRAP */
+
check_ip_options(ssh);
/* Prepare the channels layer */