Bug 1111121

Summary: [RFE] ipa-client-install should configure sudo automatically
Product: Red Hat Enterprise Linux 6 Reporter: Martin Kosek <mkosek>
Component: ipaAssignee: Martin Kosek <mkosek>
Status: CLOSED ERRATA QA Contact: Namita Soman <nsoman>
Severity: medium Docs Contact:
Priority: high    
Version: 6.6CC: ksiddiqu, mkosek, mnavrati, rcritten, salmy, tbabej
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-3.0.0-40.el6 Doc Type: Release Note
Doc Text:
⁠Automated sudo Configuration on IPA Clients In Red Hat Enterprise Linux 6.6, the ipa-client-install script configures the sudo utility on IPA clients by default. FreeIPA sudo integration is a widely popular feature, which can, however, pose some configuration challenges. The integration is now seamless, and ipa-client-install leverages a newly added IPA provider in sssd.
Story Points: ---
Clone Of: 924395 Environment:
Last Closed: 2014-10-14 07:32:57 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:
Bug Depends On: 924395    
Bug Blocks: 1036628    
Attachments:
Description Flags
snip from automation log none

Comment 3 Martin Kosek 2014-06-20 13:45:51 UTC
Small demonstration of the feature:

# hostname
vm-086.idm.lab.bos.redhat.com
# ipa-server-install

# nisdomainname <--- NIS domain name is set, required for hosgroup based SUDO rules
idm.lab.bos.redhat.com

# tail /etc/nsswitch.conf
...
sudoers: files sss   <--- sudoers is set to sssd

# grep services /etc/sssd/sssd.conf
services = nss, sudo, pam, ssh   <--- sudo is an enabled service

Now we add SUDO rule targetted on a hostgroup containing vm-086.idm.lab.bos.redhat.com and user admin:

# kinit admin
# ipa hostgroup-add foo
# ipa hostgroup-add-member foo --hosts `hostname`
# ipa sudocmd-add /usr/bin/less
# ipa sudorule-add foo
# ipa sudorule-add-user foo --users admin
# ipa sudorule-add-host foo --hostgroups foo
# ipa sudorule-add-allow-command foo --sudocmds /usr/bin/less

# ipa sudorule-show foo
  Rule name: foo
  Enabled: TRUE
  Users: admin
  Host Groups: foo
  Sudo Allow Commands: /usr/bin/less

Now we can try if sudo can read this rule through SSSD when we log as admin:

# su - admin
$ sudo -l
Matching Defaults entries for admin on this host:
    requiretty, !visiblepw, always_set_home, env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE
    INPUTRC KDEDIR LS_COLORS", env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE",
    env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES", env_keep+="LC_MONETARY LC_NAME
    LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET
    XAUTHORITY", secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User admin may run the following commands on this host:
    (root) /usr/bin/less

$ sudo /usr/bin/less /etc/shadow
[sudo] password for admin: 

<--- opens the file

Comment 4 Kaleem 2014-07-15 08:07:46 UTC
Verified.

IPA version:
============
ipa-server.x86_64 0:3.0.0-42.el6

Please find the attached snip from beaker automation log.

Comment 5 Kaleem 2014-07-15 08:08:10 UTC
Created attachment 918075 [details]
snip from automation log

Comment 7 errata-xmlrpc 2014-10-14 07:32:57 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.

http://rhn.redhat.com/errata/RHBA-2014-1383.html