Red Hat Satellite engineering is moving the tracking of its product development work on Satellite 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 "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. 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 "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-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 1602367 - Hammer/API - wrong error message
Summary: Hammer/API - wrong error message
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Authentication
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: 6.5.0
Assignee: Marek Hulan
QA Contact: Jameer Pathan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-18 09:22 UTC by Martin Korbel
Modified: 2019-11-05 22:30 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:37:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24284 0 Normal Closed Hammer/API - wrong error message 2021-02-12 19:24:49 UTC
Foreman Issue Tracker 24285 0 Normal Closed Hammer/API - wrong error message 2021-02-12 19:24:49 UTC
Red Hat Product Errata RHSA-2019:1222 0 None None None 2019-05-14 12:37:44 UTC

Description Martin Korbel 2018-07-18 09:22:32 UTC
Description of problem:
When we do brute force password attack via hammer (min. 30 trying), it returns the message "Invalid username or password." 
After that we put a correct credential, but hammer/API still return the same message "Invalid username or password.". It is little confusing. 

Version-Release number of selected component (if applicable):
Sat6.4#11

How reproducible:
100%

Steps to Reproduce:
1. We have got Sat6.4 and client machine.
2. We register the client machine to Satellite 6.4 repo and install hammer (standalone)
  > yum install -y tfm-rubygem-hammer_cli_katello
  > hammer --fetch-ca-cert https://satellite.example.com/
  > install /root/.hammer/certs/satellite.example.com_443.pem /etc/pki/ca-trust/source/anchors/
  > update-ca-trust

3. Check hammer
> hammer -u admin -p correct_password user list
...

4. Brute force password attack
> for i in {1..30}; do hammer -u admin -p bad_password user list; done
Invalid username or password.
Invalid username or password.
...
Invalid username or password.
Invalid username or password.

5. Check hammer with the correct password
> hammer -u admin -p correct_password user list

Actual results:
we get the message "Invalid username or password."

Expected results:
We should get the message "Too many tries, please try again in a few minutes.". The same as via WebUI.


Additional info:
> hammer -d -u admin -p correct_password user list
...
[DEBUG 2018-07-18T04:58:00 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2018-07-18T04:58:00 API] 401 Unauthorized
[DEBUG 2018-07-18T04:58:00 API] {
    "error" => {
        "message" => "Unable to authenticate user "
    }
}
[DEBUG 2018-07-18T04:58:00 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_foreman_unauthorized
[ERROR 2018-07-18T04:58:00 Exception] Invalid username or password.
Invalid username or password.
[ERROR 2018-07-18T04:58:00 Exception] 

HammerCLIForeman::Api::UnauthorizedError (Invalid username or password.):
...

Comment 1 Marek Hulan 2018-07-18 11:48:47 UTC
Created redmine issue https://projects.theforeman.org/issues/24284 from this bug

Comment 5 Jameer Pathan 2018-11-15 10:14:50 UTC
verified:

@satellite 6.5.0 snap 3

steps:
# for i in {1..30}; do hammer -u admin -p bad_password user list; done
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
Unable to authenticate user admin
[root@dell-pe-fm120-2d ~]# hammer -u admin -p correct_password user list
Too many tries, please try again in a few minutes.


observation:
-"Too many tries, please try again in a few minutes." through hammer. The same as via WebUI.

Comment 9 errata-xmlrpc 2019-05-14 12:37:37 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/RHSA-2019:1222


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