Bug 794882

Summary: ipa netgroup-find --hosts=<hostname> not working
Product: Red Hat Enterprise Linux 6 Reporter: Scott Poore <spoore>
Component: ipaAssignee: Martin Prpič <mprpic>
Status: CLOSED NOTABUG QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: arubin, dpal, jgalipea, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
With netgroups, when adding a host as a member that Identity Management does not have stored as a host already, it is considered to be an external host. This host can be controlled with netgroups, but Identity Management has no knowledge of it. Currently, there is no way to use the netgroup-find option to search for external hosts. Also, note that when host is added to a netgroup as an external host, rather than as an external host in Identity Management, that host is not automatically converted within the netgroup rule.
Story Points: ---
Clone Of:
: 796244 819998 (view as bug list) Environment:
Last Closed: 2012-05-10 17:11:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 796244, 819998    

Description Scott Poore 2012-02-17 20:36:02 UTC
Description of problem:

Not getting any results using --hosts with netgroup-find.

# ipa netgroup-add mytestng --desc=my_test_netgroup
-------------------------
Added netgroup "mytestng"
-------------------------
  Netgroup name: mytestng
  Description: my_test_netgroup
  NIS domain name: testrelm.com
  IPA unique ID: 4f73e57a-59a5-11e1-915e-525400c37d65

# ipa netgroup-add-member mytestng --hosts=mytesthostname
  Netgroup name: mytestng
  Description: my_test_netgroup
  NIS domain name: testrelm.com
  External host: mytesthostname
-------------------------
Number of members added 1
-------------------------

# ipa netgroup-find mytestng
------------------
1 netgroup matched
------------------
  Netgroup name: mytestng
  Description: my_test_netgroup
  NIS domain name: testrelm.com
  External host: mytesthostname
----------------------------
Number of entries returned 1
----------------------------

# ipa netgroup-find --hosts=mytesthostname
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------


Version-Release number of selected component (if applicable):
389-ds-base-1.2.10.1-1.el6.x86_64
389-ds-base-libs-1.2.10.1-1.el6.x86_64
ipa-server-2.2.0-101.20120216T0856zgitc8cdb75.el6.x86_64


How reproducible:
always?

Steps to Reproduce:
1.  <setup IPA server>
2.  kinit admin
3.  ipa netgroup-add mytestng --desc=my_test_netgroup
4.  ipa netgroup-add-member mytestng --hosts=mytesthostname
5.  ipa netgroup-find mytestng
6.  ipa netgroup-find --hosts=mytesthostname

Actual results:

last find shows this:

# ipa netgroup-find --hosts=mytesthostname
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------

Expected results:

I would have expected it to return the same results from Step 5 above:

# ipa netgroup-find mytestng
------------------
1 netgroup matched
------------------
  Netgroup name: mytestng
  Description: my_test_netgroup
  NIS domain name: testrelm.com
  External host: mytesthostname
----------------------------
Number of entries returned 1
----------------------------

Additional info:

/var/log/httpd/error_log entries from test:

[Fri Feb 17 14:23:53 2012] [error] ipa: INFO: admin: netgroup_add(u'mytestng', description=u'my_test_netgroup', all=False, raw=False, version=u'2.26'): SUCCESS

[Fri Feb 17 14:25:29 2012] [error] ipa: INFO: admin: netgroup_add_member(u'mytestng', all=False, raw=False, version=u'2.26', host=(u'mytesthostname',)): SUCCESS

[Fri Feb 17 14:25:39 2012] [error] ipa: INFO: admin: netgroup_find(u'mytestng', private=False, managed=False, all=False, raw=False, version=u'2.26', pkey_only=False): SUCCESS

[Fri Feb 17 14:25:50 2012] [error] ipa: INFO: admin: netgroup_find(None, private=False, managed=False, all=False, raw=False, version=u'2.26', pkey_only=False, host=(u'mytesthostname',)): SUCCESS

Comment 1 Rob Crittenden 2012-02-17 20:39:18 UTC
Ah, you're searching for external hosts. That makes a difference.

We don't currently search that. If you add an IPA host you should be able to search on that.

Comment 3 Dmitri Pal 2012-02-22 14:54:09 UTC
We need to add a tech note in 6.3. The proper fix will be delivered later.

Comment 4 Rob Crittenden 2012-04-13 19:49:02 UTC
With netgroups if you add a host as a member that IPA does not have stored as a host already it is considered to be an external host. This is a host you want to control with netgroups but IPA doesn't need to know about.

There is not a way to use netgroup-find to search for external hosts.

Note too that if a host is added to a netgroup as an external, then as a host in IPA, it is not automatically converted within the netgroup rule.

Comment 5 Martin Prpič 2012-04-15 13:06:42 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
With netgroups, when adding a host as a member that Identity Management does not have stored as a host already, it is considered to be an external host. This host can be controlled with netgroups, but Identity Management has no knowledge of it. Currently, there is no way to use the netgroup-find option to search for external hosts.
    Also, note that when host is added to a netgroup as an external host, rather than as an external host in Identity Management, that host is not automatically converted within the netgroup rule.

Comment 6 Scott Poore 2012-04-20 00:00:01 UTC
So an ldapsearch like the following is the only way to find netgroups containing external hosts in the triples?

ldapsearch -x -D "$ROOTDN" -w "$ROOTDNPWD" -b "cn=ng,cn=compat,$BASEDN" "nisNetgroupTriple=*test2.example.com*"

Does it make sense to look at this as an RFE for a new option to netgroup-find for --externalhosts maybe?