slackware-current/source/n/openssh/openssh.tcp_wrappers.diff
Patrick J Volkerding b70192b921 Mon Aug 27 20:27:22 UTC 2018
a/kernel-firmware-20180825_fea76a0-noarch-1.txz:  Upgraded.
ap/vim-8.1.0328-x86_64-1.txz:  Upgraded.
d/meson-0.47.2-x86_64-1.txz:  Upgraded.
d/python-setuptools-40.2.0-x86_64-1.txz:  Upgraded.
l/python-certifi-2018.8.24-x86_64-1.txz:  Upgraded.
l/python-idna-2.7-x86_64-1.txz:  Upgraded.
l/python-packaging-17.1-x86_64-1.txz:  Upgraded.
l/python-pillow-5.2.0-x86_64-1.txz:  Upgraded.
l/python-requests-2.19.1-x86_64-1.txz:  Upgraded.
l/python-urllib3-1.23-x86_64-1.txz:  Upgraded.
l/talloc-2.1.14-x86_64-1.txz:  Upgraded.
l/tdb-1.3.16-x86_64-1.txz:  Upgraded.
l/tevent-0.9.37-x86_64-1.txz:  Upgraded.
n/ethtool-4.18-x86_64-1.txz:  Upgraded.
n/openssh-7.8p1-x86_64-1.txz:  Upgraded.
n/samba-4.8.5-x86_64-1.txz:  Upgraded.
x/xauth-1.0.10-x86_64-3.txz:  Rebuilt.
  Patched to fix a bug where changing the hostname caused X access to be lost.
  Thanks to TurboBlaze.
xap/vim-gvim-8.1.0328-x86_64-1.txz:  Upgraded.
2018-08-28 09:00:35 +02:00

138 lines
3.9 KiB
Diff

--- ./configure.ac.orig 2018-08-23 00:41:42.000000000 -0500
+++ ./configure.ac 2018-08-25 19:14:10.706002529 -0500
@@ -1502,6 +1502,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,
@@ -5177,6 +5233,7 @@
echo " OSF SIA support: $SIA_MSG"
echo " KerberosV support: $KRB5_MSG"
echo " SELinux support: $SELINUX_MSG"
+echo " TCP Wrappers support: $TCPW_MSG"
echo " MD5 password support: $MD5_MSG"
echo " libedit support: $LIBEDIT_MSG"
echo " libldns support: $LDNS_MSG"
--- ./sshd.c.orig 2018-08-23 00:41:42.000000000 -0500
+++ ./sshd.c 2018-08-25 19:12:52.901002527 -0500
@@ -122,6 +122,12 @@
#include "auth-options.h"
#include "version.h"
#include "ssherr.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)
@@ -2063,6 +2069,26 @@
packet_set_server();
ssh = active_state; /* XXX */
+/* 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 (packet_connection_is_on_socket()) { /* This check must be after 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 */
--- ./sshd.8.orig 2018-08-23 00:41:42.000000000 -0500
+++ ./sshd.8 2018-08-25 19:12:52.899002527 -0500
@@ -873,6 +873,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 ) .
@@ -975,6 +981,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 ,