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 1368981 - ipa otptoken-add --type=hotp --key creates wrong OTP
Summary: ipa otptoken-add --type=hotp --key creates wrong OTP
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: Kaleem
Aneta Šteflová Petrová
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-22 09:30 UTC by Jan Pazdziora
Modified: 2016-11-04 06:01 UTC (History)
9 users (show)

Fixed In Version: ipa-4.4.0-9.el7
Doc Type: Bug Fix
Doc Text:
Adding an IdM OTP token with a custom key works as expected When the user executed the "ipa otptoken-add" command with the "--key" option to add a new one-time password (OTP) token, the Identity Management (IdM) command line converted the token key provided by the user incorrectly. Consequently, the OTP token created in IdM was invalid, and attempts to authenticate using the OTP token failed. This update fixes the bug, and OTP tokens created in this situation are valid.
Clone Of:
Environment:
Last Closed: 2016-11-04 06:01:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2404 0 normal SHIPPED_LIVE ipa bug fix and enhancement update 2016-11-03 13:56:18 UTC

Description Jan Pazdziora 2016-08-22 09:30:56 UTC
Description of problem:

The option --key of ipa otptoken-add is documented to accept the key encoded in Base32. In RHEL 7.2, this input value ended up Base32-encoded in the secret parameter of the displayed otpauth://hotp/ URL and Base64-encoded in the Key output of the ipa otptoken-add --type=hotp --key command and in the ipatokenOTPkey.

In RHEL 7.3 nightly, the secret parameter of the otpauth: URL is different and the Key and ipatokenOTPkey show exactly this Base32-encoded string.

The result is wrong codes generated by FreeOTP and failing authentication when correct codes are used.

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

ipa-server-4.4.0-8.el7.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. ipa otptoken-add --type=hotp --key and enter (paste) GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ twice
2. ipa otptoken-find --raw --all

Actual results:

Key: 
Enter Key again to verify: 
------------------
Added OTP token ""
------------------
  Unique ID: 6f780b6a-9771-40bf-afa8-42060ceb7a03
  Type: HOTP
  Owner: admin
  Manager: admin
  Key: GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ
  Algorithm: sha1
  Digits: 6
  Counter: 0
  URI: otpauth://hotp/admin:6f780b6a-9771-40bf-afa8-42060ceb7a03?digits=6&secret=DBDEGGGQKUMY3U2A4JIBQRSDDDIFKGMN2NAOEUA%3D&counter=0&algorithm=SHA1&issuer=admin%40EXAMPLE.TEST

[ QR code ]

-------------------
1 OTP token matched
-------------------
  dn: ipatokenuniqueid=6f780b6a-9771-40bf-afa8-42060ceb7a03,cn=otp,dc=example,dc=test
  ipatokenuniqueid: 6f780b6a-9771-40bf-afa8-42060ceb7a03
  type: HOTP
  ipatokenowner: uid=admin,cn=users,cn=accounts,dc=example,dc=test
  managedby: uid=admin,cn=users,cn=accounts,dc=example,dc=test
  ipatokenHOTPcounter: 0
  ipatokenOTPalgorithm: sha1
  ipatokenOTPdigits: 6
  ipatokenOTPkey: GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ
  objectclass: ipatokenhotp
  objectclass: ipatoken
  objectclass: top
----------------------------
Number of entries returned 1
----------------------------

Expected results:

This output comes from RHEL 7.2:

[root@cloud-qe-4 ~]# ipa otptoken-add --type=hotp --keyKey: 
Enter Key again to verify: 
------------------
Added OTP token ""
------------------
  Unique ID: 7c00bb55-a14b-451b-9f6d-db6885c760e4
  Type: HOTP
  Owner: admin
  Manager: admin
  Key: MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=
  Algorithm: sha1
  Digits: 6
  Counter: 0
  URI: otpauth://hotp/admin:7c00bb55-a14b-451b-9f6d-db6885c760e4?digits=6&secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&counter=0&algorithm=SHA1&issuer=admin%40EXAMPLE.TEST

[ QR code ]

-------------------
1 OTP token matched
-------------------
  dn: ipatokenuniqueid=7c00bb55-a14b-451b-9f6d-db6885c760e4,cn=otp,dc=example,dc=test
  ipatokenuniqueid: 7c00bb55-a14b-451b-9f6d-db6885c760e4
  type: HOTP
  ipatokenowner: uid=admin,cn=users,cn=accounts,dc=example,dc=test
  ipatokenHOTPcounter: 0
  ipatokenOTPalgorithm: sha1
  ipatokenOTPdigits: 6
  ipatokenOTPkey: MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=
  managedby: uid=admin,cn=users,cn=accounts,dc=example,dc=test
  objectclass: ipatokenhotp
  objectclass: ipatoken
  objectclass: top
----------------------------
Number of entries returned 1
----------------------------

Additional info:

Comment 2 Jan Pazdziora 2016-08-22 09:56:01 UTC
Note:

$ echo GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ | base64 -d | base32
DBDEGGGQKUMY3U2A4JIBQRSDDDIFKGMN2NAOEUA=

Comment 4 Petr Vobornik 2016-08-22 10:26:56 UTC
looks like thin-client related output decoding issue.

Comment 5 Petr Vobornik 2016-08-23 11:48:26 UTC
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/6247

Comment 10 Jan Cholasta 2016-08-31 08:25:43 UTC
Fixed upstream
master:
https://fedorahosted.org/freeipa/changeset/386fdc1d77affc897b923a58602a9f14325216c6/

Comment 15 Varun Mylaraiah 2016-09-18 08:32:15 UTC
Verified
ipa-server-4.4.0-12.el7.x86_64


[root@host108 ~]# ipa otptoken-add --type=hotp --key
Key: 
Enter Key again to verify: 
ipa: WARNING: QR code width is greater than that of the output tty. Please resize your terminal.
------------------
Added OTP token ""
------------------
  Unique ID: d33ea305-97b4-4837-9716-ff945a32fb5e
  Type: HOTP
  Owner: admin
  Manager: admin
  Key: MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=
  Algorithm: sha1
  Digits: 6
  Counter: 0
  URI: otpauth://hotp/admin:d33ea305-97b4-4837-9716-ff945a32fb5e?digits=6&secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&counter=0&algorithm=SHA1&issuer=admin%40TESTRELM.TEST

█████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████
████ ▄▄▄▄▄ █▄██▄▀█▄▄█▄█ ▀██▄█▀█▄▀█▄▄█▄▀▄▄  █▄▀ ▀██ ▄▄▄▄▄ ████
████ █   █ █▀█▀█ ▀ ▄█ ▀▀   █ ▄▄▄██▄█ █▀▀ ██▀▀▄▀▄▀█ █   █ ████
████ █▄▄▄█ █ ▀▄      ▄ ▀█▄██ ▄▄▄ █ █▀▀██▄ ▄█ ▄ ███ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █▄▀ ▀▄▀ █ ▀ ▀▄▀ █▄█ █▄█▄▀ █ █▄▀▄█ ▀ █▄▄▄▄▄▄▄████
████ ███ █▄▄▄▄▄▄▄█▀▄ █▄ ▄▄▀▀▄▄ ▄ █▄  ▄█▀▄   █▄▀▀▀ ▄  ▄█▀ ████
████ ██▄▀█▄▄██████▀ ▄   ▀▀▄▄▀  ▄ █ ▀    ▀▄██ ▄▄▄▄▀▀█▀▄▀█▄████
█████▄▄█▀▀▄███ ██ ▄▄█▀▄ ██▄▀██▀▀ ▀█▄ █▀▀ █▀▀██ ▀▀█▄█▄█   ████
████▀ ▀  ▄▄▄▄▄▀ ▀ █▀▄▄▀█▄▀ ▀▄██▄  █▀▄▀█▀ ▄▄██▄▀▄▄█ ▄█▄██▄████
████ ▄▀▀ █▄▀▄▀█▄▀ ▄ ▄▄▀█▄██▄▀▀█▀ ▄ ▄███▀  █▄█▄ ▄▄ ▄█████▀████
█████▄▀  █▄▀  █▄ █   ██▄▄▄ ███ ███ ▀▄█▄ ▀▄▄█▄▀▄▄▀ █  ▄▄▄▄████
████ ▀█▀▀▄▄ ▄   ▀█▀▄█ ▄▀█▀█▄ ▀ ▀█    ▀▄  ▀██ ▄▄ ▀▄    ▀▄▀████
████  ▄ █▄▄▀▀███ ▄▄▀▄▄  ██ ▀███▄ ▄▄▄▀  ▀ ▀ █▄▀ █ ▄▄ ▄ ▄█ ████
████▀▄ █ ▄▄▄ ▀ █ █▀ ▄▄▀ ▄▀▄▄ ▄▄▄ ▄▀▄ ███▄█▀▀▀  ▄ ▄▄▄ █▀▄█████
████ ▄██ █▄█ █ ▀▀ ██▀▄█▀▄▀▄  █▄█   ▄█▀ ▄▄█▄▀▄▄ ▄ █▄█ ▀█▀▀████
████▄ ▄█▄▄▄ ▄▀█▄▄▀█▀█ █ ▄▄▀▄ ▄ ▄▄█▀▀ ▀ █ █▄ ▀ ▀ ▄ ▄ ▄█▀▄ ████
████ ███ ▀▄ ▄▀ █▀▄▄ ▄▄ ▄▀▄██▀▀█▀▄▀▄▀ █ ▄ █▄ ▄ ▄█▄▀▄ █▄▀█ ████
████▀▄█▀  ▄▄█ ██▄█ █▄▀ ▀▄▀▄▄█▄ ▀▄▄ ▄██▄█ ▄▀██ ▀█ ▄█ ▀▄▄ ▀████
██████▄▀▄▀▄  ▀ █▄▀▄ ███ ██▀██ █▄ ▀█▄█▀▀▀██ █▄▄▄  ▀▄▀█ ▄█ ████
████▀▀ ▄▀▄▄█ ▀ ▄▄█ █ ▀█▀ █▀ ▀ ▄▄█▄▀ █ ██ ▀  ▀█▀ ▄▄▄ ▀ ▀█▄████
█████▀▄▀▄ ▄██▀▄▄ █▀ ▀ ▄ ▀▀█ ▄ █▀▀█▄▄▀  ▀▀▄▀▀▀▄▄█▄ ▀██ █▄ ████
████▀█▀ ▀▀▄█▀ ▀▀███ ▄▄   ▄▄██▀▄▀▄▀▀█▄██▄ ▄▀█▄▄█ █▀▄█▀▄   ████
████▄ ▀▄▄▄▄█▀▀▀█▀▀▄  ▄█ █▀▄  ▀ ▄█▄ ▀  ▀████▄▄█ ▀▄█▄▀▀ █ ▄████
███████▄██▄▄▀▄  ██▄ ██▄ █▄▀█ ▄▄▄ ▄▀▀   ███ █ █▀  ▄▄▄  ▀██████
████ ▄▄▄▄▄ █▄▀▄▀█▄██▀ ▀▄█▄ ▄ █▄█ ▄▄█▀▄▄▄▄█▄▄█  █ █▄█ ▀█▀▀████
████ █   █ █▄▀ ██▄▀▀▀ ▄█▀▀█▄▄ ▄ ▄█ █▀▀ ███▀▄▀▀ ▀▄▄ ▄▄▄▀▀█████
████ █▄▄▄█ ██▄▀▄█▀██▄▄ ██▄▀█ ██▀ █ ▀   █  ▄█▄ ▄ █ ▀▀██▀  ████
████▄▄▄▄▄▄▄█▄▄▄████▄▄▄▄▄▄▄▄▄▄▄█▄▄██▄█▄▄▄▄█▄████▄▄██▄▄▄▄▄█████
█████████████████████████████████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

  dn: ipatokenuniqueid=d33ea305-97b4-4837-9716-ff945a32fb5e,cn=otp,dc=testrelm,dc=test
  ipatokenuniqueid: d33ea305-97b4-4837-9716-ff945a32fb5e
  type: HOTP
  ipatokenowner: uid=admin,cn=users,cn=accounts,dc=testrelm,dc=test
  managedby: uid=admin,cn=users,cn=accounts,dc=testrelm,dc=test
  ipatokenHOTPcounter: 0
  ipatokenOTPalgorithm: sha1
  ipatokenOTPdigits: 6
  ipatokenOTPkey: MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=
  objectclass: ipatokenhotp
  objectclass: ipatoken
  objectclass: top

Comment 19 errata-xmlrpc 2016-11-04 06:01:57 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://rhn.redhat.com/errata/RHBA-2016-2404.html


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