|
Petr Lautrbach |
9fe1af |
diff -up openssh-6.1p1/auth-krb5.c.kuserok openssh-6.1p1/auth-krb5.c
|
|
Petr Lautrbach |
9fe1af |
--- openssh-6.1p1/auth-krb5.c.kuserok 2012-09-14 21:08:16.941496194 +0200
|
|
Petr Lautrbach |
9fe1af |
+++ openssh-6.1p1/auth-krb5.c 2012-09-14 21:08:17.063496896 +0200
|
|
Petr Lautrbach |
9fe1af |
@@ -55,6 +55,20 @@
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
extern ServerOptions options;
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
+int
|
|
Jan F. Chadima |
69dd72 |
+ssh_krb5_kuserok(krb5_context krb5_ctx, krb5_principal krb5_user, const char *client)
|
|
Jan F. Chadima |
69dd72 |
+{
|
|
Jan F. Chadima |
69dd72 |
+ if (options.use_kuserok)
|
|
Jan F. Chadima |
69dd72 |
+ return krb5_kuserok(krb5_ctx, krb5_user, client);
|
|
Jan F. Chadima |
69dd72 |
+ else {
|
|
Jan F. Chadima |
69dd72 |
+ char kuser[65];
|
|
Jan F. Chadima |
69dd72 |
+
|
|
Jan F. Chadima |
69dd72 |
+ if (krb5_aname_to_localname(krb5_ctx, krb5_user, sizeof(kuser), kuser))
|
|
Jan F. Chadima |
69dd72 |
+ return 0;
|
|
Jan F. Chadima |
69dd72 |
+ return strcmp(kuser, client) == 0;
|
|
Jan F. Chadima |
69dd72 |
+ }
|
|
Jan F. Chadima |
69dd72 |
+}
|
|
Jan F. Chadima |
69dd72 |
+
|
|
Jan F. Chadima |
69dd72 |
static int
|
|
Jan F. Chadima |
69dd72 |
krb5_init(void *context)
|
|
Jan F. Chadima |
69dd72 |
{
|
|
Petr Lautrbach |
9fe1af |
@@ -147,7 +161,7 @@ auth_krb5_password(Authctxt *authctxt, c
|
|
Jan F. Chadima |
69dd72 |
if (problem)
|
|
Jan F. Chadima |
69dd72 |
goto out;
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
- if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
|
Jan F. Chadima |
69dd72 |
+ if (!ssh_krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
|
Jan F. Chadima |
69dd72 |
problem = -1;
|
|
Jan F. Chadima |
69dd72 |
goto out;
|
|
Jan F. Chadima |
69dd72 |
}
|
|
Petr Lautrbach |
9fe1af |
diff -up openssh-6.1p1/gss-serv-krb5.c.kuserok openssh-6.1p1/gss-serv-krb5.c
|
|
Petr Lautrbach |
9fe1af |
--- openssh-6.1p1/gss-serv-krb5.c.kuserok 2012-09-14 21:08:17.019496642 +0200
|
|
Petr Lautrbach |
9fe1af |
+++ openssh-6.1p1/gss-serv-krb5.c 2012-09-14 21:08:17.065496906 +0200
|
|
Jan F. Chadima |
69dd72 |
@@ -68,6 +68,7 @@ static int ssh_gssapi_krb5_cmdok(krb5_pr
|
|
Jan F. Chadima |
69dd72 |
int);
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
static krb5_context krb_context = NULL;
|
|
Jan F. Chadima |
69dd72 |
+extern int ssh_krb5_kuserok(krb5_context, krb5_principal, const char *);
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
/* Initialise the krb5 library, for the stuff that GSSAPI won't do */
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
@@ -115,7 +116,7 @@ ssh_gssapi_krb5_userok(ssh_gssapi_client
|
|
Jan F. Chadima |
69dd72 |
/* NOTE: .k5login and .k5users must opened as root, not the user,
|
|
Jan F. Chadima |
69dd72 |
* because if they are on a krb5-protected filesystem, user credentials
|
|
Jan F. Chadima |
69dd72 |
* to access these files aren't available yet. */
|
|
Jan F. Chadima |
69dd72 |
- if (krb5_kuserok(krb_context, princ, luser) && k5login_exists) {
|
|
Jan F. Chadima |
69dd72 |
+ if (ssh_krb5_kuserok(krb_context, princ, luser) && k5login_exists) {
|
|
Jan F. Chadima |
69dd72 |
retval = 1;
|
|
Jan F. Chadima |
69dd72 |
logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
|
|
Jan F. Chadima |
69dd72 |
luser, (char *)client->displayname.value);
|
|
Petr Lautrbach |
9fe1af |
diff -up openssh-6.1p1/servconf.c.kuserok openssh-6.1p1/servconf.c
|
|
Petr Lautrbach |
9fe1af |
--- openssh-6.1p1/servconf.c.kuserok 2012-09-14 21:08:16.989496471 +0200
|
|
Petr Lautrbach |
9fe1af |
+++ openssh-6.1p1/servconf.c 2012-09-14 21:09:30.864868698 +0200
|
|
Petr Lautrbach |
9fe1af |
@@ -152,6 +152,7 @@ initialize_server_options(ServerOptions
|
|
Jan F. Chadima |
69dd72 |
options->ip_qos_interactive = -1;
|
|
Jan F. Chadima |
69dd72 |
options->ip_qos_bulk = -1;
|
|
Petr Lautrbach |
9fe1af |
options->version_addendum = NULL;
|
|
Jan F. Chadima |
69dd72 |
+ options->use_kuserok = -1;
|
|
Jan F. Chadima |
69dd72 |
}
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
void
|
|
Petr Lautrbach |
9fe1af |
@@ -301,6 +302,8 @@ fill_default_server_options(ServerOption
|
|
Petr Lautrbach |
9fe1af |
options->version_addendum = xstrdup("");
|
|
Jan F. Chadima |
69dd72 |
if (options->show_patchlevel == -1)
|
|
Petr Lautrbach |
9fe1af |
options->show_patchlevel = 0;
|
|
Jan F. Chadima |
69dd72 |
+ if (options->use_kuserok == -1)
|
|
Jan F. Chadima |
69dd72 |
+ options->use_kuserok = 1;
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
/* Turn privilege separation on by default */
|
|
Jan F. Chadima |
69dd72 |
if (use_privsep == -1)
|
|
Petr Lautrbach |
9fe1af |
@@ -327,7 +330,7 @@ typedef enum {
|
|
Jan F. Chadima |
69dd72 |
sPermitRootLogin, sLogFacility, sLogLevel,
|
|
Jan F. Chadima |
69dd72 |
sRhostsRSAAuthentication, sRSAAuthentication,
|
|
Jan F. Chadima |
69dd72 |
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
|
|
Jan F. Chadima |
69dd72 |
- sKerberosGetAFSToken,
|
|
Jan F. Chadima |
69dd72 |
+ sKerberosGetAFSToken, sKerberosUseKuserok,
|
|
Jan F. Chadima |
69dd72 |
sKerberosTgtPassing, sChallengeResponseAuthentication,
|
|
Jan F. Chadima |
69dd72 |
sPasswordAuthentication, sKbdInteractiveAuthentication,
|
|
Jan F. Chadima |
69dd72 |
sListenAddress, sAddressFamily,
|
|
Petr Lautrbach |
9fe1af |
@@ -399,11 +402,13 @@ static struct {
|
|
Jan F. Chadima |
69dd72 |
#else
|
|
Jan F. Chadima |
69dd72 |
{ "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
69dd72 |
#endif
|
|
Jan F. Chadima |
69dd72 |
+ { "kerberosusekuserok", sKerberosUseKuserok, SSHCFG_ALL },
|
|
Jan F. Chadima |
69dd72 |
#else
|
|
Jan F. Chadima |
69dd72 |
{ "kerberosauthentication", sUnsupported, SSHCFG_ALL },
|
|
Jan F. Chadima |
69dd72 |
{ "kerberosorlocalpasswd", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
69dd72 |
{ "kerberosticketcleanup", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
69dd72 |
{ "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
69dd72 |
+ { "kerberosusekuserok", sUnsupported, SSHCFG_ALL },
|
|
Jan F. Chadima |
69dd72 |
#endif
|
|
Jan F. Chadima |
69dd72 |
{ "kerberostgtpassing", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
69dd72 |
{ "afstokenpassing", sUnsupported, SSHCFG_GLOBAL },
|
|
Petr Lautrbach |
9fe1af |
@@ -1486,6 +1491,10 @@ process_server_config_line(ServerOptions
|
|
Jan F. Chadima |
69dd72 |
*activep = value;
|
|
Jan F. Chadima |
69dd72 |
break;
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
+ case sKerberosUseKuserok:
|
|
Jan F. Chadima |
69dd72 |
+ intptr = &options->use_kuserok;
|
|
Jan F. Chadima |
69dd72 |
+ goto parse_flag;
|
|
Jan F. Chadima |
69dd72 |
+
|
|
Jan F. Chadima |
69dd72 |
case sPermitOpen:
|
|
Jan F. Chadima |
69dd72 |
arg = strdelim(&cp;;
|
|
Jan F. Chadima |
69dd72 |
if (!arg || *arg == '\0')
|
|
Petr Lautrbach |
9fe1af |
@@ -1769,6 +1778,7 @@ copy_set_server_options(ServerOptions *d
|
|
Jan F. Chadima |
69dd72 |
M_CP_INTOPT(max_authtries);
|
|
Jan F. Chadima |
69dd72 |
M_CP_INTOPT(ip_qos_interactive);
|
|
Jan F. Chadima |
69dd72 |
M_CP_INTOPT(ip_qos_bulk);
|
|
Jan F. Chadima |
69dd72 |
+ M_CP_INTOPT(use_kuserok);
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
/* See comment in servconf.h */
|
|
Jan F. Chadima |
69dd72 |
COPY_MATCH_STRING_OPTS();
|
|
Petr Lautrbach |
9fe1af |
@@ -2005,6 +2015,7 @@ dump_config(ServerOptions *o)
|
|
Jan F. Chadima |
69dd72 |
dump_cfg_fmtint(sUseDNS, o->use_dns);
|
|
Jan F. Chadima |
69dd72 |
dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
|
|
Jan F. Chadima |
69dd72 |
dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
|
|
Jan F. Chadima |
69dd72 |
+ dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
/* string arguments */
|
|
Jan F. Chadima |
69dd72 |
dump_cfg_string(sPidFile, o->pid_file);
|
|
Petr Lautrbach |
9fe1af |
diff -up openssh-6.1p1/servconf.h.kuserok openssh-6.1p1/servconf.h
|
|
Petr Lautrbach |
9fe1af |
--- openssh-6.1p1/servconf.h.kuserok 2012-09-14 21:08:16.990496476 +0200
|
|
Petr Lautrbach |
9fe1af |
+++ openssh-6.1p1/servconf.h 2012-09-14 21:08:17.071496942 +0200
|
|
Petr Lautrbach |
9fe1af |
@@ -169,6 +169,7 @@ typedef struct {
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
int num_permitted_opens;
|
|
Jan F. Chadima |
69dd72 |
|
|
Jan F. Chadima |
69dd72 |
+ int use_kuserok;
|
|
Jan F. Chadima |
69dd72 |
char *chroot_directory;
|
|
Jan F. Chadima |
69dd72 |
char *revoked_keys_file;
|
|
Jan F. Chadima |
69dd72 |
char *trusted_user_ca_keys;
|
|
Petr Lautrbach |
9fe1af |
diff -up openssh-6.1p1/sshd_config.kuserok openssh-6.1p1/sshd_config
|
|
Petr Lautrbach |
9fe1af |
--- openssh-6.1p1/sshd_config.kuserok 2012-09-14 21:08:17.002496545 +0200
|
|
Petr Lautrbach |
9fe1af |
+++ openssh-6.1p1/sshd_config 2012-09-14 21:08:17.074496957 +0200
|
|
Petr Lautrbach |
9fe1af |
@@ -79,6 +79,7 @@ ChallengeResponseAuthentication no
|
|
Petr Lautrbach |
9fe1af |
#KerberosOrLocalPasswd yes
|
|
Petr Lautrbach |
9fe1af |
#KerberosTicketCleanup yes
|
|
Petr Lautrbach |
9fe1af |
#KerberosGetAFSToken no
|
|
Petr Lautrbach |
9fe1af |
+#KerberosUseKuserok yes
|
|
Petr Lautrbach |
9fe1af |
|
|
Petr Lautrbach |
9fe1af |
# GSSAPI options
|
|
Petr Lautrbach |
9fe1af |
#GSSAPIAuthentication no
|
|
Petr Lautrbach |
9fe1af |
diff -up openssh-6.1p1/sshd_config.5.kuserok openssh-6.1p1/sshd_config.5
|
|
Petr Lautrbach |
9fe1af |
--- openssh-6.1p1/sshd_config.5.kuserok 2012-09-14 21:08:17.004496556 +0200
|
|
Petr Lautrbach |
9fe1af |
+++ openssh-6.1p1/sshd_config.5 2012-09-14 21:08:17.073496952 +0200
|
|
Petr Lautrbach |
9fe1af |
@@ -618,6 +618,10 @@ Specifies whether to automatically destr
|
|
Jan F. Chadima |
69dd72 |
file on logout.
|
|
Jan F. Chadima |
69dd72 |
The default is
|
|
Jan F. Chadima |
69dd72 |
.Dq yes .
|
|
Jan F. Chadima |
69dd72 |
+.It Cm KerberosUseKuserok
|
|
Jan F. Chadima |
69dd72 |
+Specifies whether to look at .k5login file for user's aliases.
|
|
Jan F. Chadima |
69dd72 |
+The default is
|
|
Jan F. Chadima |
69dd72 |
+.Dq yes .
|
|
Jan F. Chadima |
69dd72 |
.It Cm KexAlgorithms
|
|
Jan F. Chadima |
69dd72 |
Specifies the available KEX (Key Exchange) algorithms.
|
|
Jan F. Chadima |
69dd72 |
Multiple algorithms must be comma-separated.
|
|
Petr Lautrbach |
9fe1af |
@@ -767,6 +771,7 @@ Available keywords are
|
|
Jan F. Chadima |
69dd72 |
.Cm HostbasedUsesNameFromPacketOnly ,
|
|
Jan F. Chadima |
69dd72 |
.Cm KbdInteractiveAuthentication ,
|
|
Jan F. Chadima |
69dd72 |
.Cm KerberosAuthentication ,
|
|
Jan F. Chadima |
69dd72 |
+.Cm KerberosUseKuserok ,
|
|
Jan F. Chadima |
69dd72 |
.Cm MaxAuthTries ,
|
|
Jan F. Chadima |
69dd72 |
.Cm MaxSessions ,
|
|
Jan F. Chadima |
69dd72 |
.Cm PubkeyAuthentication ,
|