kentpeacock / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone
aedd00
diff -up openssh/auth.c.keycat openssh/misc.c
aedd00
--- openssh/auth.c.keycat	2015-06-24 10:57:50.158849606 +0200
aedd00
+++ openssh/auth.c	2015-06-24 11:04:23.989868638 +0200
aedd00
@@ -966,6 +966,14 @@ subprocess(const char *tag, struct passw
aedd00
 			_exit(1);
aedd00
 		}
aedd00
 
aedd00
+#ifdef WITH_SELINUX
aedd00
+		if (sshd_selinux_setup_env_variables() < 0) {
aedd00
+			error ("failed to copy environment:  %s",
aedd00
+			    strerror(errno));
aedd00
+			_exit(127);
aedd00
+		}
aedd00
+#endif
aedd00
+
aedd00
 		execve(av[0], av, child_env);
aedd00
 		error("%s exec \"%s\": %s", tag, command, strerror(errno));
aedd00
 		_exit(127);
aedd00
diff -up openssh/HOWTO.ssh-keycat.keycat openssh/HOWTO.ssh-keycat
aedd00
--- openssh/HOWTO.ssh-keycat.keycat	2015-06-24 10:57:50.157849608 +0200
aedd00
+++ openssh/HOWTO.ssh-keycat	2015-06-24 10:57:50.157849608 +0200
aedd00
@@ -0,0 +1,12 @@
aedd00
+The ssh-keycat retrieves the content of the ~/.ssh/authorized_keys
aedd00
+of an user in any environment. This includes environments with
aedd00
+polyinstantiation of home directories and SELinux MLS policy enabled.
aedd00
+
aedd00
+To use ssh-keycat, set these options in /etc/ssh/sshd_config file:
aedd00
+        AuthorizedKeysCommand /usr/libexec/openssh/ssh-keycat
aedd00
+        AuthorizedKeysCommandUser root
aedd00
+
aedd00
+Do not forget to enable public key authentication:
aedd00
+        PubkeyAuthentication yes
aedd00
+
aedd00
+
aedd00
diff -up openssh/Makefile.in.keycat openssh/Makefile.in
aedd00
--- openssh/Makefile.in.keycat	2015-06-24 10:57:50.152849621 +0200
aedd00
+++ openssh/Makefile.in	2015-06-24 10:57:50.157849608 +0200
aedd00
@@ -27,6 +27,7 @@ SFTP_SERVER=$(libexecdir)/sftp-server
aedd00
 SSH_KEYSIGN=$(libexecdir)/ssh-keysign
aedd00
 SSH_LDAP_HELPER=$(libexecdir)/ssh-ldap-helper
aedd00
 SSH_LDAP_WRAPPER=$(libexecdir)/ssh-ldap-wrapper
aedd00
+SSH_KEYCAT=$(libexecdir)/ssh-keycat
aedd00
 SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
aedd00
 PRIVSEP_PATH=@PRIVSEP_PATH@
aedd00
 SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@
aedd00
@@ -52,6 +52,7 @@ K5LIBS=@K5LIBS@
aedd00
 GSSLIBS=@GSSLIBS@
aedd00
 SSHLIBS=@SSHLIBS@
aedd00
 SSHDLIBS=@SSHDLIBS@
aedd00
+KEYCATLIBS=@KEYCATLIBS@
aedd00
 LIBEDIT=@LIBEDIT@
aedd00
 AR=@AR@
aedd00
 AWK=@AWK@
aedd00
@@ -65,7 +66,7 @@ EXEEXT=@EXEEXT@
aedd00
 MKDIR_P=@MKDIR_P@
aedd00
 INSTALL_SSH_LDAP_HELPER=@INSTALL_SSH_LDAP_HELPER@
aedd00
 
aedd00
-TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) ssh-ldap-helper$(EXEEXT)
aedd00
+TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) ssh-ldap-helper$(EXEEXT) ssh-keycat$(EXEEXT)
aedd00
 
aedd00
 XMSS_OBJS=\
aedd00
 	ssh-xmss.o \
aedd00
@@ -190,6 +191,9 @@ ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT)
aedd00
 ssh-ldap-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ldapconf.o ldapbody.o ldapmisc.o ldap-helper.o
aedd00
 	$(LD) -o $@ ldapconf.o ldapbody.o ldapmisc.o ldap-helper.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) $(LDAPLIBS)
aedd00
 
aedd00
+ssh-keycat$(EXEEXT): $(LIBCOMPAT) $(SSHDOBJS) libssh.a ssh-keycat.o uidswap.o
aedd00
+	$(LD) -o $@ ssh-keycat.o uidswap.o $(LDFLAGS) -lssh -lopenbsd-compat $(KEYCATLIBS) $(LIBS)
aedd00
+
aedd00
 ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o
aedd00
 	$(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
aedd00
 
aedd00
@@ -321,6 +325,7 @@ install-files:
aedd00
 		$(INSTALL) -m 0700 $(STRIP_OPT) ssh-ldap-helper $(DESTDIR)$(SSH_LDAP_HELPER) ; \
aedd00
 		$(INSTALL) -m 0700 ssh-ldap-wrapper $(DESTDIR)$(SSH_LDAP_WRAPPER) ; \
aedd00
 	fi
aedd00
+	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keycat$(EXEEXT) $(DESTDIR)$(libexecdir)/ssh-keycat$(EXEEXT)
aedd00
 	$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
aedd00
 	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
aedd00
 	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
aedd00
diff -up openssh/openbsd-compat/port-linux.h.keycat openssh/openbsd-compat/port-linux.h
aedd00
--- openssh/openbsd-compat/port-linux.h.keycat	2015-06-24 10:57:50.150849626 +0200
aedd00
+++ openssh/openbsd-compat/port-linux.h	2015-06-24 10:57:50.160849601 +0200
aedd00
@@ -25,8 +25,10 @@ void ssh_selinux_setup_pty(char *, const
aedd00
 void ssh_selinux_change_context(const char *);
aedd00
 void ssh_selinux_setfscreatecon(const char *);
aedd00
 
aedd00
+int sshd_selinux_enabled(void);
aedd00
 void sshd_selinux_copy_context(void);
aedd00
 void sshd_selinux_setup_exec_context(char *);
aedd00
+int sshd_selinux_setup_env_variables(void);
aedd00
 #endif
aedd00
 
aedd00
 #ifdef LINUX_OOM_ADJUST
aedd00
diff -up openssh/openbsd-compat/port-linux-sshd.c.keycat openssh/openbsd-compat/port-linux-sshd.c
aedd00
--- openssh/openbsd-compat/port-linux-sshd.c.keycat	2015-06-24 10:57:50.150849626 +0200
aedd00
+++ openssh/openbsd-compat/port-linux-sshd.c	2015-06-24 10:57:50.159849603 +0200
aedd00
@@ -54,6 +54,20 @@ extern Authctxt *the_authctxt;
aedd00
 extern int inetd_flag;
aedd00
 extern int rexeced_flag;
aedd00
 
aedd00
+/* Wrapper around is_selinux_enabled() to log its return value once only */
aedd00
+int
aedd00
+sshd_selinux_enabled(void)
aedd00
+{
aedd00
+	static int enabled = -1;
aedd00
+
aedd00
+	if (enabled == -1) {
aedd00
+		enabled = (is_selinux_enabled() == 1);
aedd00
+		debug("SELinux support %s", enabled ? "enabled" : "disabled");
aedd00
+	}
aedd00
+
aedd00
+	return (enabled);
aedd00
+}
aedd00
+
aedd00
 /* Send audit message */
aedd00
 static int
aedd00
 sshd_selinux_send_audit_message(int success, security_context_t default_context,
aedd00
@@ -308,7 +322,7 @@ sshd_selinux_getctxbyname(char *pwname,
aedd00
 
aedd00
 /* Setup environment variables for pam_selinux */
aedd00
 static int
aedd00
-sshd_selinux_setup_pam_variables(void)
aedd00
+sshd_selinux_setup_variables(int(*set_it)(char *, const char *))
aedd00
 {
aedd00
 	const char *reqlvl;
aedd00
 	char *role;
aedd00
@@ -319,16 +333,16 @@ sshd_selinux_setup_pam_variables(void)
aedd00
 
aedd00
 	ssh_selinux_get_role_level(&role, &reqlvl);
aedd00
 
aedd00
-	rv = do_pam_putenv("SELINUX_ROLE_REQUESTED", role ? role : "");
aedd00
+	rv = set_it("SELINUX_ROLE_REQUESTED", role ? role : "");
aedd00
 
aedd00
 	if (inetd_flag && !rexeced_flag) {
aedd00
 		use_current = "1";
aedd00
 	} else {
aedd00
 		use_current = "";
aedd00
-		rv = rv || do_pam_putenv("SELINUX_LEVEL_REQUESTED", reqlvl ? reqlvl: "");
aedd00
+		rv = rv || set_it("SELINUX_LEVEL_REQUESTED", reqlvl ? reqlvl: "");
aedd00
 	}
aedd00
 
aedd00
-	rv = rv || do_pam_putenv("SELINUX_USE_CURRENT_RANGE", use_current);
aedd00
+	rv = rv || set_it("SELINUX_USE_CURRENT_RANGE", use_current);
aedd00
 
aedd00
 	if (role != NULL)
aedd00
 		free(role);
aedd00
@@ -336,6 +350,24 @@ sshd_selinux_setup_pam_variables(void)
aedd00
 	return rv;
aedd00
 }
aedd00
 
aedd00
+static int
aedd00
+sshd_selinux_setup_pam_variables(void)
aedd00
+{
aedd00
+	return sshd_selinux_setup_variables(do_pam_putenv);
aedd00
+}
aedd00
+
aedd00
+static int
aedd00
+do_setenv(char *name, const char *value)
aedd00
+{
aedd00
+	return setenv(name, value, 1);
aedd00
+}
aedd00
+
aedd00
+int
aedd00
+sshd_selinux_setup_env_variables(void)
aedd00
+{
aedd00
+	return sshd_selinux_setup_variables(do_setenv);
aedd00
+}
aedd00
+
aedd00
 /* Set the execution context to the default for the specified user */
aedd00
 void
aedd00
 sshd_selinux_setup_exec_context(char *pwname)
aedd00
@@ -344,7 +376,7 @@ sshd_selinux_setup_exec_context(char *pw
aedd00
 	int r = 0;
aedd00
 	security_context_t default_ctx = NULL;
aedd00
 
aedd00
-	if (!ssh_selinux_enabled())
aedd00
+	if (!sshd_selinux_enabled())
aedd00
 		return;
aedd00
 
aedd00
 	if (options.use_pam) {
aedd00
@@ -415,7 +447,7 @@ sshd_selinux_copy_context(void)
aedd00
 {
aedd00
 	security_context_t *ctx;
aedd00
 
aedd00
-	if (!ssh_selinux_enabled())
aedd00
+	if (!sshd_selinux_enabled())
aedd00
 		return;
aedd00
 
aedd00
 	if (getexeccon((security_context_t *)&ctx) != 0) {
aedd00
diff -up openssh/platform.c.keycat openssh/platform.c
aedd00
--- openssh/platform.c.keycat	2015-06-24 10:57:50.147849633 +0200
aedd00
+++ openssh/platform.c	2015-06-24 10:57:50.160849601 +0200
aedd00
@@ -103,7 +103,7 @@ platform_setusercontext(struct passwd *p
aedd00
 {
aedd00
 #ifdef WITH_SELINUX
aedd00
 	/* Cache selinux status for later use */
aedd00
-	(void)ssh_selinux_enabled();
aedd00
+	(void)sshd_selinux_enabled();
aedd00
 #endif
aedd00
 
aedd00
 #ifdef USE_SOLARIS_PROJECTS
aedd00
diff -up openssh/ssh-keycat.c.keycat openssh/ssh-keycat.c
aedd00
--- openssh/ssh-keycat.c.keycat	2015-06-24 10:57:50.161849599 +0200
aedd00
+++ openssh/ssh-keycat.c	2015-06-24 10:57:50.161849599 +0200
aedd00
@@ -0,0 +1,241 @@
aedd00
+/*
aedd00
+ * Redistribution and use in source and binary forms, with or without
aedd00
+ * modification, are permitted provided that the following conditions
aedd00
+ * are met:
aedd00
+ * 1. Redistributions of source code must retain the above copyright
aedd00
+ *    notice, and the entire permission notice in its entirety,
aedd00
+ *    including the disclaimer of warranties.
aedd00
+ * 2. Redistributions in binary form must reproduce the above copyright
aedd00
+ *    notice, this list of conditions and the following disclaimer in the
aedd00
+ *    documentation and/or other materials provided with the distribution.
aedd00
+ * 3. The name of the author may not be used to endorse or promote
aedd00
+ *    products derived from this software without specific prior
aedd00
+ *    written permission.
aedd00
+ *
aedd00
+ * ALTERNATIVELY, this product may be distributed under the terms of
aedd00
+ * the GNU Public License, in which case the provisions of the GPL are
aedd00
+ * required INSTEAD OF the above restrictions.  (This clause is
aedd00
+ * necessary due to a potential bad interaction between the GPL and
aedd00
+ * the restrictions contained in a BSD-style copyright.)
aedd00
+ *
aedd00
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
aedd00
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
aedd00
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
aedd00
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
aedd00
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
aedd00
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
aedd00
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
aedd00
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
aedd00
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
aedd00
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
aedd00
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
aedd00
+ */
aedd00
+
aedd00
+/*
aedd00
+ * Copyright (c) 2011 Red Hat, Inc.
aedd00
+ * Written by Tomas Mraz <tmraz@redhat.com>
aedd00
+*/
aedd00
+
aedd00
+#define _GNU_SOURCE
aedd00
+
aedd00
+#include "config.h"
aedd00
+#include <stdio.h>
aedd00
+#include <stdlib.h>
aedd00
+#include <string.h>
aedd00
+#include <sys/types.h>
aedd00
+#include <sys/stat.h>
aedd00
+#include <pwd.h>
aedd00
+#include <fcntl.h>
aedd00
+#include <unistd.h>
aedd00
+#ifdef HAVE_STDINT_H
aedd00
+#include <stdint.h>
aedd00
+#endif
aedd00
+
aedd00
+#include <security/pam_appl.h>
aedd00
+
aedd00
+#include "uidswap.h"
aedd00
+#include "misc.h"
aedd00
+
aedd00
+#define ERR_USAGE 1
aedd00
+#define ERR_PAM_START 2
aedd00
+#define ERR_OPEN_SESSION 3
aedd00
+#define ERR_CLOSE_SESSION 4
aedd00
+#define ERR_PAM_END 5
aedd00
+#define ERR_GETPWNAM 6
aedd00
+#define ERR_MEMORY 7
aedd00
+#define ERR_OPEN 8
aedd00
+#define ERR_FILE_MODE 9
aedd00
+#define ERR_FDOPEN 10
aedd00
+#define ERR_STAT 11
aedd00
+#define ERR_WRITE 12
aedd00
+#define ERR_PAM_PUTENV 13
aedd00
+#define BUFLEN 4096
aedd00
+
aedd00
+/* Just ignore the messages in the conversation function */
aedd00
+static int
aedd00
+dummy_conv(int num_msg, const struct pam_message **msgm,
aedd00
+	   struct pam_response **response, void *appdata_ptr)
aedd00
+{
aedd00
+	struct pam_response *rsp;
aedd00
+
aedd00
+	(void)msgm;
aedd00
+	(void)appdata_ptr;
aedd00
+
aedd00
+	if (num_msg <= 0)
aedd00
+		return PAM_CONV_ERR;
aedd00
+
aedd00
+	/* Just allocate the array as empty responses */
aedd00
+	rsp = calloc (num_msg, sizeof (struct pam_response));
aedd00
+	if (rsp == NULL)
aedd00
+		return PAM_CONV_ERR;
aedd00
+
aedd00
+	*response = rsp;
aedd00
+	return PAM_SUCCESS;
aedd00
+}
aedd00
+
aedd00
+static struct pam_conv conv = {
aedd00
+	dummy_conv,
aedd00
+	NULL
aedd00
+};
aedd00
+
aedd00
+char *
aedd00
+make_auth_keys_name(const struct passwd *pwd)
aedd00
+{
aedd00
+	char *fname;
aedd00
+
aedd00
+	if (asprintf(&fname, "%s/.ssh/authorized_keys", pwd->pw_dir) < 0)
aedd00
+		return NULL;
aedd00
+
aedd00
+	return fname;
aedd00
+}
aedd00
+
aedd00
+int
aedd00
+dump_keys(const char *user)
aedd00
+{
aedd00
+	struct passwd *pwd;
aedd00
+	int fd = -1;
aedd00
+	FILE *f = NULL;
aedd00
+	char *fname = NULL;
aedd00
+	int rv = 0;
aedd00
+	char buf[BUFLEN];
aedd00
+	size_t len;
aedd00
+	struct stat st;
aedd00
+
aedd00
+	if ((pwd = getpwnam(user)) == NULL) {
aedd00
+		return ERR_GETPWNAM;
aedd00
+	}
aedd00
+
aedd00
+	if ((fname = make_auth_keys_name(pwd)) == NULL) {
aedd00
+		return ERR_MEMORY;
aedd00
+	}
aedd00
+
aedd00
+	temporarily_use_uid(pwd);
aedd00
+
aedd00
+	if ((fd = open(fname, O_RDONLY|O_NONBLOCK|O_NOFOLLOW, 0)) < 0) {
aedd00
+		rv = ERR_OPEN;
aedd00
+		goto fail;
aedd00
+	}
aedd00
+
aedd00
+	if (fstat(fd, &st) < 0) {
aedd00
+		rv = ERR_STAT;
aedd00
+		goto fail;
aedd00
+	}
aedd00
+
aedd00
+	if (!S_ISREG(st.st_mode) || 
aedd00
+		(st.st_uid != pwd->pw_uid && st.st_uid != 0)) {
aedd00
+		rv = ERR_FILE_MODE;
aedd00
+		goto fail;
aedd00
+	}
aedd00
+
aedd00
+	unset_nonblock(fd);
aedd00
+
aedd00
+	if ((f = fdopen(fd, "r")) == NULL) {
aedd00
+		rv = ERR_FDOPEN;
aedd00
+		goto fail;
aedd00
+	}
aedd00
+
aedd00
+	fd = -1;
aedd00
+
aedd00
+	while ((len = fread(buf, 1, sizeof(buf), f)) > 0) {
aedd00
+		rv = fwrite(buf, 1, len, stdout) != len ? ERR_WRITE : 0;
aedd00
+	}
aedd00
+
aedd00
+fail:
aedd00
+	if (fd != -1)
aedd00
+		close(fd);
aedd00
+	if (f != NULL)
aedd00
+		fclose(f);
aedd00
+	free(fname);
aedd00
+	restore_uid();
aedd00
+	return rv;
aedd00
+}
aedd00
+
aedd00
+static const char *env_names[] = { "SELINUX_ROLE_REQUESTED",
aedd00
+	"SELINUX_LEVEL_REQUESTED",
aedd00
+	"SELINUX_USE_CURRENT_RANGE"
aedd00
+};
aedd00
+
aedd00
+extern char **environ;
aedd00
+
aedd00
+int
aedd00
+set_pam_environment(pam_handle_t *pamh)
aedd00
+{
aedd00
+	int i;
aedd00
+	size_t j;
aedd00
+
aedd00
+	for (j = 0; j < sizeof(env_names)/sizeof(env_names[0]); ++j) {
aedd00
+		int len = strlen(env_names[j]);
aedd00
+
aedd00
+		for (i = 0; environ[i] != NULL; ++i) {
aedd00
+			if (strncmp(env_names[j], environ[i], len) == 0 &&
aedd00
+			    environ[i][len] == '=') {
aedd00
+				if (pam_putenv(pamh, environ[i]) != PAM_SUCCESS)
aedd00
+					return ERR_PAM_PUTENV;
aedd00
+			}
aedd00
+		}
aedd00
+	}
aedd00
+
aedd00
+	return 0;
aedd00
+}
aedd00
+
aedd00
+int
aedd00
+main(int argc, char *argv[])
aedd00
+{
aedd00
+	pam_handle_t *pamh = NULL;
aedd00
+	int retval;
aedd00
+	int ev = 0;
aedd00
+
aedd00
+	if (argc != 2) {
aedd00
+		fprintf(stderr, "Usage: %s <user-name>\n", argv[0]);
aedd00
+		return ERR_USAGE;
aedd00
+	}
aedd00
+
aedd00
+	retval = pam_start("ssh-keycat", argv[1], &conv, &pamh);
aedd00
+	if (retval != PAM_SUCCESS) {
aedd00
+		return ERR_PAM_START;
aedd00
+	}
aedd00
+
aedd00
+	ev = set_pam_environment(pamh);
aedd00
+	if (ev != 0)
aedd00
+		goto finish;
aedd00
+
aedd00
+	retval = pam_open_session(pamh, PAM_SILENT);
aedd00
+	if (retval != PAM_SUCCESS) {
aedd00
+		ev = ERR_OPEN_SESSION;
aedd00
+		goto finish;
aedd00
+	}
aedd00
+
aedd00
+	ev = dump_keys(argv[1]);
aedd00
+
aedd00
+	retval = pam_close_session(pamh, PAM_SILENT);
aedd00
+	if (retval != PAM_SUCCESS) {
aedd00
+		ev = ERR_CLOSE_SESSION;
aedd00
+	}
aedd00
+
aedd00
+finish:
aedd00
+	retval = pam_end (pamh,retval);
aedd00
+	if (retval != PAM_SUCCESS) {
aedd00
+		ev = ERR_PAM_END;
aedd00
+	}
aedd00
+	return ev;
aedd00
+}
aedd00
diff --git a/configure.ac b/configure.ac
aedd00
index 3bbccfd..6481f1f 100644
aedd00
--- a/configure.ac
aedd00
+++ b/configure.ac
aedd00
@@ -2952,6 +2952,7 @@ AC_ARG_WITH([pam],
aedd00
 			PAM_MSG="yes"
aedd00
 
aedd00
 			SSHDLIBS="$SSHDLIBS -lpam"
aedd00
+			KEYCATLIBS="$KEYCATLIBS -lpam"
aedd00
 			AC_DEFINE([USE_PAM], [1],
aedd00
 				[Define if you want to enable PAM support])
aedd00
 
aedd00
@@ -3105,6 +3106,7 @@
aedd00
 					;;
aedd00
 				*)
aedd00
 					SSHDLIBS="$SSHDLIBS -ldl"
aedd00
+					KEYCATLIBS="$KEYCATLIBS -ldl"
aedd00
 					;;
aedd00
 				esac
aedd00
 			fi
aedd00
@@ -4042,6 +4044,7 @@ AC_ARG_WITH([selinux],
aedd00
 )
aedd00
 AC_SUBST([SSHLIBS])
aedd00
 AC_SUBST([SSHDLIBS])
aedd00
+AC_SUBST([KEYCATLIBS])
aedd00
 
aedd00
 # Check whether user wants Kerberos 5 support
aedd00
 KRB5_MSG="no"
aedd00
@@ -5031,6 +5034,9 @@ fi
aedd00
 if test ! -z "${SSHLIBS}"; then
aedd00
 echo "          +for ssh: ${SSHLIBS}"
aedd00
 fi
aedd00
+if test ! -z "${KEYCATLIBS}"; then
aedd00
+echo "   +for ssh-keycat: ${KEYCATLIBS}"
aedd00
+fi
aedd00
 
aedd00
 echo ""
aedd00