RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1053033 - regression introduced by krb5-1.11.3-35.el7
Summary: regression introduced by krb5-1.11.3-35.el7
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: krb5
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Nalin Dahyabhai
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-14 15:38 UTC by Patrik Kis
Modified: 2014-01-15 08:51 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-14 19:40:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Patrik Kis 2014-01-14 15:38:50 UTC
Description of problem:
The test bellow (originally created to verify the bug 773496) started to fail with krb5-1.11.3-35.el7.

Version-Release number of selected component (if applicable):
krb5-1.11.3-35.el7

How reproducible:
always

Steps to Reproduce:
# kadmin.local -q "ank -requires_preauth -pw foo alice"
Authenticating as principal root/admin with password.
WARNING: no policy specified for alice; defaulting to no policy
Principal "alice" created.
# kinit alice
Password for alice: 
# klist 
Ticket cache: KEYRING:persistent:0:0
Default principal: alice

Valid starting       Expires              Service principal
01/14/2014 10:26:43  01/15/2014 10:26:43  krbtgt/EXAMPLE.COM
	renew until 01/14/2014 10:26:43
# kdestroy 
#
# cat > kinittwice.c <<EOF
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <unistd.h>
> #include <krb5.h>
> 
> #define LIFETIME 60
> 
> static krb5_error_code
> prompter(krb5_context context, void *data,
>     const char *name, const char *banner,
>     int num_prompts, krb5_prompt prompts[])
> {
>     char *p;
>     int i;
>     for (i = 0; i < num_prompts; i++) {
>         p = strdup((const char *) data);
>         prompts[i].reply->data = p;
>         prompts[i].reply->length = strlen(p);
>     }
>     return 0;
> }
> static krb5_error_code
> delayed_prompter(krb5_context context, void *data,
>         const char *name, const char *banner,
>         int num_prompts, krb5_prompt prompts[])
> {
>     sleep(LIFETIME + 10);
>     return prompter(context, data, name, banner, num_prompts, prompts);
> }
> 
> int
> main(int argc, char **argv)
> {
>     krb5_context ctx;
>     krb5_principal client;
>     krb5_creds creds;
>     krb5_ccache ccache;
>     krb5_get_init_creds_opt *opts;
>     krb5_error_code err;
>     krb5_timestamp start;
> 
>     err = krb5_init_context(&ctx);
>     if (err != 0) {
>         printf("%s while initializing kerberos\n", error_message(err));
>         return err;
>     }
>     err = krb5_parse_name(ctx, argv[1], &client);
>     if (err != 0) {
>         printf("%s while resolving %s\n", error_message(err), argv[1]);
>         return err;
>     }
>     err = krb5_cc_default(ctx, &ccache);
>     if (err != 0) {
>         printf("%s while resolving ccache\n", error_message(err));
>         return err;
>     }
>     err = krb5_get_init_creds_opt_alloc(ctx, &opts);
>     if (err != 0) {
>         printf("%s while initializing opts\n", error_message(err));
>         return err;
>     }
>     krb5_get_init_creds_opt_set_tkt_life(opts, LIFETIME);
>     krb5_get_init_creds_opt_set_out_ccache(ctx, opts, ccache);
> 
>     memset(&creds, 0, sizeof(creds));
>     creds.client = client;
> 
>     err = krb5_get_init_creds_password(ctx, &creds, client, NULL,
>                     &delayed_prompter, argv[2],
>                         0, NULL, opts);
>     if (err != 0) {
>         printf("%s while getting creds\n", error_message(err));
>         return err;
>     }
>     start = creds.times.starttime ?
>         creds.times.starttime :
>         creds.times.authtime;
>     printf("Lifetime: %lds.\n", (long) creds.times.endtime - start);
> 
>     sleep(10);
> 
>     memset(&creds, 0, sizeof(creds));
>     creds.client = client;
>     err = krb5_get_init_creds_password(ctx, &creds, client, NULL,
>                         &prompter, argv[2],
>                         0, NULL, opts);
>     if (err != 0) {
>         printf("%s while getting creds\n", error_message(err));
>         return err;
>     }
>     start = creds.times.starttime ?
>         creds.times.starttime :
>         creds.times.authtime;
>     printf("Lifetime: %lds.\n", (long) creds.times.endtime - start);
> 
>     return 0;
> }
> EOF
#
# gcc -o kinittwice kinittwice.c `krb5-config --libs`
# ./kinittwice alice foo
Lifetime: 60s.
Lifetime: 60s.
# klist 
klist: No credentials cache found while retrieving principal name


Expected result, like with krb5-1.11.3-34.el7:

# ./kinittwice alice foo
Lifetime: 60s.
Lifetime: 60s.
# klist 
Ticket cache: KEYRING:persistent:0:0
Default principal: alice

Valid starting       Expires              Service principal
01/14/2014 10:30:45  01/14/2014 10:31:45  krbtgt/EXAMPLE.COM
	renew until 01/14/2014 10:30:45
# kdestroy 
# rpm -q krb5-libs
krb5-libs-1.11.3-34.el7.x86_64

Comment 2 Nalin Dahyabhai 2014-01-14 19:40:24 UTC
In -35, we added a change to address bug #1031724.  The result is that, 70 seconds after the KDC issues credentials that are only good for 60 seconds, attempts to save those creds to a keyring-based ccache will also tag the keyring for immediate expiration and reclamation by the kernel.

More generally, for keyrings, instead of finding a cache containing expired credentials, klist and other applications will now find nothing.  Marking as won't-fix, as the goal of the fix is to make it harder to use up non-swappable memory, which is at a premium.

Comment 3 Patrik Kis 2014-01-15 08:51:09 UTC
(In reply to Nalin Dahyabhai from comment #2)
> In -35, we added a change to address bug #1031724.  The result is that, 70
> seconds after the KDC issues credentials that are only good for 60 seconds,
> attempts to save those creds to a keyring-based ccache will also tag the
> keyring for immediate expiration and reclamation by the kernel.
> 
> More generally, for keyrings, instead of finding a cache containing expired
> credentials, klist and other applications will now find nothing.  Marking as
> won't-fix, as the goal of the fix is to make it harder to use up
> non-swappable memory, which is at a premium.

Yes, it make sense; it did not realize that this is the consequence of bug 1031724. I'll change the test. Thanks.


Note You need to log in before you can comment on or make changes to this bug.