Apologies for the cross-post, the catalyst for the change was discussed on the RedHat list, but I figured the SourceForge one is the authoritative upstream list.<div><br></div><div>Background:</div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; "><p>
Our netgroups look like:</p><p></p></span></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="font-family: arial, sans-serif; ">login_<a href="http://samplehost.example.com" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); ">samplehost.example.com</a> (-, apollock, )</span></blockquote>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; "><p></p><p>Our access.conf looks like:</p></span></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<span class="Apple-style-span" style="font-family: arial, sans-serif; ">+:root:ALL</span><br><span class="Apple-style-span" style="font-family: arial, sans-serif; ">+:@login_samplehost.example.com:ALL</span><br><span class="Apple-style-span" style="font-family: arial, sans-serif; ">-:ALL:ALL</span></blockquote>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; "><p>To be clear, we have per-host netgroups.</p><p></p><p>As of the change made in <a href="http://pam.cvs.sourceforge.net/viewvc/pam/Linux-PAM/modules/pam_access/pam_access.c?view=diff&pathrev=Linux-PAM-1_0_90&r1=1.29&r2=1.30" target="_blank" style="font-family: arial, sans-serif; color: rgb(102, 77, 159); ">http://pam.cvs.sourceforge.net/viewvc/pam/Linux-PAM/modules/pam_access/pam_access.c?view=diff&pathrev=Linux-PAM-1_0_90&r1=1.29&r2=1.30</a></p>
<p></p><p></p><p></p><p>Significant line change (pam_access.c) (lines 512-516):</p><p></p><p></p></span></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="font-family: arial, sans-serif; "><span style="background-color: rgb(255, 255, 255); font-family: sans-serif; ">return (netgroup_match (pamh, tok + 1, </span><span style="background-color: rgb(255, 229, 0); font-family: sans-serif; ">(char *) 0</span><span style="background-color: rgb(255, 255, 255); font-family: sans-serif; ">, string, item->debug));</span></span><br>
<span class="Apple-style-span" style="font-family: arial, sans-serif; "><span style="background-color: rgb(255, 255, 255); font-family: sans-serif; ">return (netgroup_match (pamh, tok + 1, </span><span style="background-color: rgb(255, 229, 0); font-family: sans-serif; ">item->hostname</span><span style="background-color: rgb(255, 255, 255); font-family: sans-serif; ">, string, item->debug));<span class="__wave_paste"></span><span> </span></span></span></blockquote>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; "><p>pam_access now wants the netgroup to look like</p><p></p></span></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<span class="Apple-style-span" style="font-family: arial, sans-serif; ">login_<a href="http://samplehost.example.com" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); ">samplehost.example.com</a> (, apollock, )</span></blockquote>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; "><p><span class="__wave_paste"></span>or our use case fails.</p><p></p><p>Apparently this change was made based on a user request - <a href="http://www.redhat.com/archives/pam-list/2008-April/msg00032.html" target="_blank" style="font-family: arial, sans-serif; color: rgb(102, 77, 159); ">http://www.redhat.com/archives/pam-list/2008-April/msg00032.html</a> because this user seemed to want to have a single netgroup for all hosts that arbitrated access, based on the user and host components of the netgroup triple.</p>
<p>That said, trying to mix users and hosts is incorrect use of a netgroup. <a href="http://docs.sun.com/app/docs/doc/806-1387/6jam692ck?a=view" target="_blank" style="font-family: arial, sans-serif; color: rgb(102, 77, 159); ">http://docs.sun.com/app/docs/doc/806-1387/6jam692ck?a=view</a> states that</p>
<p></p><p><span style="font-family: Monaco, Courier, 'Courier New', monospace; color: rgb(102, 102, 102); ">admins (altair, hauri), (sirius,juanita,sales)</span></p><p><span style="font-family: sans-serif; ">is the equivalent of</span></p>
<p><span style="font-family: Monaco, Courier, 'Courier New', monospace; color: rgb(102, 102, 102); ">admins (altair,-), (sirius,-), (-,hauri), (-,juanita,sales)</span></p><p><span style="font-family: sans-serif; ">so it comes down to what you're querying a netgroup for, users or hosts. Trying to mix the two will give undesired results.</span></p>
<p><span style="font-family: sans-serif; "><span class="Apple-style-span" style="font-family: arial, sans-serif; "><a href="http://docs.sun.com/app/docs/doc/816-5174/netgroup-4?l=en&a=view&q=netgroup" target="_blank" style="font-family: sans-serif; color: rgb(102, 77, 159); ">http://docs.sun.com/app/docs/doc/816-5174/netgroup-4?l=en&a=view&q=netgroup</a> says:</span></span></p>
<p></p><p></p><p></p></span></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; color: rgb(51, 51, 51); ">Because the "-" character will not match any specific username or hostname, it is commonly used as a placeholder that will match only wildcarded membership queries. So, for example:</span><br>
<span class="Apple-style-span" style="font-family: Monaco, Courier, 'Courier New', monospace; color: rgb(102, 102, 102); ">onlyhosts (host1,-,our.domain) (host2,-,our.domain)</span><br><span class="Apple-style-span" style="font-family: Monaco, Courier, 'Courier New', monospace; color: rgb(102, 102, 102); ">onlyusers (-,john,our.domain) (-,linda,our.domain)</span><br>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; color: rgb(51, 51, 51); ">effectively define netgroups containing only hosts and only users, respectively. Any other string that is guaranteed not to be a legal username or hostname will also suffice for this purpose.</span><br>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; color: rgb(51, 51, 51); ">Use of placeholders will improve search performance.</span></blockquote>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; "><p></p><p></p><p><span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; color: rgb(51, 51, 51); "></span></p>
<p></p><p><span class="__wave_paste"></span><span><a href="http://www.softpanorama.org/Net/Application_layer/NIS/nis_netgroups.shtml" target="_blank" style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; color: rgb(51, 51, 51); ">http://www.softpanorama.org/Net/Application_layer/NIS/nis_netgroups.shtml</a> also says:</span></p>
<p></p><p><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">Though netgroup pairs (or triples) group together hostnames, usernames and domainnames, nothing really reads them in that manner. They exist only in NIS maps. The file </font></span><span style="color: rgb(51, 51, 51); font-weight: bold; "><font class="Apple-style-span" face="arial, helvetica, sans-serif">/etc/netgroup </font></span><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">only exists in order to be your 'flat' source file.</font></span></p>
<p></p><p><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">It is important to understand that there is no necessary relationship between the machine and user elements in an entry and such definitions usually should be split into two: one for users and one for servers. </font></span><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">admins (-,john), (-,nick)</font></span><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">It is possible to omit dash and use just leading comma. But if this netgroup were ever accidentally included in a list of hosts rather than users, the blank space would be interpreted as a wildcard meaning any host. For example, if someone used this netgroup in a </font></span><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">-access</font></span><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif"> list in the </font></span><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">/etc/exports</font></span><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif"> file, any host would have access to the exported directory. For this reason, if a netgroup is used strictly as a list of users, you should always put a dash in the host field, as in example above.</font></span></p>
<p></p><p><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">The following netgroup will not do what you expect:</font></span></p><p><span style="color: rgb(51, 51, 51); background-color: rgb(249, 249, 249); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">bogus-group (machine1,user1), (machine2,user2) # not what you might think !!!</font></span></p>
<p><span style="color: rgb(51, 51, 51); "><font class="Apple-style-span" face="arial, helvetica, sans-serif">You might think this means user1 at machine1 and user2 at machine2, but in actuality, it is a netgroup that defines either two users (user1 and user2) if used in place were configuration file expects users or two machines (machine1 and machine2) is uses when particular configuration file expects list of hosts.</font></span></p>
<p><font class="Apple-style-span" color="#333333" face="arial, helvetica, sans-serif"><br></font></p><p><font class="Apple-style-span" color="#333333" face="arial, helvetica, sans-serif">So I'm going to file a bug about this, but I wanted to provide the full background here for discussion also.</font></p>
<p><font class="Apple-style-span" color="#333333" face="arial, helvetica, sans-serif">regards</font></p><p><font class="Apple-style-span" color="#333333" face="arial, helvetica, sans-serif">Andrew</font></p><p></p><p></p>
</span></div>