summaryrefslogtreecommitdiffstats
path: root/src/clients
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>2010-09-27 17:16:41 +0000
committerSam Hartman <hartmans@mit.edu>2010-09-27 17:16:41 +0000
commitada3888720a105825b91c4f6aee68ce66489264d (patch)
treebf6fa81e93daf29fa021df02da0fa9dc48ec2d9e /src/clients
parent312b5a3b38c6df9b55fc1c3ac58abe8f9f590cea (diff)
downloadkrb5-ada3888720a105825b91c4f6aee68ce66489264d.tar.gz
krb5-ada3888720a105825b91c4f6aee68ce66489264d.tar.xz
krb5-ada3888720a105825b91c4f6aee68ce66489264d.zip
kpasswd: if a credential cache is present, use FAST
If a credentials cache is available, use it as an armor cache to enable FAST negotiation for kpasswd. This requires an attacker to attack both the user's long-term key for the old password as well as the ticket used for the armor cache in order to attack the password change. Depending on how the armor ticket is obtained, this may provide limited value. However, it provides users an easy option if they are concerned about their current password. Users can kinit with one principal to help protect changing the password of another principal. * krb5_get_init_creds_opt_set_fast_ccache: new API to set fast ccache based on a krb5_ccache object rather than a resolvable string * kpasswd: always open the current credential cache even if not needed for determining the principal. If the cache has tickets, use it as an armor cache. * tests/dejagnu/krb-standalone/kadmin.exp: Arrange to test new code path ticket: 6786 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24359 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/kpasswd/kpasswd.c59
1 files changed, 33 insertions, 26 deletions
diff --git a/src/clients/kpasswd/kpasswd.c b/src/clients/kpasswd/kpasswd.c
index c79f2c85d6..fc91bddef3 100644
--- a/src/clients/kpasswd/kpasswd.c
+++ b/src/clients/kpasswd/kpasswd.c
@@ -70,6 +70,10 @@ int main(int argc, char *argv[])
com_err(argv[0], ret, "initializing kerberos library");
exit(1);
}
+ if ((ret = krb5_get_init_creds_opt_alloc(context, &opts))) {
+ com_err(argv[0], ret, "allocating krb5_get_init_creds_opt");
+ exit(1);
+ }
/* in order, use the first of:
- a name specified on the command line
@@ -77,40 +81,43 @@ int main(int argc, char *argv[])
- the name corresponding to the ruid of the process
otherwise, it's an error.
+ We always attempt to open the default ccache in order to use FAST if
+ possible.
*/
-
- if (pname) {
- if ((ret = krb5_parse_name(context, pname, &princ))) {
- com_err(argv[0], ret, "parsing client name");
- exit(1);
- }
+ ret = krb5_cc_default(context, &ccache);
+ if (ret != 0) {
+ com_err(argv[0], ret, "opening default ccache");
+ exit(1);
+ }
+ ret = krb5_cc_get_principal(context, ccache, &princ);
+ if (ret != 0 && ret != KRB5_CC_NOTFOUND && ret != KRB5_FCC_NOFILE) {
+ com_err(argv[0], ret, "getting principal from ccache");
+ exit(1);
} else {
- ret = krb5_cc_default(context, &ccache);
- if (ret != 0) {
- com_err(argv[0], ret, "opening default ccache");
- exit(1);
- }
-
- ret = krb5_cc_get_principal(context, ccache, &princ);
- if (ret != 0 && ret != KRB5_CC_NOTFOUND && ret != KRB5_FCC_NOFILE) {
- com_err(argv[0], ret, "getting principal from ccache");
+ if (princ != NULL)
+ ret = krb5_get_init_creds_opt_set_fast_ccache(context, opts, ccache);
+ else ret = 0;
+ if (ret) {
+ com_err(argv[0], ret, "while setting default ccache name");
exit(1);
}
-
- ret = krb5_cc_close(context, ccache);
- if (ret != 0) {
- com_err(argv[0], ret, "closing ccache");
+ }
+ ret = krb5_cc_close(context, ccache);
+ if (ret != 0) {
+ com_err(argv[0], ret, "closing ccache");
+ exit(1);
+ }
+ if (pname) {
+ krb5_free_principal(context, princ);
+ princ = NULL;
+ if ((ret = krb5_parse_name(context, pname, &princ))) {
+ com_err(argv[0], ret, "parsing client name");
exit(1);
}
-
- if (princ == NULL)
- get_name_from_passwd_file(argv[0], context, &princ);
}
+ if (princ == NULL)
+ get_name_from_passwd_file(argv[0], context, &princ);
- if ((ret = krb5_get_init_creds_opt_alloc(context, &opts))) {
- com_err(argv[0], ret, "allocating krb5_get_init_creds_opt");
- exit(1);
- }
krb5_get_init_creds_opt_set_tkt_life(opts, 5*60);
krb5_get_init_creds_opt_set_renew_life(opts, 0);
krb5_get_init_creds_opt_set_forwardable(opts, 0);