This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2142587 - Last expired OTP token would be considered as still assigned to the user
Summary: Last expired OTP token would be considered as still assigned to the user
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: ipa
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Florence Blanc-Renaud
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-14 14:09 UTC by Josep
Modified: 2023-09-18 20:41 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-18 20:41:19 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Pagure freeipa issue 9387 0 None None None 2023-06-05 12:52:22 UTC
Red Hat Issue Tracker FREEIPA-8986 0 None None None 2022-11-14 14:11:50 UTC
Red Hat Issue Tracker   RHEL-4915 0 None Migrated None 2023-09-18 20:38:36 UTC
Red Hat Issue Tracker RHELPLAN-139298 0 None None None 2022-11-14 14:11:56 UTC

Description Josep 2022-11-14 14:09:02 UTC
Description of problem:

The problem is that if a user is forced to use an OTP token, set in the Default User Authentication types in the UI and then selecting "Two factor authentication" and "Disable per-user override" settings, the first time when user doesn't have an OTP token, user can login with a password and generate their own OTP token, and afterwards will always be using OTP, which I think is the logical steps to make a migration from methods of authentication.

The problem is that the user can make the trick to generate an OTP token with an "end-validity period", and after that the user can enter always only with the password (bypassing all the general configuration of OTP), for example:

[idmuser01@server ~]$ ipa otptoken-add --not-after=20221107160000Z
ipa: WARNING: QR code width is greater than that of the output tty. Please resize your terminal.
------------------
Added OTP token ""
------------------
  Unique ID: 255c887e-28b4-4d05-9b25-3fdf474a1790
  Type: TOTP
  Owner: idmuser01
  Manager: idmuser01
  Validity end: 20221107160000Z
  Algorithm: sha1
  Digits: 6
  Clock interval: 30

Before the token expires, always asks for the second factor:

[root@server2 ~]# ssh -l idmuser01 server.lab.example.net
(idmuser01.example.net) First Factor:
(idmuser01.example.net) Second Factor:
Last login: Mon Nov  7 15:06:33 2022 from 192.168.1.111
[idmuser01@server ~]$ exit
logout
Connection to server.lab.example.net closed.

But after the end validity period (set by the same user), only asks for password:

[root@server2 ~]# ssh -l idmuser01 server.lab.example.net
(idmuser01.example.net) Password:
Last login: Mon Nov  7 15:25:50 2022 from 192.168.1.111


Version-Release number of selected component (if applicable):


How reproducible:

Always


Steps to Reproduce:

As described in the Description of problem section above, after a user makes login with ssh to a server, can add a token with end-validity date, as can be seen in

[idmuser01@server ~]$ ipa otptoken-add --not-after=20221107160000Z
ipa: WARNING: QR code width is greater than that of the output tty. Please resize your terminal.
------------------
Added OTP token ""
------------------
  Unique ID: 255c887e-28b4-4d05-9b25-3fdf474a1790
  Type: TOTP
  Owner: idmuser01
  Manager: idmuser01
  Validity end: 20221107160000Z
  Algorithm: sha1
  Digits: 6
  Clock interval: 30

Before the token expires, always asks for the second factor:

[root@server2 ~]# ssh -l idmuser01 server.lab.example.net
(idmuser01.example.net) First Factor:
(idmuser01.example.net) Second Factor:
Last login: Mon Nov  7 15:06:33 2022 from 192.168.1.111
[idmuser01@server ~]$ exit
logout
Connection to server.lab.example.net closed.

But after the end validity period (set by the same user), only asks for password:

[root@server2 ~]# ssh -l idmuser01 server.lab.example.net
(idmuser01.example.net) Password:
Last login: Mon Nov  7 15:25:50 2022 from 192.168.1.111

Actual results:

OTP token after expiration, fallback to password-only method of authentication

Expected results:

Right now, the code cannot diferentiate between "token does not exist"  and "no valid token exists" making the fallback to password-only method in either case. 

What is needed is to consider the last expired OTP token to be treated
as a token still assigned to a user, thus forcing to reject
password-only authentication, in that case the token is still assigned to the user but cannot use that to make login, and also doesn't fallback to password-only authentication. A user would not be
able to modify their token information until admin would extend the
token validity or issue a new token, unless the said user has a valid
Kerberos ticket. In the latter case the user would be able to modify the
validity of the token by himself and then be able to login with the token
but not with the password.

Use cases:
  - user forced to use OTP:
    - has no token at all: allow password access to add a token
    - has all tokens expired: do not allow password access, let administrator to handle this case. Also if user still has a valid Kerberos ticket can extend the end-validity date of the token created by himself
    - has at least one valid token: do not allow password access


Additional info:

Comment 2 Florence Blanc-Renaud 2023-06-05 12:52:21 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/9387

Comment 3 RHEL Program Management 2023-09-18 20:36:16 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 4 RHEL Program Management 2023-09-18 20:41:19 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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