|
Jan F |
5b4ccb |
diff -up openssh-5.8p2/auth-krb5.c.kuserok openssh-5.8p2/auth-krb5.c
|
|
Jan F |
5b4ccb |
--- openssh-5.8p2/auth-krb5.c.kuserok 2011-05-19 16:55:57.176106243 +0200
|
|
Jan F |
5b4ccb |
+++ openssh-5.8p2/auth-krb5.c 2011-05-19 16:56:02.009109884 +0200
|
|
Jan F |
82036a |
@@ -54,6 +54,20 @@
|
|
Jan F |
82036a |
|
|
Jan F |
82036a |
extern ServerOptions options;
|
|
Jan F |
82036a |
|
|
Jan F |
82036a |
+int
|
|
Jan F |
82036a |
+ssh_krb5_kuserok(krb5_context krb5_ctx, krb5_principal krb5_user, const char *client)
|
|
Jan F |
82036a |
+{
|
|
Jan F |
82036a |
+ if (options.use_kuserok)
|
|
Jan F |
82036a |
+ return krb5_kuserok(krb5_ctx, krb5_user, client);
|
|
Jan F |
82036a |
+ else {
|
|
Jan F |
82036a |
+ char kuser[65];
|
|
Jan F |
82036a |
+
|
|
Jan F |
82036a |
+ if (krb5_aname_to_localname(krb5_ctx, krb5_user, sizeof(kuser), kuser))
|
|
Jan F |
82036a |
+ return 0;
|
|
Jan F |
82036a |
+ return strcmp(kuser, client) == 0;
|
|
Jan F |
82036a |
+ }
|
|
Jan F |
82036a |
+}
|
|
Jan F |
82036a |
+
|
|
Jan F |
82036a |
static int
|
|
Jan F |
82036a |
krb5_init(void *context)
|
|
Jan F |
82036a |
{
|
|
Jan F |
82036a |
@@ -146,7 +160,7 @@ auth_krb5_password(Authctxt *authctxt, c
|
|
Jan F. Chadima |
59d42d |
if (problem)
|
|
Jan F. Chadima |
59d42d |
goto out;
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
- if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
|
Jan F |
82036a |
+ if (!ssh_krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
|
Jan F |
82036a |
problem = -1;
|
|
Jan F |
82036a |
goto out;
|
|
Jan F. Chadima |
59d42d |
}
|
|
Jan F |
5b4ccb |
diff -up openssh-5.8p2/gss-serv-krb5.c.kuserok openssh-5.8p2/gss-serv-krb5.c
|
|
Jan F |
5b4ccb |
--- openssh-5.8p2/gss-serv-krb5.c.kuserok 2011-05-19 16:56:01.000000000 +0200
|
|
Jan F |
5b4ccb |
+++ openssh-5.8p2/gss-serv-krb5.c 2011-05-20 05:48:50.681167894 +0200
|
|
Jan F |
5b4ccb |
@@ -68,6 +68,7 @@ static int ssh_gssapi_krb5_cmdok(krb5_pr
|
|
Jan F |
5b4ccb |
int);
|
|
Jan F |
82036a |
|
|
Jan F |
82036a |
static krb5_context krb_context = NULL;
|
|
Jan F |
82036a |
+extern int ssh_krb5_kuserok(krb5_context, krb5_principal, const char *);
|
|
Jan F |
82036a |
|
|
Jan F |
82036a |
/* Initialise the krb5 library, for the stuff that GSSAPI won't do */
|
|
Jan F |
82036a |
|
|
Jan F |
5b4ccb |
@@ -115,7 +116,7 @@ ssh_gssapi_krb5_userok(ssh_gssapi_client
|
|
Jan F |
5b4ccb |
/* NOTE: .k5login and .k5users must opened as root, not the user,
|
|
Jan F |
5b4ccb |
* because if they are on a krb5-protected filesystem, user credentials
|
|
Jan F |
5b4ccb |
* to access these files aren't available yet. */
|
|
Jan F |
5b4ccb |
- if (krb5_kuserok(krb_context, princ, luser) && k5login_exists) {
|
|
Jan F |
5b4ccb |
+ if (ssh_krb5_kuserok(krb_context, princ, luser) && k5login_exists) {
|
|
Jan F |
82036a |
retval = 1;
|
|
Jan F |
82036a |
logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
|
|
Jan F |
5b4ccb |
luser, (char *)client->displayname.value);
|
|
Jan F |
5b4ccb |
diff -up openssh-5.8p2/servconf.c.kuserok openssh-5.8p2/servconf.c
|
|
Jan F |
5b4ccb |
--- openssh-5.8p2/servconf.c.kuserok 2011-05-19 16:55:59.549112264 +0200
|
|
Jan F |
5b4ccb |
+++ openssh-5.8p2/servconf.c 2011-05-19 16:56:02.332106613 +0200
|
|
Jan F |
5b4ccb |
@@ -145,6 +145,7 @@ initialize_server_options(ServerOptions
|
|
Jan F. Chadima |
1b8a26 |
options->authorized_principals_file = NULL;
|
|
Jan F |
003cb0 |
options->ip_qos_interactive = -1;
|
|
Jan F |
003cb0 |
options->ip_qos_bulk = -1;
|
|
Jan F. Chadima |
59d42d |
+ options->use_kuserok = -1;
|
|
Jan F. Chadima |
59d42d |
}
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
void
|
|
Jan F |
5b4ccb |
@@ -300,6 +301,8 @@ fill_default_server_options(ServerOption
|
|
Jan F. Chadima |
59d42d |
if (use_privsep == -1)
|
|
Jan F. Chadima |
59d42d |
use_privsep = 1;
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
+ if (options->use_kuserok == -1)
|
|
Jan F. Chadima |
59d42d |
+ options->use_kuserok = 1;
|
|
Jan F. Chadima |
59d42d |
#ifndef HAVE_MMAP
|
|
Jan F. Chadima |
59d42d |
if (use_privsep && options->compression == 1) {
|
|
Jan F. Chadima |
59d42d |
error("This platform does not support both privilege "
|
|
Jan F |
5b4ccb |
@@ -321,7 +324,7 @@ typedef enum {
|
|
Jan F. Chadima |
59d42d |
sPermitRootLogin, sLogFacility, sLogLevel,
|
|
Jan F. Chadima |
59d42d |
sRhostsRSAAuthentication, sRSAAuthentication,
|
|
Jan F. Chadima |
59d42d |
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
|
|
Jan F. Chadima |
59d42d |
- sKerberosGetAFSToken,
|
|
Jan F. Chadima |
59d42d |
+ sKerberosGetAFSToken, sKerberosUseKuserok,
|
|
Jan F. Chadima |
59d42d |
sKerberosTgtPassing, sChallengeResponseAuthentication,
|
|
Jan F. Chadima |
59d42d |
sPasswordAuthentication, sKbdInteractiveAuthentication,
|
|
Jan F. Chadima |
59d42d |
sListenAddress, sAddressFamily,
|
|
Jan F |
5b4ccb |
@@ -392,11 +395,13 @@ static struct {
|
|
Jan F. Chadima |
59d42d |
#else
|
|
Jan F. Chadima |
59d42d |
{ "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
59d42d |
#endif
|
|
Jan F. Chadima |
59d42d |
+ { "kerberosusekuserok", sKerberosUseKuserok, SSHCFG_ALL },
|
|
Jan F. Chadima |
59d42d |
#else
|
|
Jan F. Chadima |
59d42d |
{ "kerberosauthentication", sUnsupported, SSHCFG_ALL },
|
|
Jan F. Chadima |
59d42d |
{ "kerberosorlocalpasswd", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
59d42d |
{ "kerberosticketcleanup", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
59d42d |
{ "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
59d42d |
+ { "kerberosusekuserok", sUnsupported, SSHCFG_ALL },
|
|
Jan F. Chadima |
59d42d |
#endif
|
|
Jan F. Chadima |
59d42d |
{ "kerberostgtpassing", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F. Chadima |
59d42d |
{ "afstokenpassing", sUnsupported, SSHCFG_GLOBAL },
|
|
Jan F |
5b4ccb |
@@ -1374,6 +1379,10 @@ process_server_config_line(ServerOptions
|
|
Jan F. Chadima |
59d42d |
*activep = value;
|
|
Jan F. Chadima |
59d42d |
break;
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
+ case sKerberosUseKuserok:
|
|
Jan F. Chadima |
59d42d |
+ intptr = &options->use_kuserok;
|
|
Jan F. Chadima |
59d42d |
+ goto parse_flag;
|
|
Jan F. Chadima |
59d42d |
+
|
|
Jan F. Chadima |
59d42d |
case sPermitOpen:
|
|
Jan F. Chadima |
59d42d |
arg = strdelim(&cp;;
|
|
Jan F. Chadima |
59d42d |
if (!arg || *arg == '\0')
|
|
Jan F |
5b4ccb |
@@ -1577,6 +1586,7 @@ copy_set_server_options(ServerOptions *d
|
|
Jan F. Chadima |
59d42d |
M_CP_INTOPT(max_authtries);
|
|
Jan F |
003cb0 |
M_CP_INTOPT(ip_qos_interactive);
|
|
Jan F |
003cb0 |
M_CP_INTOPT(ip_qos_bulk);
|
|
Jan F. Chadima |
59d42d |
+ M_CP_INTOPT(use_kuserok);
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
M_CP_STROPT(banner);
|
|
Jan F. Chadima |
59d42d |
if (preauth)
|
|
Jan F |
5b4ccb |
@@ -1800,6 +1810,7 @@ dump_config(ServerOptions *o)
|
|
Jan F. Chadima |
59d42d |
dump_cfg_fmtint(sUseDNS, o->use_dns);
|
|
Jan F. Chadima |
59d42d |
dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
|
|
Jan F. Chadima |
59d42d |
dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
|
|
Jan F. Chadima |
59d42d |
+ dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
/* string arguments */
|
|
Jan F. Chadima |
59d42d |
dump_cfg_string(sPidFile, o->pid_file);
|
|
Jan F |
5b4ccb |
diff -up openssh-5.8p2/servconf.h.kuserok openssh-5.8p2/servconf.h
|
|
Jan F |
5b4ccb |
--- openssh-5.8p2/servconf.h.kuserok 2011-05-19 16:55:59.676167388 +0200
|
|
Jan F |
5b4ccb |
+++ openssh-5.8p2/servconf.h 2011-05-19 16:56:02.449168732 +0200
|
|
Jan F |
5b4ccb |
@@ -160,6 +160,7 @@ typedef struct {
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
int num_permitted_opens;
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
+ int use_kuserok;
|
|
Jan F. Chadima |
59d42d |
char *chroot_directory;
|
|
Jan F. Chadima |
59d42d |
char *revoked_keys_file;
|
|
Jan F. Chadima |
59d42d |
char *trusted_user_ca_keys;
|
|
Jan F |
5b4ccb |
diff -up openssh-5.8p2/sshd_config.5.kuserok openssh-5.8p2/sshd_config.5
|
|
Jan F |
5b4ccb |
--- openssh-5.8p2/sshd_config.5.kuserok 2011-05-19 16:56:00.265169181 +0200
|
|
Jan F |
5b4ccb |
+++ openssh-5.8p2/sshd_config.5 2011-05-19 16:56:02.588114955 +0200
|
|
Jan F |
5b4ccb |
@@ -602,6 +602,10 @@ Specifies whether to automatically destr
|
|
Jan F. Chadima |
59d42d |
file on logout.
|
|
Jan F. Chadima |
59d42d |
The default is
|
|
Jan F. Chadima |
59d42d |
.Dq yes .
|
|
Jan F. Chadima |
59d42d |
+.It Cm KerberosUseKuserok
|
|
Jan F. Chadima |
59d42d |
+Specifies whether to look at .k5login file for user's aliases.
|
|
Jan F. Chadima |
59d42d |
+The default is
|
|
Jan F. Chadima |
59d42d |
+.Dq yes .
|
|
Jan F |
003cb0 |
.It Cm KexAlgorithms
|
|
Jan F |
003cb0 |
Specifies the available KEX (Key Exchange) algorithms.
|
|
Jan F |
003cb0 |
Multiple algorithms must be comma-separated.
|
|
Jan F |
5b4ccb |
@@ -743,6 +747,7 @@ Available keywords are
|
|
Jan F. Chadima |
1b8a26 |
.Cm HostbasedUsesNameFromPacketOnly ,
|
|
Jan F. Chadima |
59d42d |
.Cm KbdInteractiveAuthentication ,
|
|
Jan F. Chadima |
59d42d |
.Cm KerberosAuthentication ,
|
|
Jan F. Chadima |
59d42d |
+.Cm KerberosUseKuserok ,
|
|
Jan F. Chadima |
59d42d |
.Cm MaxAuthTries ,
|
|
Jan F. Chadima |
59d42d |
.Cm MaxSessions ,
|
|
Jan F. Chadima |
7818e5 |
.Cm PubkeyAuthentication ,
|
|
Jan F |
5b4ccb |
diff -up openssh-5.8p2/sshd_config.kuserok openssh-5.8p2/sshd_config
|
|
Jan F |
5b4ccb |
--- openssh-5.8p2/sshd_config.kuserok 2011-05-19 16:56:00.886106293 +0200
|
|
Jan F |
5b4ccb |
+++ openssh-5.8p2/sshd_config 2011-05-19 16:56:02.716105342 +0200
|
|
Jan F |
003cb0 |
@@ -73,6 +73,7 @@ ChallengeResponseAuthentication no
|
|
Jan F. Chadima |
59d42d |
#KerberosOrLocalPasswd yes
|
|
Jan F. Chadima |
59d42d |
#KerberosTicketCleanup yes
|
|
Jan F. Chadima |
59d42d |
#KerberosGetAFSToken no
|
|
Jan F. Chadima |
59d42d |
+#KerberosUseKuserok yes
|
|
Jan F. Chadima |
59d42d |
|
|
Jan F. Chadima |
59d42d |
# GSSAPI options
|
|
Jan F. Chadima |
59d42d |
#GSSAPIAuthentication no
|