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 1296106 - Modifying user for Kerberos Principal Expiration causes internal server error
Summary: Modifying user for Kerberos Principal Expiration causes internal server error
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: IPA Maintainers
QA Contact: Namita Soman
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-06 10:47 UTC by Abhijeet Kasurde
Modified: 2018-10-19 11:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-19 11:11:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
internal_server_error.png (104.75 KB, image/png)
2016-01-06 10:47 UTC, Abhijeet Kasurde
no flags Details

Description Abhijeet Kasurde 2016-01-06 10:47:07 UTC
Created attachment 1112088 [details]
internal_server_error.png

Description of problem:
When user tries to modify Kerberos Principal Expiration value with date which is previous to year 1900 causes internal server error. This is due to bug in Python 2.7 - https://bugs.python.org/issue1777412 

# ipa user-mod --principal-expiration=11001212000000Z f 
ipa: ERROR: non-public: ValueError: year=1100 is before 1900; the datetime strftime() methods require year >= 1900
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ipalib/backend.py", line 129, in execute
    result = self.Command[_name](*args, **options)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 443, in __call__
    ret = self.run(*args, **options)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 761, in run
    return self.forward(*args, **options)
  File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 782, in forward
    return self.Backend.rpcclient.forward(self.name, *args, **kw)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 888, in forward
    return self._call_command(command, params)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 865, in _call_command
    return command(*params)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 1016, in _call
    return self.__request(name, args)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 975, in __request
    payload = json_encode_binary(payload, version)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 284, in json_encode_binary
    new_dict[k] = json_encode_binary(v, version)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 287, in json_encode_binary
    new_list = [json_encode_binary(v, version) for v in val]
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 284, in json_encode_binary
    new_dict[k] = json_encode_binary(v, version)
  File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 297, in json_encode_binary
    return {'__datetime__': val.strftime(LDAP_GENERALIZED_TIME_FORMAT)}
ValueError: year=1100 is before 1900; the datetime strftime() methods require year >= 1900
ipa: ERROR: an internal error has occurred


On Web UI, user gets error. Please see attachment.

Version-Release number of selected component (if applicable):
ipa-server-4.2.0-15.el7_2.3.x86_64

How reproducible:
100%

Steps to Reproduce:
1. install ipa-server and configure
2. add user in IPA server
3. try to modify Kerberos Principal expiration date using command line or web ui

Actual results:
User get trace back like mentioned above in stdout (cmd line) or error_log (web ui)


Expected results:
Either user is notified that date is before 1900 year 

or

Change Kerberos Principal Expiration Date as per user input

Additional info:
We can fix this either adding constant like 

LDAP_STRING_TIME_FORMAT = '{0.year:4d}{0.month:02d}{0.day:02d}{0.hour:02d}{0.minute:02d}{0.second:02d}Z'

and formatting datetime values like 

import datetime
d = datetime.datetime(1900, 10, 10, 10, 10, 10)
LDAP_STRING_TIME_FORMAT.format(d)

Comment 1 Abhijeet Kasurde 2016-01-06 10:49:00 UTC
In Python 3.* and onward the bug https://bugs.python.org/issue1777412 is fixed.

Comment 3 Petr Vobornik 2016-01-06 13:36:52 UTC
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/5579

Comment 4 Rob Crittenden 2016-01-06 13:56:12 UTC
What is the use case for setting the password expiration date < 1900?

Comment 5 Abhijeet Kasurde 2016-01-07 04:57:11 UTC
There is no valid use case as such because it is very rare that customer will enter a date < 1900. But for sanity purpose, I was writing testcases around Kerberos Principal Expiration Date. One of the usecase is a valid date but previous to 1900.

Comment 6 Petr Vobornik 2017-04-06 16:40:29 UTC
IdM team doesn't have capacity to fix this bug for RHEL 7.4. Moving to next RHEL version. Fixing the bug there will depend on capacity of FreeIPA upstream. Without sufficient  justification there is a chance that it will be moved again later.

Comment 9 Florence Blanc-Renaud 2018-10-19 11:11:43 UTC
As stated in the description, the issue is related to python2. As FreeIPA upstream is removing python2 support, only python3 will be supported and the issue will not appear any more. Hence closing as Upstream.


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