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 1188917 - kerberos password expiry not sufficiently precise on time remaining
Summary: kerberos password expiry not sufficiently precise on time remaining
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: krb5
Version: 7.0
Hardware: Unspecified
OS: Linux
low
low
Target Milestone: rc
: 7.4
Assignee: Robbie Harwood
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-04 02:46 UTC by Morgan Weetman
Modified: 2017-05-02 18:35 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-02 18:35:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (644 bytes, patch)
2016-06-29 03:38 UTC, Morgan Weetman
no flags Details | Diff

Description Morgan Weetman 2015-02-04 02:46:09 UTC
Description of problem:
When logging in to a RHEL 6 host using kerberos credentials the password expiry warning date is a day further into the future than the suggested number of days.

Version-Release number of selected component (if applicable):
krb5-workstation-1.10.3-33.el6.x86_64

How reproducible:
Log in to a system using a kerberos account when your password will expire within the warning time frame.

Actual results:

me.com's password:
Warning: Your password will expire in 3 days on Fri Feb  6 08:26:09 2015
Last login: Fri Jan 30 14:21:49 AEDT 2015 from NNN.NNN.NNN.NNN on pts/0
[me@host ~]$ date
Mon Feb  2 08:36:35 AEDT 2015


Expected results:
Warning: Your password will expire in 3 days on Thu Feb  5 08:26:09 2015
or:
Warning: Your password will expire in 4 days on Fri Feb  6 08:26:09 2015


Additional info:
This system is authenticating users against Active Directory.

I was looking into it but don't really have the time to test .. I thought that if 'days' was wrong it may be due to truncation when converted to an int, adding ceil() might be an option (would need to be compiled with '-lm'):

--- lib/krb5/krb/gic_pwd.c
+++ lib/krb5/krb/gic_pwd.c
@@ -2,6 +2,7 @@
 #include "k5-int.h"
 #include "com_err.h"
 #include "init_creds_ctx.h"
+#include <math.h>
 
 krb5_error_code
 krb5_get_as_key_password(krb5_context context,
@@ -207,7 +208,7 @@ warn_pw_expiry(krb5_context context, krb5_get_init_creds_opt *options,
     } else {
         snprintf(banner, sizeof(banner),
                  _("Warning: Your password will expire in %d days on %s"),
-                 delta / 86400, ts);
+                 (int)ceil(delta / 86400), ts);
     }
 
     /* PROMPTER_INVOCATION */

Comment 3 Morgan Weetman 2015-03-30 22:39:14 UTC
Further information:

me.com's password:
Warning: Your password will expire in 4 days on Sat Apr  4 11:47:00 2015
Last login: Mon Mar 30 11:05:11 AEDT 2015 from NNN.NNN.NNN.NNN on pts/0
[me@host ~]$ date
Mon Mar 30 13:14:21 AEDT 2015


me.com's password:
Warning: Your password will expire in 4 days on Sat Apr  4 11:47:00 2015
Last login: Mon Mar 30 13:49:35 AEDT 2015 from NNN.NNN.NNN.NNN on pts/0
[me@host ~]$ date
Tue Mar 31 08:03:22 AEDT 2015


It seems like the number days until expiry might actually be the number of whole days remaining until the hour and minute of password expiry, regardless of what day of the week is the current day for the user.

Any chance we can make it more accurate? :-
e.g.
Warning: Your password will expire in 4 days, 20 hours and 16 minutes on Sat Apr  4 11:47:00 2015

or:
Warning: Your password will expire in 4.79 days on Sat Apr  4 11:47:00 2015

Comment 4 Morgan Weetman 2016-06-29 03:38:25 UTC
Created attachment 1173611 [details]
Proposed patch

Patch adds 2 decimal places to days, testing required

Comment 7 Robbie Harwood 2017-05-02 18:35:39 UTC
Upstream was not interested in this patch when it was proposed, so we will not be taking it in order to preserve compatibility.


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