vishalmishra434 / rpms / openssh

Forked from rpms/openssh 3 months ago
Clone
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/auth2-pubkey.c.pka openssh-5.3p1/auth2-pubkey.c
Jan F. Chadima 201f4a
--- openssh-5.3p1/auth2-pubkey.c.pka	2009-10-15 06:26:25.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/auth2-pubkey.c	2009-10-15 06:44:32.000000000 +0200
Jan F. Chadima 201f4a
@@ -184,26 +184,14 @@ done:
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 /* return 1 if user allows given key */
Jan F. Chadima 201f4a
 static int
Jan F. Chadima 201f4a
-user_key_allowed2(struct passwd *pw, Key *key, char *file)
Jan F. Chadima 201f4a
+user_search_key_in_file(FILE *f, char *file, Key* key, struct passwd *pw)
Jan F. Chadima 201f4a
 {
Jan F. Chadima 201f4a
 	char line[SSH_MAX_PUBKEY_BYTES];
Jan F. Chadima 201f4a
 	int found_key = 0;
Jan F. Chadima 201f4a
-	FILE *f;
Jan F. Chadima 201f4a
 	u_long linenum = 0;
Jan F. Chadima 201f4a
 	Key *found;
Jan F. Chadima 201f4a
 	char *fp;
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
-	/* Temporarily use the user's uid. */
Jan F. Chadima 201f4a
-	temporarily_use_uid(pw);
Jan F. Chadima 201f4a
-
Jan F. Chadima 201f4a
-	debug("trying public key file %s", file);
Jan F. Chadima 201f4a
-	f = auth_openkeyfile(file, pw, options.strict_modes);
Jan F. Chadima 201f4a
-
Jan F. Chadima 201f4a
-	if (!f) {
Jan F. Chadima 201f4a
-		restore_uid();
Jan F. Chadima 201f4a
-		return 0;
Jan F. Chadima 201f4a
-	}
Jan F. Chadima 201f4a
-
Jan F. Chadima 201f4a
 	found_key = 0;
Jan F. Chadima 201f4a
 	found = key_new(key->type);
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
@@ -248,21 +236,160 @@ user_key_allowed2(struct passwd *pw, Key
Jan F. Chadima 201f4a
 			break;
Jan F. Chadima 201f4a
 		}
Jan F. Chadima 201f4a
 	}
Jan F. Chadima 201f4a
-	restore_uid();
Jan F. Chadima 201f4a
-	fclose(f);
Jan F. Chadima 201f4a
 	key_free(found);
Jan F. Chadima 201f4a
 	if (!found_key)
Jan F. Chadima 201f4a
 		debug2("key not found");
Jan F. Chadima 201f4a
 	return found_key;
Jan F. Chadima 201f4a
 }
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
-/* check whether given key is in .ssh/authorized_keys* */
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+/* return 1 if user allows given key */
Jan F. Chadima 201f4a
+static int
Jan F. Chadima 201f4a
+user_key_allowed2(struct passwd *pw, Key *key, char *file)
Jan F. Chadima 201f4a
+{
Jan F. Chadima 201f4a
+	FILE *f;
Jan F. Chadima 201f4a
+	int found_key = 0;
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	/* Temporarily use the user's uid. */
Jan F. Chadima 201f4a
+	temporarily_use_uid(pw);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	debug("trying public key file %s", file);
Jan F. Chadima 201f4a
+	f = auth_openkeyfile(file, pw, options.strict_modes);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+ 	if (f) {
Jan F. Chadima 201f4a
+ 		found_key = user_search_key_in_file (f, file, key, pw);
Jan F. Chadima 201f4a
+		fclose(f);
Jan F. Chadima 201f4a
+	}
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	restore_uid();
Jan F. Chadima 201f4a
+	return found_key;
Jan F. Chadima 201f4a
+}
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+#ifdef WITH_PUBKEY_AGENT
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+#define WHITESPACE " \t\r\n"
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+/* return 1 if user allows given key */
Jan F. Chadima 201f4a
+static int
Jan F. Chadima 201f4a
+user_key_via_agent_allowed2(struct passwd *pw, Key *key)
Jan F. Chadima 201f4a
+{
Jan F. Chadima 201f4a
+	FILE *f;
Jan F. Chadima 201f4a
+	int found_key = 0;
Jan F. Chadima 201f4a
+	char *pubkey_agent_string = NULL;
Jan F. Chadima 201f4a
+	char *tmp_pubkey_agent_string = NULL;
Jan F. Chadima 201f4a
+	char *progname;
Jan F. Chadima 201f4a
+	char *cp;
Jan F. Chadima 201f4a
+	struct passwd *runas_pw;
Jan F. Chadima 201f4a
+	struct stat st;
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	if (options.pubkey_agent == NULL || options.pubkey_agent[0] != '/')
Jan F. Chadima 201f4a
+		return -1;
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	/* get the run as identity from config */
Jan F. Chadima 201f4a
+	runas_pw = (options.pubkey_agent_runas == NULL)? pw
Jan F. Chadima 201f4a
+	    : getpwnam (options.pubkey_agent_runas);
Jan F. Chadima 201f4a
+	if (!runas_pw) {
Jan F. Chadima 201f4a
+		error("%s: getpwnam(\"%s\"): %s", __func__,
Jan F. Chadima 201f4a
+		    options.pubkey_agent_runas, strerror(errno));
Jan F. Chadima 201f4a
+		return 0;
Jan F. Chadima 201f4a
+	}
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	/* Temporarily use the specified uid. */
Jan F. Chadima 201f4a
+	if (runas_pw->pw_uid != 0)
Jan F. Chadima 201f4a
+		temporarily_use_uid(runas_pw);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	pubkey_agent_string = percent_expand(options.pubkey_agent,
Jan F. Chadima 201f4a
+	    "h", pw->pw_dir, "u", pw->pw_name, (char *)NULL);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	/* Test whether agent can be modified by non root user */
Jan F. Chadima 201f4a
+	tmp_pubkey_agent_string = xstrdup (pubkey_agent_string);
Jan F. Chadima 201f4a
+	progname = strtok (tmp_pubkey_agent_string, WHITESPACE);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	debug3("%s: checking program '%s'", __func__, progname);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	if (stat (progname, &st) < 0) {
Jan F. Chadima 201f4a
+		error("%s: stat(\"%s\"): %s", __func__,
Jan F. Chadima 201f4a
+		    progname, strerror(errno));
Jan F. Chadima 201f4a
+		goto go_away;
Jan F. Chadima 201f4a
+	}
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	if (st.st_uid != 0 || (st.st_mode & 022) != 0) {
Jan F. Chadima 201f4a
+		error("bad ownership or modes for pubkey agent \"%s\"",
Jan F. Chadima 201f4a
+		    progname);
Jan F. Chadima 201f4a
+		goto go_away;
Jan F. Chadima 201f4a
+	}
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	if (!S_ISREG(st.st_mode)) {
Jan F. Chadima 201f4a
+		error("pubkey agent \"%s\" is not a regular file",
Jan F. Chadima 201f4a
+		    progname);
Jan F. Chadima 201f4a
+		goto go_away;
Jan F. Chadima 201f4a
+	}
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	/*
Jan F. Chadima 201f4a
+	 * Descend the path, checking that each component is a
Jan F. Chadima 201f4a
+	 * root-owned directory with strict permissions.
Jan F. Chadima 201f4a
+	 */
Jan F. Chadima 201f4a
+	do {
Jan F. Chadima 201f4a
+		if ((cp = strrchr(progname, '/')) == NULL)
Jan F. Chadima 201f4a
+			break;
Jan F. Chadima 201f4a
+		else 
Jan F. Chadima 201f4a
+			*cp = '\0';
Jan F. Chadima 201f4a
+	
Jan F. Chadima 201f4a
+		debug3("%s: checking component '%s'", __func__, progname);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+		if (stat(progname, &st) != 0) {
Jan F. Chadima 201f4a
+			error("%s: stat(\"%s\"): %s", __func__,
Jan F. Chadima 201f4a
+			    progname, strerror(errno));
Jan F. Chadima 201f4a
+			goto go_away;
Jan F. Chadima 201f4a
+		}
Jan F. Chadima 201f4a
+		if (st.st_uid != 0 || (st.st_mode & 022) != 0) {
Jan F. Chadima 201f4a
+			error("bad ownership or modes for pubkey agent path component \"%s\"",
Jan F. Chadima 201f4a
+			    progname);
Jan F. Chadima 201f4a
+			goto go_away;
Jan F. Chadima 201f4a
+		}
Jan F. Chadima 201f4a
+		if (!S_ISDIR(st.st_mode)) {
Jan F. Chadima 201f4a
+			error("pubkey agent path component \"%s\" is not a directory",
Jan F. Chadima 201f4a
+			    progname);
Jan F. Chadima 201f4a
+			goto go_away;
Jan F. Chadima 201f4a
+		}
Jan F. Chadima 201f4a
+	} while (0);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	/* open the pipe and read the keys */
Jan F. Chadima 201f4a
+	f = popen (pubkey_agent_string, "r");
Jan F. Chadima 201f4a
+	if (!f) {
Jan F. Chadima 201f4a
+		error("%s: popen (\"%s\", \"r\"): %s", __func__,
Jan F. Chadima 201f4a
+		    pubkey_agent_string, strerror (errno));
Jan F. Chadima 201f4a
+		goto go_away;
Jan F. Chadima 201f4a
+	}
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	found_key = user_search_key_in_file (f, options.pubkey_agent, key, pw);
Jan F. Chadima 201f4a
+	pclose (f);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+go_away:
Jan F. Chadima 201f4a
+	if (tmp_pubkey_agent_string)
Jan F. Chadima 201f4a
+		xfree (tmp_pubkey_agent_string);
Jan F. Chadima 201f4a
+	if (pubkey_agent_string)
Jan F. Chadima 201f4a
+		xfree (pubkey_agent_string);
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	if (runas_pw->pw_uid != 0)
Jan F. Chadima 201f4a
+		restore_uid();
Jan F. Chadima 201f4a
+	return found_key;
Jan F. Chadima 201f4a
+}
Jan F. Chadima 201f4a
+#endif
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+/* check whether given key is in 
Jan F. Chadima 201f4a
 int
Jan F. Chadima 201f4a
 user_key_allowed(struct passwd *pw, Key *key)
Jan F. Chadima 201f4a
 {
Jan F. Chadima 201f4a
 	int success;
Jan F. Chadima 201f4a
 	char *file;
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
+#ifdef WITH_PUBKEY_AGENT
Jan F. Chadima 201f4a
+	success = user_key_via_agent_allowed2(pw, key);
Jan F. Chadima 201f4a
+	if (success >= 0)
Jan F. Chadima 201f4a
+		return success;
Jan F. Chadima 201f4a
+#endif
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
 	file = authorized_keys_file(pw);
Jan F. Chadima 201f4a
 	success = user_key_allowed2(pw, key, file);
Jan F. Chadima 201f4a
 	xfree(file);
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/configure.ac.pka openssh-5.3p1/configure.ac
Jan F. Chadima 201f4a
--- openssh-5.3p1/configure.ac.pka	2009-10-15 06:26:25.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/configure.ac	2009-10-15 06:26:26.000000000 +0200
Jan F. Chadima 201f4a
@@ -1319,6 +1319,18 @@ AC_ARG_WITH(audit,
Jan F. Chadima 201f4a
 	esac ]
Jan F. Chadima 201f4a
 )
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
+# Check whether user wants pubkey agent support
Jan F. Chadima 201f4a
+PKA_MSG="no"
Jan F. Chadima 201f4a
+AC_ARG_WITH(pka,
Jan F. Chadima 201f4a
+	[  --with-pka      Enable pubkey agent support],
Jan F. Chadima 201f4a
+	[
Jan F. Chadima 201f4a
+		if test "x$withval" != "xno" ; then
Jan F. Chadima 201f4a
+			AC_DEFINE([WITH_PUBKEY_AGENT], 1, [Enable pubkey agent support])
Jan F. Chadima 201f4a
+			PKA_MSG="yes"
Jan F. Chadima 201f4a
+		fi
Jan F. Chadima 201f4a
+	]
Jan F. Chadima 201f4a
+)
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
 dnl    Checks for library functions. Please keep in alphabetical order
Jan F. Chadima 201f4a
 AC_CHECK_FUNCS( \
Jan F. Chadima 201f4a
 	arc4random \
Jan F. Chadima 201f4a
@@ -4264,6 +4276,7 @@ echo "               Linux audit support
Jan F. Chadima 201f4a
 echo "                 Smartcard support: $SCARD_MSG"
Jan F. Chadima 201f4a
 echo "                     S/KEY support: $SKEY_MSG"
Jan F. Chadima 201f4a
 echo "              TCP Wrappers support: $TCPW_MSG"
Jan F. Chadima 201f4a
+echo "                       PKA support: $PKA_MSG"
Jan F. Chadima 201f4a
 echo "              MD5 password support: $MD5_MSG"
Jan F. Chadima 201f4a
 echo "                   libedit support: $LIBEDIT_MSG"
Jan F. Chadima 201f4a
 echo "  Solaris process contract support: $SPC_MSG"
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/configure.pka openssh-5.3p1/configure
Jan F. Chadima 201f4a
--- openssh-5.3p1/configure.pka	2009-10-13 19:27:51.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/configure	2009-10-15 06:26:33.000000000 +0200
Jan F. Chadima 201f4a
@@ -769,6 +769,7 @@ with_skey
Jan F. Chadima 201f4a
 with_tcp_wrappers
Jan F. Chadima 201f4a
 with_libedit
Jan F. Chadima 201f4a
 with_audit
Jan F. Chadima 201f4a
+with_pka
Jan F. Chadima 201f4a
 with_ssl_dir
Jan F. Chadima 201f4a
 with_openssl_header_check
Jan F. Chadima 201f4a
 with_ssl_engine
Jan F. Chadima 201f4a
@@ -1473,6 +1474,7 @@ Optional Packages:
Jan F. Chadima 201f4a
   --with-tcp-wrappers[=PATH] Enable tcpwrappers support (optionally in PATH)
Jan F. Chadima 201f4a
   --with-libedit[=PATH]   Enable libedit support for sftp
Jan F. Chadima 201f4a
   --with-audit=module     Enable EXPERIMENTAL audit support (modules=debug,bsm)
Jan F. Chadima 201f4a
+  --with-pka      Enable pubkey agent support
Jan F. Chadima 201f4a
   --with-ssl-dir=PATH     Specify path to OpenSSL installation
Jan F. Chadima 201f4a
   --without-openssl-header-check Disable OpenSSL version consistency check
Jan F. Chadima 201f4a
   --with-ssl-engine       Enable OpenSSL (hardware) ENGINE support
Jan F. Chadima 201f4a
@@ -13443,6 +13445,25 @@ $as_echo "$as_me: error: Unknown audit m
Jan F. Chadima 201f4a
 fi
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
+# Check whether user wants pubkey agent support
Jan F. Chadima 201f4a
+PKA_MSG="no"
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+# Check whether --with-pka was given.
Jan F. Chadima 201f4a
+if test "${with_pka+set}" = set; then
Jan F. Chadima 201f4a
+  withval=$with_pka;
Jan F. Chadima 201f4a
+		if test "x$withval" != "xno" ; then
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+cat >>confdefs.h <<\_ACEOF
Jan F. Chadima 201f4a
+#define WITH_PUBKEY_AGENT 1
Jan F. Chadima 201f4a
+_ACEOF
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+			PKA_MSG="yes"
Jan F. Chadima 201f4a
+		fi
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+fi
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
@@ -32772,6 +32793,7 @@ echo "               Linux audit support
Jan F. Chadima 201f4a
 echo "                 Smartcard support: $SCARD_MSG"
Jan F. Chadima 201f4a
 echo "                     S/KEY support: $SKEY_MSG"
Jan F. Chadima 201f4a
 echo "              TCP Wrappers support: $TCPW_MSG"
Jan F. Chadima 201f4a
+echo "                       PKA support: $PKA_MSG"
Jan F. Chadima 201f4a
 echo "              MD5 password support: $MD5_MSG"
Jan F. Chadima 201f4a
 echo "                   libedit support: $LIBEDIT_MSG"
Jan F. Chadima 201f4a
 echo "  Solaris process contract support: $SPC_MSG"
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/servconf.c.pka openssh-5.3p1/servconf.c
Jan F. Chadima 201f4a
--- openssh-5.3p1/servconf.c.pka	2009-10-15 06:26:24.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/servconf.c	2009-10-15 06:26:26.000000000 +0200
Jan F. Chadima 201f4a
@@ -128,6 +128,8 @@ initialize_server_options(ServerOptions 
Jan F. Chadima 201f4a
 	options->num_permitted_opens = -1;
Jan F. Chadima 201f4a
 	options->adm_forced_command = NULL;
Jan F. Chadima 201f4a
 	options->chroot_directory = NULL;
Jan F. Chadima 201f4a
+	options->pubkey_agent = NULL;
Jan F. Chadima 201f4a
+	options->pubkey_agent_runas = NULL;
Jan F. Chadima 201f4a
 	options->zero_knowledge_password_authentication = -1;
Jan F. Chadima 201f4a
 }
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
@@ -310,6 +312,7 @@ typedef enum {
Jan F. Chadima 201f4a
 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
Jan F. Chadima 201f4a
 	sUsePrivilegeSeparation, sAllowAgentForwarding,
Jan F. Chadima 201f4a
 	sZeroKnowledgePasswordAuthentication,
Jan F. Chadima 201f4a
+	sPubkeyAgent, sPubkeyAgentRunAs,
Jan F. Chadima 201f4a
 	sDeprecated, sUnsupported
Jan F. Chadima 201f4a
 } ServerOpCodes;
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
@@ -429,6 +432,13 @@ static struct {
Jan F. Chadima 201f4a
 	{ "permitopen", sPermitOpen, SSHCFG_ALL },
Jan F. Chadima 201f4a
 	{ "forcecommand", sForceCommand, SSHCFG_ALL },
Jan F. Chadima 201f4a
 	{ "chrootdirectory", sChrootDirectory, SSHCFG_ALL },
Jan F. Chadima 201f4a
+#ifdef WITH_PUBKEY_AGENT
Jan F. Chadima 201f4a
+	{ "pubkeyagent", sPubkeyAgent, SSHCFG_ALL },
Jan F. Chadima 201f4a
+	{ "pubkeyagentrunas", sPubkeyAgentRunAs, SSHCFG_ALL },
Jan F. Chadima 201f4a
+#else
Jan F. Chadima 201f4a
+	{ "pubkeyagent", sUnsupported, SSHCFG_ALL },
Jan F. Chadima 201f4a
+	{ "pubkeyagentrunas", sUnsupported, SSHCFG_ALL },
Jan F. Chadima 201f4a
+#endif
Jan F. Chadima 201f4a
 	{ NULL, sBadOption, 0 }
Jan F. Chadima 201f4a
 };
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
@@ -1303,6 +1313,16 @@ process_server_config_line(ServerOptions
Jan F. Chadima 201f4a
 			*charptr = xstrdup(arg);
Jan F. Chadima 201f4a
 		break;
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
+	case sPubkeyAgent:
Jan F. Chadima 201f4a
+		len = strspn(cp, WHITESPACE);
Jan F. Chadima 201f4a
+		if (*activep && options->pubkey_agent == NULL)
Jan F. Chadima 201f4a
+			options->pubkey_agent = xstrdup(cp + len);
Jan F. Chadima 201f4a
+		return 0;
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+	case sPubkeyAgentRunAs:
Jan F. Chadima 201f4a
+		charptr = &options->pubkey_agent_runas;
Jan F. Chadima 201f4a
+		break;
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
 	case sDeprecated:
Jan F. Chadima 201f4a
 		logit("%s line %d: Deprecated option %s",
Jan F. Chadima 201f4a
 		    filename, linenum, arg);
Jan F. Chadima 201f4a
@@ -1396,6 +1416,8 @@ copy_set_server_options(ServerOptions *d
Jan F. Chadima 201f4a
 	M_CP_INTOPT(gss_authentication);
Jan F. Chadima 201f4a
 	M_CP_INTOPT(rsa_authentication);
Jan F. Chadima 201f4a
 	M_CP_INTOPT(pubkey_authentication);
Jan F. Chadima 201f4a
+	M_CP_STROPT(pubkey_agent);
Jan F. Chadima 201f4a
+	M_CP_STROPT(pubkey_agent_runas);
Jan F. Chadima 201f4a
 	M_CP_INTOPT(kerberos_authentication);
Jan F. Chadima 201f4a
 	M_CP_INTOPT(hostbased_authentication);
Jan F. Chadima 201f4a
 	M_CP_INTOPT(kbd_interactive_authentication);
Jan F. Chadima 201f4a
@@ -1636,6 +1658,10 @@ dump_config(ServerOptions *o)
Jan F. Chadima 201f4a
 	dump_cfg_string(sAuthorizedKeysFile, o->authorized_keys_file);
Jan F. Chadima 201f4a
 	dump_cfg_string(sAuthorizedKeysFile2, o->authorized_keys_file2);
Jan F. Chadima 201f4a
 	dump_cfg_string(sForceCommand, o->adm_forced_command);
Jan F. Chadima 201f4a
+#ifdef WITH_PUBKEY_AGENT
Jan F. Chadima 201f4a
+	dump_cfg_string(sPubkeyAgent, o->pubkey_agent);
Jan F. Chadima 201f4a
+	dump_cfg_string(sPubkeyAgentRunAs, o->pubkey_agent_runas);
Jan F. Chadima 201f4a
+#endif
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 	/* string arguments requiring a lookup */
Jan F. Chadima 201f4a
 	dump_cfg_string(sLogLevel, log_level_name(o->log_level));
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/servconf.h.pka openssh-5.3p1/servconf.h
Jan F. Chadima 201f4a
--- openssh-5.3p1/servconf.h.pka	2009-10-15 06:26:24.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/servconf.h	2009-10-15 06:26:26.000000000 +0200
Jan F. Chadima 201f4a
@@ -152,6 +152,8 @@ typedef struct {
Jan F. Chadima 201f4a
 	int	num_permitted_opens;
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 	char   *chroot_directory;
Jan F. Chadima 201f4a
+	char   *pubkey_agent;
Jan F. Chadima 201f4a
+	char   *pubkey_agent_runas;
Jan F. Chadima 201f4a
 }       ServerOptions;
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 void	 initialize_server_options(ServerOptions *);
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/sshd_config.0.pka openssh-5.3p1/sshd_config.0
Jan F. Chadima 201f4a
--- openssh-5.3p1/sshd_config.0.pka	2009-10-15 06:26:24.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/sshd_config.0	2009-10-15 06:26:26.000000000 +0200
Jan F. Chadima 201f4a
@@ -344,10 +344,11 @@ DESCRIPTION
Jan F. Chadima 201f4a
              AllowTcpForwarding, Banner, ChrootDirectory, ForceCommand,
Jan F. Chadima 201f4a
              GatewayPorts, GSSAPIAuthentication, HostbasedAuthentication,
Jan F. Chadima 201f4a
              KbdInteractiveAuthentication, KerberosAuthentication,
Jan F. Chadima 201f4a
-             MaxAuthTries, MaxSessions, PasswordAuthentication,
Jan F. Chadima 201f4a
-             PermitEmptyPasswords, PermitOpen, PermitRootLogin,
Jan F. Chadima 201f4a
-             RhostsRSAAuthentication, RSAAuthentication, X11DisplayOffset,
Jan F. Chadima 201f4a
-             X11Forwarding and X11UseLocalHost.
Jan F. Chadima 201f4a
+             MaxAuthTries, MaxSessions, PubkeyAuthentication, PubkeyAgent,
Jan F. Chadima 201f4a
+             PubkeyAgentRunAs, PasswordAuthentication, PermitEmptyPasswords,
Jan F. Chadima 201f4a
+             PermitOpen, PermitRootLogin, RhostsRSAAuthentication,
Jan F. Chadima 201f4a
+             RSAAuthentication, X11DisplayOffset, X11Forwarding and
Jan F. Chadima 201f4a
+             X11UseLocalHost.
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
      MaxAuthTries
Jan F. Chadima 201f4a
              Specifies the maximum number of authentication attempts permitted
Jan F. Chadima 201f4a
@@ -455,6 +456,17 @@ DESCRIPTION
Jan F. Chadima 201f4a
              fault is ``yes''.  Note that this option applies to protocol ver-
Jan F. Chadima 201f4a
              sion 2 only.
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
+     PubkeyAgent
Jan F. Chadima 201f4a
+             Specifies which agent is used for lookup of the user's public
Jan F. Chadima 201f4a
+             keys. Empty string means to use the authorized_keys file.  By
Jan F. Chadima 201f4a
+             default there is no PubkeyAgent set.  Note that this option has
Jan F. Chadima 201f4a
+             an effect only with PubkeyAuthentication switched on.
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
+     PubkeyAgentRunAs
Jan F. Chadima 201f4a
+             Specifies the user under whose account the PubkeyAgent is run.
Jan F. Chadima 201f4a
+             Empty string (the default value) means the user being authorized
Jan F. Chadima 201f4a
+             is used.
Jan F. Chadima 201f4a
+
Jan F. Chadima 201f4a
      RhostsRSAAuthentication
Jan F. Chadima 201f4a
              Specifies whether rhosts or /etc/hosts.equiv authentication to-
Jan F. Chadima 201f4a
              gether with successful RSA host authentication is allowed.  The
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/sshd_config.5.pka openssh-5.3p1/sshd_config.5
Jan F. Chadima 201f4a
--- openssh-5.3p1/sshd_config.5.pka	2009-10-15 06:26:24.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/sshd_config.5	2009-10-15 06:26:26.000000000 +0200
Jan F. Chadima 201f4a
@@ -610,6 +610,9 @@ Available keywords are
Jan F. Chadima 201f4a
 .Cm KerberosAuthentication ,
Jan F. Chadima 201f4a
 .Cm MaxAuthTries ,
Jan F. Chadima 201f4a
 .Cm MaxSessions ,
Jan F. Chadima 201f4a
+.Cm PubkeyAuthentication ,
Jan F. Chadima 201f4a
+.Cm PubkeyAgent ,
Jan F. Chadima 201f4a
+.Cm PubkeyAgentRunAs ,
Jan F. Chadima 201f4a
 .Cm PasswordAuthentication ,
Jan F. Chadima 201f4a
 .Cm PermitEmptyPasswords ,
Jan F. Chadima 201f4a
 .Cm PermitOpen ,
Jan F. Chadima 201f4a
@@ -805,6 +808,16 @@ Specifies whether public key authenticat
Jan F. Chadima 201f4a
 The default is
Jan F. Chadima 201f4a
 .Dq yes .
Jan F. Chadima 201f4a
 Note that this option applies to protocol version 2 only.
Jan F. Chadima 201f4a
+.It Cm PubkeyAgent
Jan F. Chadima 201f4a
+Specifies which agent is used for lookup of the user's public
Jan F. Chadima 201f4a
+keys. Empty string means to use the authorized_keys file.
Jan F. Chadima 201f4a
+By default there is no PubkeyAgent set.
Jan F. Chadima 201f4a
+Note that this option has an effect only with PubkeyAuthentication
Jan F. Chadima 201f4a
+switched on.
Jan F. Chadima 201f4a
+.It Cm PubkeyAgentRunAs
Jan F. Chadima 201f4a
+Specifies the user under whose account the PubkeyAgent is run. Empty
Jan F. Chadima 201f4a
+string (the default value) means the user being authorized is used.
Jan F. Chadima 201f4a
+.Dq 
Jan F. Chadima 201f4a
 .It Cm RhostsRSAAuthentication
Jan F. Chadima 201f4a
 Specifies whether rhosts or /etc/hosts.equiv authentication together
Jan F. Chadima 201f4a
 with successful RSA host authentication is allowed.
Jan F. Chadima 201f4a
diff -up openssh-5.3p1/sshd_config.pka openssh-5.3p1/sshd_config
Jan F. Chadima 201f4a
--- openssh-5.3p1/sshd_config.pka	2009-10-15 06:26:24.000000000 +0200
Jan F. Chadima 201f4a
+++ openssh-5.3p1/sshd_config	2009-10-15 06:26:26.000000000 +0200
Jan F. Chadima 201f4a
@@ -47,6 +47,8 @@ SyslogFacility AUTHPRIV
Jan F. Chadima 201f4a
 #RSAAuthentication yes
Jan F. Chadima 201f4a
 #PubkeyAuthentication yes
Jan F. Chadima 201f4a
 #AuthorizedKeysFile	.ssh/authorized_keys
Jan F. Chadima 201f4a
+#PubkeyAgent none
Jan F. Chadima 201f4a
+#PubkeyAgentRunAs nobody
Jan F. Chadima 201f4a
 
Jan F. Chadima 201f4a
 # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
Jan F. Chadima 201f4a
 #RhostsRSAAuthentication no