|
Petr Lautrbach |
84822b |
diff -up openssh-6.3p1/auth-krb5.c.kuserok openssh-6.3p1/auth-krb5.c
|
|
Petr Lautrbach |
84822b |
--- openssh-6.3p1/auth-krb5.c.kuserok 2013-10-11 21:41:42.889087613 +0200
|
|
Petr Lautrbach |
84822b |
+++ openssh-6.3p1/auth-krb5.c 2013-10-11 21:41:42.905087537 +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 |
84822b |
@@ -159,7 +173,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 |
84822b |
diff -up openssh-6.3p1/gss-serv-krb5.c.kuserok openssh-6.3p1/gss-serv-krb5.c
|
|
Petr Lautrbach |
84822b |
--- openssh-6.3p1/gss-serv-krb5.c.kuserok 2013-10-11 21:41:42.901087556 +0200
|
|
Petr Lautrbach |
84822b |
+++ openssh-6.3p1/gss-serv-krb5.c 2013-10-11 21:46:42.898673597 +0200
|
|
Petr Lautrbach |
84822b |
@@ -67,6 +67,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 |
|
|
Petr Lautrbach |
84822b |
@@ -116,7 +117,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. */
|
|
Petr Lautrbach |
84822b |
- if (krb5_kuserok(krb_context, princ, name) && k5login_exists) {
|
|
Petr Lautrbach |
84822b |
+ if (ssh_krb5_kuserok(krb_context, princ, name) && k5login_exists) {
|
|
Jan F. Chadima |
69dd72 |
retval = 1;
|
|
Jan F. Chadima |
69dd72 |
logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
|
|
Petr Lautrbach |
84822b |
name, (char *)client->displayname.value);
|
|
Petr Lautrbach |
84822b |
diff -up openssh-6.3p1/servconf.c.kuserok openssh-6.3p1/servconf.c
|
|
Petr Lautrbach |
84822b |
--- openssh-6.3p1/servconf.c.kuserok 2013-10-11 21:41:42.896087580 +0200
|
|
Petr Lautrbach |
84822b |
+++ openssh-6.3p1/servconf.c 2013-10-11 21:48:24.664194016 +0200
|
|
Petr Lautrbach |
84822b |
@@ -157,6 +157,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 |
84822b |
@@ -310,6 +311,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 |
84822b |
@@ -336,7 +339,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 |
84822b |
@@ -409,11 +412,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 |
84822b |
@@ -1515,6 +1520,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 |
84822b |
@@ -1815,6 +1824,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);
|
|
Petr Lautrbach |
84822b |
M_CP_INTOPT(rekey_limit);
|
|
Petr Lautrbach |
84822b |
M_CP_INTOPT(rekey_interval);
|
|
Jan F. Chadima |
69dd72 |
|
|
Petr Lautrbach |
84822b |
@@ -2055,6 +2065,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 |
84822b |
diff -up openssh-6.3p1/servconf.h.kuserok openssh-6.3p1/servconf.h
|
|
Petr Lautrbach |
84822b |
--- openssh-6.3p1/servconf.h.kuserok 2013-10-11 21:41:42.896087580 +0200
|
|
Petr Lautrbach |
84822b |
+++ openssh-6.3p1/servconf.h 2013-10-11 21:41:42.907087528 +0200
|
|
Petr Lautrbach |
84822b |
@@ -174,6 +174,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 |
84822b |
diff -up openssh-6.3p1/sshd_config.5.kuserok openssh-6.3p1/sshd_config.5
|
|
Petr Lautrbach |
84822b |
--- openssh-6.3p1/sshd_config.5.kuserok 2013-10-11 21:41:42.898087571 +0200
|
|
Petr Lautrbach |
84822b |
+++ openssh-6.3p1/sshd_config.5 2013-10-11 21:41:42.907087528 +0200
|
|
Petr Lautrbach |
84822b |
@@ -675,6 +675,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 |
84822b |
@@ -833,6 +837,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 ,
|
|
Petr Lautrbach |
8a29de |
.Cm PasswordAuthentication ,
|
|
Petr Lautrbach |
84822b |
diff -up openssh-6.3p1/sshd_config.kuserok openssh-6.3p1/sshd_config
|
|
Petr Lautrbach |
84822b |
--- openssh-6.3p1/sshd_config.kuserok 2013-10-11 21:41:42.898087571 +0200
|
|
Petr Lautrbach |
84822b |
+++ openssh-6.3p1/sshd_config 2013-10-11 21:41:42.907087528 +0200
|
|
Petr Lautrbach |
84822b |
@@ -86,6 +86,7 @@ ChallengeResponseAuthentication no
|
|
Petr Lautrbach |
84822b |
#KerberosOrLocalPasswd yes
|
|
Petr Lautrbach |
84822b |
#KerberosTicketCleanup yes
|
|
Petr Lautrbach |
84822b |
#KerberosGetAFSToken no
|
|
Petr Lautrbach |
84822b |
+#KerberosUseKuserok yes
|
|
Petr Lautrbach |
84822b |
|
|
Petr Lautrbach |
84822b |
# GSSAPI options
|
|
Petr Lautrbach |
84822b |
#GSSAPIAuthentication no
|