summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-05-10 11:58:03 +1000
committerDamien Miller <djm@mindrot.org>2010-05-10 11:58:03 +1000
commit30da3447d2ef3329cb0eb083cdddf84532659454 (patch)
tree02537d2355d77cc15d1bf9d266d474e660848012 /servconf.c
parent099fc1634e1cc0f96b77a811e554bf9d796def8f (diff)
- djm@cvs.openbsd.org 2010/05/07 11:30:30
[auth-options.c auth-options.h auth.c auth.h auth2-pubkey.c] [key.c servconf.c servconf.h sshd.8 sshd_config.5] add some optional indirection to matching of principal names listed in certificates. Currently, a certificate must include the a user's name to be accepted for authentication. This change adds the ability to specify a list of certificate principal names that are acceptable. When authenticating using a CA trusted through ~/.ssh/authorized_keys, this adds a new principals="name1[,name2,...]" key option. For CAs listed through sshd_config's TrustedCAKeys option, a new config option "AuthorizedPrincipalsFile" specifies a per-user file containing the list of acceptable names. If either option is absent, the current behaviour of requiring the username to appear in principals continues to apply. These options are useful for role accounts, disjoint account namespaces and "user@realm"-style naming policies in certificates. feedback and ok markus@
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/servconf.c b/servconf.c
index 7d027ddb9..c556986e3 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.c,v 1.207 2010/03/25 23:38:28 djm Exp $ */ 1/* $OpenBSD: servconf.c,v 1.208 2010/05/07 11:30:29 djm Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -131,6 +131,7 @@ initialize_server_options(ServerOptions *options)
131 options->zero_knowledge_password_authentication = -1; 131 options->zero_knowledge_password_authentication = -1;
132 options->revoked_keys_file = NULL; 132 options->revoked_keys_file = NULL;
133 options->trusted_user_ca_keys = NULL; 133 options->trusted_user_ca_keys = NULL;
134 options->authorized_principals_file = NULL;
134} 135}
135 136
136void 137void
@@ -310,7 +311,7 @@ typedef enum {
310 sMatch, sPermitOpen, sForceCommand, sChrootDirectory, 311 sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
311 sUsePrivilegeSeparation, sAllowAgentForwarding, 312 sUsePrivilegeSeparation, sAllowAgentForwarding,
312 sZeroKnowledgePasswordAuthentication, sHostCertificate, 313 sZeroKnowledgePasswordAuthentication, sHostCertificate,
313 sRevokedKeys, sTrustedUserCAKeys, 314 sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
314 sDeprecated, sUnsupported 315 sDeprecated, sUnsupported
315} ServerOpCodes; 316} ServerOpCodes;
316 317
@@ -432,6 +433,7 @@ static struct {
432 { "hostcertificate", sHostCertificate, SSHCFG_GLOBAL }, 433 { "hostcertificate", sHostCertificate, SSHCFG_GLOBAL },
433 { "revokedkeys", sRevokedKeys, SSHCFG_ALL }, 434 { "revokedkeys", sRevokedKeys, SSHCFG_ALL },
434 { "trustedusercakeys", sTrustedUserCAKeys, SSHCFG_ALL }, 435 { "trustedusercakeys", sTrustedUserCAKeys, SSHCFG_ALL },
436 { "authorizedprincipalsfile", sAuthorizedPrincipalsFile, SSHCFG_GLOBAL },
435 { NULL, sBadOption, 0 } 437 { NULL, sBadOption, 0 }
436}; 438};
437 439
@@ -1218,10 +1220,14 @@ process_server_config_line(ServerOptions *options, char *line,
1218 * AuthorizedKeysFile /etc/ssh_keys/%u 1220 * AuthorizedKeysFile /etc/ssh_keys/%u
1219 */ 1221 */
1220 case sAuthorizedKeysFile: 1222 case sAuthorizedKeysFile:
1223 charptr = &options->authorized_keys_file;
1224 goto parse_tilde_filename;
1221 case sAuthorizedKeysFile2: 1225 case sAuthorizedKeysFile2:
1222 charptr = (opcode == sAuthorizedKeysFile) ? 1226 charptr = &options->authorized_keys_file2;
1223 &options->authorized_keys_file : 1227 goto parse_tilde_filename;
1224 &options->authorized_keys_file2; 1228 case sAuthorizedPrincipalsFile:
1229 charptr = &options->authorized_principals_file;
1230 parse_tilde_filename:
1225 arg = strdelim(&cp); 1231 arg = strdelim(&cp);
1226 if (!arg || *arg == '\0') 1232 if (!arg || *arg == '\0')
1227 fatal("%s line %d: missing file name.", 1233 fatal("%s line %d: missing file name.",
@@ -1682,6 +1688,8 @@ dump_config(ServerOptions *o)
1682 dump_cfg_string(sChrootDirectory, o->chroot_directory); 1688 dump_cfg_string(sChrootDirectory, o->chroot_directory);
1683 dump_cfg_string(sTrustedUserCAKeys, o->trusted_user_ca_keys); 1689 dump_cfg_string(sTrustedUserCAKeys, o->trusted_user_ca_keys);
1684 dump_cfg_string(sRevokedKeys, o->revoked_keys_file); 1690 dump_cfg_string(sRevokedKeys, o->revoked_keys_file);
1691 dump_cfg_string(sAuthorizedPrincipalsFile,
1692 o->authorized_principals_file);
1685 1693
1686 /* string arguments requiring a lookup */ 1694 /* string arguments requiring a lookup */
1687 dump_cfg_string(sLogLevel, log_level_name(o->log_level)); 1695 dump_cfg_string(sLogLevel, log_level_name(o->log_level));