Bug 1561691

Summary: Creating user with hammer having authentication source LDAP/AD should not ask for password
Product: Red Hat Satellite Reporter: Diksha Chaudhari <dchaudha>
Component: LDAPAssignee: Daniel Lobato Garcia <dlobatog>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: ajambhul, chhudson, dlobatog, egolov, jbhatia, mhulan, pcreech, sjagtap
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:37:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Diksha Chaudhari 2018-03-28 17:17:01 UTC
Description of problem:
When creating a user on satellite 6.3 with hammer having external authentication source LDAP/AD gives an error if password not mentioned while the user gets added if password parameter is mentioned. As the user created will be authenticated with the authentication source password and not by the password provided by us while creating user, iit should not be mandatory to create user with password parameter.

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

How reproducible: Always

Steps to Reproduce:
Create user without password parameter:
# hammer user create --auth-source-id 3   --firstname Tom --lastname Mathew   --login tom123 --mail 'tom' --roles 'Access Insights Viewer,Customized Viewer,Red Hat Access Logs,Tasks Reader,View hosts' 
Could not create the user:
  Missing arguments for 'user[password]'        

      2)  Create user with password parameter:
 # hammer user create --auth-source-id 3   --firstname Tom --lastname Mathew   --login tom123 --mail 'tom' --roles 'Access Insights Viewer,Customized Viewer,Red Hat Access Logs,Tasks Reader,View hosts' --password "redhat"
User [cmn01] created       

# hammer user list 
---|---------------|------------------|------------------------|-------|---------------------|--------------
ID | LOGIN         | NAME             | EMAIL                  | ADMIN | LAST LOGIN          | AUTHORIZED BY
---|---------------|------------------|------------------------|-------|---------------------|--------------
7  | tom123        |Tom Mathew        | tom        | yes   | 2018/02/20 15:21:56 | adserver    

Actual results:
User is not allowed to create without password parameter even when we have specified the external auth source. 

Expected results:
When the user is authenticated with the external authentication source LDAP/AD then while creating a user via hammer the --password parameter should be optional.


Additional info:

Comment 3 Daniel Lobato Garcia 2018-07-19 11:45:23 UTC
Created redmine issue https://projects.theforeman.org/issues/24301 from this bug

Comment 6 Daniel Lobato Garcia 2018-08-28 21:51:10 UTC
Fix submitted, AFAIK there are no 100% proven workarounds other than creating the user in the UI. 

https://github.com/theforeman/foreman/pull/6005 

It might be possible to create an user in the internal auth source, with an useless password, then update the user's auth source to be external as a workaround.

Comment 7 Satellite Program 2018-09-01 14:17:38 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24301 has been resolved.

Comment 9 Marek Hulan 2018-09-12 05:46:15 UTC
*** Bug 1627830 has been marked as a duplicate of this bug. ***

Comment 15 Nikhil Kathole 2018-12-18 12:52:49 UTC
VERIFIED

Version tested:
Satellite 6.5 snap 8

# hammer user create --auth-source-id 15   --firstname Tom --lastname Mathew   --login tom --mail 'tom' --roles 'View hosts' 
User [tom] created.
]# hammer -u Tom -p wrong-password host list
Unable to authenticate user Tom
# hammer -u Tom -p changeme host list
---|------|------------------|------------|----|-----|---------------|--------------|----------------------
ID | NAME | OPERATING SYSTEM | HOST GROUP | IP | MAC | GLOBAL STATUS | CONTENT VIEW | LIFECYCLE ENVIRONMENT
---|------|------------------|------------|----|-----|---------------|--------------|----------------------


User is allowed to create without passing --password if auth source is used and successfully authenticate it from auth source.

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

Comment 20 Red Hat Bugzilla 2023-09-18 00:13:24 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days