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 1458183 - Users can delete their last active OTP token
Summary: Users can delete their last active OTP token
Keywords:
Status: CLOSED ERRATA
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: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-02 08:55 UTC by Thorsten Scherf
Modified: 2021-12-10 15:12 UTC (History)
7 users (show)

Fixed In Version: ipa-4.6.4-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 10:56:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-7517 0 None None None 2021-12-10 15:12:12 UTC
Red Hat Product Errata RHBA-2018:3187 0 None None None 2018-10-30 10:56:48 UTC

Description Thorsten Scherf 2017-06-02 08:55:55 UTC
Description of problem:

When the global default auth-type is set to 'otp', users can still delete their last OTP token. Only after the auth-type has been set explicitly on the user entry, the last token can not be deleted. 

A user should should not be able to delete the last token for the account when the global auth-type is set to otp.

# ipa config-mod --user-auth-type otp
# ipa config-show|grep -i auth
  Default user authentication types: otp

- Login as tuser1

$ ipa otptoken-add
$ ipa otptoken-find 
-------------------
1 OTP token matched
-------------------
  Unique ID: 448dd2f5-56e3-41dd-bea8-2df72fc3ba96
  Type: TOTP
  Owner: tuser1
----------------------------
Number of entries returned 1
----------------------------

$ klist
Ticket cache: KEYRING:persistent:88800001:krb_ccache_EgmK3we
Default principal: tuser1.REDHAT.COM

Valid starting       Expires              Service principal
06/02/2017 16:21:05  06/03/2017 16:21:05  krbtgt/GSSLAB.PNQ2.REDHAT.COM.REDHAT.COM

$ ipa otptoken-delete 448dd2f5-56e3-41dd-bea8-2df72fc3ba96
--------------------------------------------------------
Deleted OTP token "448dd2f5-56e3-41dd-bea8-2df72fc3ba96"
--------------------------------------------------------

- Change the auth-type on the user entry itself

#  ipa user-mod tuser1 --user-auth-type otp
#  ipa user-show  tuser1 |grep auth
  User authentication types: otp

- Login as tuser1 again and add a new token and try to delete it

$ ipa otptoken-add
$ ipa otptoken-find
-------------------
1 OTP token matched
-------------------
  Unique ID: abb6105d-e751-451f-9f2f-5fed9c436a04
  Type: TOTP
  Owner: tuser1
----------------------------
Number of entries returned 1
----------------------------

$ ipa otptoken-del abb6105d-e751-451f-9f2f-5fed9c436a04
ipa: ERROR: Server is unwilling to perform: Can't delete last active token


Version-Release number of selected component (if applicable):
ipa-server-4.4.0-12.el7.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Petr Vobornik 2017-06-09 15:53:03 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/7012

Comment 5 fbarreto 2017-12-20 12:01:55 UTC
PR in GitHub: https://github.com/freeipa/freeipa/pull/1416

Comment 6 Florence Blanc-Renaud 2018-02-20 09:08:45 UTC
Fixed upstream
master:
    8b6506a User must not be able to delete his last active otp token
    c701cd2 389-ds OTP lasttoken plugin: Add unit test
ipa-4-6:
    55d5f91 User must not be able to delete his last active otp token
    a47ddde 389-ds OTP lasttoken plugin: Add unit test

Comment 9 Nikhil Dehadrai 2018-08-16 09:10:35 UTC
IPA-server-version: ipa-server-4.6.4-5.el7.x86_64

Verified the bug on the basis of following observations:

1. Verified that when (only one) last OTP Token is active , it cannot be deleted.
2. The only time user can delete the OTP token when the system has more than one OTP-TOKEN.
3. The same behavior is observed when logged in through server UI. message : 'Server is unwilling to perform: Can't delete last active token'


Console-Output.
----------------

[root@ibm-x3650m4-01-vm-12 ~]# ipa user-add --first=test --last=user --password
User login [tuser]: 
Password: 
Enter Password again to verify: 
------------------
Added user "tuser"
------------------
  User login: tuser
  First name: test
  Last name: user
  Full name: test user
  Display name: test user
  Initials: tu
  Home directory: /home/tuser
  GECOS: test user
  Login shell: /bin/sh
  Principal name: tuser
  Principal alias: tuser
  User password expiration: 20180816084308Z
  Email address: tuser
  UID: 1332000001
  GID: 1332000001
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True
[root@ibm-x3650m4-01-vm-12 ~]# kinit tuser
Password for tuser: 
Password expired.  You must change it now.
Enter new password: 
Enter it again: 
[root@ibm-x3650m4-01-vm-12 ~]# kinit admin
Password for admin: 
[root@ibm-x3650m4-01-vm-12 ~]# ipa config-mod --user-auth-type otp
  Maximum username length: 32
  Home directory base: /home
  Default shell: /bin/sh
  Default users group: ipausers
  Default e-mail domain: testrelm.test
  Search time limit: 2
  Search size limit: 100
  User search fields: uid,givenname,sn,telephonenumber,ou,title
  Group search fields: cn,description
  Enable migration mode: FALSE
  Certificate Subject base: O=TESTRELM.TEST
  Password Expiration Notification (days): 4
  Password plugin features: AllowNThash, KDC:Disable Last Success
  SELinux user map order: guest_u:s0$xguest_u:s0$user_u:s0$staff_u:s0-s0:c0.c1023$unconfined_u:s0-s0:c0.c1023
  Default SELinux user: unconfined_u:s0-s0:c0.c1023
  Default PAC types: MS-PAC, nfs:NONE
  Default user authentication types: otp
  IPA masters: ibm-x3650m4-01-vm-12.testrelm.test
  IPA CA servers: ibm-x3650m4-01-vm-12.testrelm.test
  IPA NTP servers: ibm-x3650m4-01-vm-12.testrelm.test
  IPA CA renewal master: ibm-x3650m4-01-vm-12.testrelm.test
  IPA master capable of PKINIT: ibm-x3650m4-01-vm-12.testrelm.test
[root@ibm-x3650m4-01-vm-12 ~]# ipa config-show|grep -i auth
  Default user authentication types: otp
[root@ibm-x3650m4-01-vm-12 ~]# ipa user-find
---------------
2 users matched
---------------
  User login: admin
  Last name: Administrator
  Home directory: /home/admin
  Login shell: /bin/bash
  Principal alias: admin
  UID: 1332000000
  GID: 1332000000
  Account disabled: False

  User login: tuser
  First name: test
  Last name: user
  Home directory: /home/tuser
  Login shell: /bin/sh
  Principal name: tuser
  Principal alias: tuser
  Email address: tuser
  UID: 1332000001
  GID: 1332000001
  Account disabled: False
----------------------------
Number of entries returned 2
----------------------------
[root@ibm-x3650m4-01-vm-12 ~]# ipa user-mod tuser --user-auth-type otp
---------------------
Modified user "tuser"
---------------------
  User login: tuser
  First name: test
  Last name: user
  Home directory: /home/tuser
  Login shell: /bin/sh
  Principal name: tuser
  Principal alias: tuser
  Email address: tuser
  UID: 1332000001
  GID: 1332000001
  User authentication types: otp
  Account disabled: False
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True
[root@ibm-x3650m4-01-vm-12 ~]# ipa user-show  tuser |grep auth
  User authentication types: otp
[root@ibm-x3650m4-01-vm-12 ~]# 


Logged in as user:
------------------
Could not chdir to home directory /home/tuser: No such file or directory
-sh-4.2$ whoami
tuser
-sh-4.2$ ipa otptoken-add
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: QR code width is greater than that of the output tty. Please resize your terminal.
------------------
Added OTP token ""
------------------
  Unique ID: 8bc938ca-c482-4ee8-913a-bcf098fe01ef
  Type: TOTP
  Owner: tuser
  Manager: tuser
  Algorithm: sha1
  Digits: 6
  Clock interval: 30
  URI: otpauth://totp/tuser:8bc938ca-c482-4ee8-913a-bcf098fe01ef?digits=6&secret=AKEZTEPLYQTNNIOBO6J6GIRVL5UXRV5WUXZBK4ELN67ZEXM4O5YUEBTL&period=30&algorithm=SHA1&issuer=tuser%40TESTRELM.TEST

-sh-4.2$ ipa otptoken-find 
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
-------------------
1 OTP token matched
-------------------
  Unique ID: 8bc938ca-c482-4ee8-913a-bcf098fe01ef
  Type: TOTP
  Owner: tuser
----------------------------
Number of entries returned 1
----------------------------
-sh-4.2$ klist
Ticket cache: KEYRING:persistent:1332000001:krb_ccache_1fSVlK1
Default principal: tuser

Valid starting       Expires              Service principal
08/16/2018 04:48:45  08/17/2018 04:48:30  HTTP/ibm-x3650m4-01-vm-12.testrelm.test
08/16/2018 04:48:30  08/17/2018 04:48:30  krbtgt/TESTRELM.TEST
-sh-4.2$ ipa otptoken-delete 8bc938ca-c482-4ee8-913a-bcf098fe01ef
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
ipa: ERROR: unknown command 'otptoken-delete'
-sh-4.2$ ipa otptoken-del 8bc938ca-c482-4ee8-913a-bcf098fe01ef
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
ipa: ERROR: Server is unwilling to perform: Can't delete last active token
-sh-4.2$ 


Logged-in again to add one more token:
----------------------------------------------
Could not chdir to home directory /home/tuser: No such file or directory
-sh-4.2$ ipa otptoken-add
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: QR code width is greater than that of the output tty. Please resize your terminal.
------------------
Added OTP token ""
------------------
  Unique ID: 669b5994-35e5-4014-b87f-b1d25bd2e4c1
  Type: TOTP
  Owner: tuser
  Manager: tuser
  Algorithm: sha1
  Digits: 6
  Clock interval: 30
  URI: otpauth://totp/tuser:669b5994-35e5-4014-b87f-b1d25bd2e4c1?digits=6&secret=OY4RCMSNWWRHNZCD3KBSPWH4BCPKHUXVLCDGFPWO6XWUC4JQGD4RVSXO&period=30&algorithm=SHA1&issuer=tuser%40TESTRELM.TEST



(reverse-i-search)`': ^C
-sh-4.2$ ipa otptoken-find
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
--------------------
2 OTP tokens matched
--------------------
  Unique ID: 669b5994-35e5-4014-b87f-b1d25bd2e4c1
  Type: TOTP
  Owner: tuser

  Unique ID: 8bc938ca-c482-4ee8-913a-bcf098fe01ef
  Type: TOTP
  Owner: tuser
----------------------------
Number of entries returned 2
----------------------------
-sh-4.2$ ipa otptoken-del 669b5994-35e5-4014-b87f-b1d25bd2e4c1
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
--------------------------------------------------------
Deleted OTP token "669b5994-35e5-4014-b87f-b1d25bd2e4c1"
--------------------------------------------------------
-sh-4.2$ ipa otptoken-find
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
-------------------
1 OTP token matched
-------------------
  Unique ID: 8bc938ca-c482-4ee8-913a-bcf098fe01ef
  Type: TOTP
  Owner: tuser
----------------------------
Number of entries returned 1
----------------------------
-sh-4.2$ 
-sh-4.2$ ipa otptoken-del 8bc938ca-c482-4ee8-913a-bcf098fe01ef
ipa: ERROR: Could not create log_dir u'/home/tuser/.ipa/log'
ipa: WARNING: Failed to write schema: [Errno 13] Permission denied: '/home/tuser'
ipa: WARNING: Failed to write server info: [Errno 13] Permission denied: '/home/tuser'
ipa: ERROR: Server is unwilling to perform: Can't delete last active token
-sh-4.2$ rpm -q ipa-server
ipa-server-4.6.4-5.el7.x86_64
-sh-4.2$ 


Thus on the basis of above observations, marking the status of bug to 'VERIFIED'.

Comment 11 errata-xmlrpc 2018-10-30 10:56:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3187


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