Issue #14454 has been updated by Joe Julian.

Changing the last line of the groups function in Puppet::Provider::NameService 
to
 groups.uniq.join(",")
does at least prevent usermod from trying to change the groups if the user is 
already in those groups.
----------------------------------------
Bug #14454: User group membership cannot be managed if nss uses any data 
sources beyond "files"
https://projects.puppetlabs.com/issues/14454#change-62755

Author: Joe Julian
Status: Unreviewed
Priority: Normal
Assignee: 
Category: user
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


Using this resource definition:
    user { 'root':
        ensure           => 'present',
        comment          => 'root',
        gid              => '0',
        groups           => ['bin', 'daemon', 'sys', 'adm', 'disk', 'wheel'],
        home             => '/root',
        password         => '$1$CGNOIogj$cRaZjrS0Bv1dmwJ0m.kkI.',
        password_max_age => '99999',
        password_min_age => '0',
        shell            => '/bin/bash',
        uid              => '0',
    }

This should mean that at a minimum, root it a member of the listed groups.

On some of our end-user facing machines, we add ldap authentication in 
nsswitch.conf. This results in getgrent returning this list of groups:
    ["daemon", "sys", "adm", "disk", "wheel", "bin", "daemon", "sys", "adm", 
"disk", "wheel", "Domain Admins", "Administrators", "app"]

Now this list does contain the required groups, so my expectation would be that 
nothing happens.

Instead, this list is tested against /\s+/ and an error is produced because 
there's a space in "Domain Admins" (useradd.rb line 18). 

If we *were* making changes, instead of erroring it should either wrap the 
group in quotes, or backquote the space(s). For instance, if I changed the 
groups to ['bin', 'daemon', 'sys', 'adm', 'disk', 'wheel', 'mail'] so it would 
need to add 'mail', it's going to error out because of Domain Admins.

If I remove that check, it's going to fail because of the space. If I call 
usermod -G manually with the complete list, having Domain Admins quoted, it 
works to change the "files" group memberships (adding "mail" in my example). It 
does not, of course, do anything for ldap group memberships.

The nss library calls are obviously insufficient to make this work correctly. 
There's no way to know what the source is for the group, and groups can be 
duplicated between nss data sources.





-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to