Bug 1368981 - ipa otptoken-add --type=hotp --key creates wrong OTP
Summary: ipa otptoken-add --type=hotp --key creates wrong OTP
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa   
(Show other bugs)
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: IPA Maintainers
QA Contact: Kaleem
Aneta Šteflová Petrová
URL:
Whiteboard:
Keywords: Regression
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-04 06:01:57 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2404 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@EXAMPLE.TEST: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@EXAMPLE.TEST: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@TESTRELM.TEST: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.