<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23580"></HEAD>
<BODY>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>Hi 
folks,</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>Struggling with 
creating a sudo rule in IPA that will allow my foreman-proxy to run specific 
commands.  When I put the following into 
/etc/sudoers.d/foreman:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN 
class=768303609-04082015>[root@puppet01 ~]# cat 
/etc/sudoers.d/foreman<BR>foreman-proxy ALL = NOPASSWD: /usr/bin/puppet cert *, 
/usr/bin/puppet kick *<BR>Defaults:foreman-proxy !requiretty<BR>innesd ALL = 
NOPASSWD: /usr/bin/puppet cert *, /usr/bin/puppet kick *<BR>Defaults:innesd 
!requiretty<BR>[root@puppet01 ~]#</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015><BR><FONT 
face="Courier New">[innesd@puppet01 ~]$ sudo -l<BR>Matching Defaults entries for 
innesd on this host:<BR>    
!requiretty</FONT></SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=768303609-04082015>User innesd 
may run the following commands on this host:<BR>    (root) 
NOPASSWD: /usr/bin/puppet cert *, (root) /usr/bin/puppet kick 
*<BR>    (root) /bin/su<BR>[innesd@puppet01 
~]$<BR></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>Both my user and the 
foreman-proxy can run the relevant commands both on the command line and 
remotely.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>IT Security are not 
happy with local sudo rules being condifured around the network, so I'm trying 
to create the same configuration via IPA.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>When I try to get 
the same rule into IPA, my user can run the command in a tty, but the 
foreman-proxy user is refused.  This looks to be down to the lack of 
!requiretty coming through for the users:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=768303609-04082015>[root@ipa01 
~]# ipa sudorule-show foreman-proxy<BR>  Rule name: foreman-proxy<BR>  
Enabled: TRUE<BR>  User category: all<BR>  Hosts: 
puppet02.example.com, 
puppet01.example.com,<BR>         
puppet03.example.com, puppet04.example.com</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=768303609-04082015>  Sudo 
Allow Commands: /usr/bin/puppet cert *, /usr/bin/puppet kick *<BR>  Sudo 
Option: !authenticate, !requiretty<BR>[root@ipa01 ~]#<BR></DIV></SPAN></FONT>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>and once I've 
removed the #includedir option from my local sudoers file, I get the following 
as my user:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN 
class=768303609-04082015>[innesd@puppet01 ~]$ sudo -l<BR>User innesd may run the 
following commands on this host:<BR>    (root) 
/bin/su<BR>    (root) NOPASSWD: /usr/bin/puppet cert *, 
/usr/bin/puppet kick *<BR>[innesd@puppet01 ~]$<BR></SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>where the noticeable 
difference is that the !requiretty isn't listed under any "Matching Defaults 
entries" for my user.  With the rule set up like this, I can run the 
command in a tty, but the foreman-proxy user is denied when the command is run 
without a tty.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>How do I go about 
setting the Defaults for the foreman-proxy user?  Once my testing is done, 
I'd like to move the rule to run only against the foreman-proxy external user 
rather than all users.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>And a small 
follow-up question: how long should I expect it to take for a change to the sudo 
rule on my IPA server to become available on the client?  I keep doing 
sss_cache -E to clear the cache, but it still seems to take it's own sweet time 
to be changed on the client.  It's not a huge wait - just a bit of a pain 
when I'm testing these changes.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>Thanks in 
advance,</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN 
class=768303609-04082015></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=768303609-04082015>Duncan 
Innes</DIV></SPAN></FONT><br clear="both">
This message has been checked for viruses and spam by the Virgin Money email scanning system powered by Messagelabs.<BR>
<BR>
This e-mail is intended to be confidential to the recipient. If you receive a copy in error, please inform the sender and then delete this message.<BR>
<BR>
Virgin Money plc - Registered in England and Wales (Company no. 6952311). Registered office - Jubilee House, Gosforth, Newcastle upon Tyne NE3 4PL. Virgin Money plc is authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority.<BR>
<BR>
The following companies also trade as Virgin Money. They are both authorised and regulated by the Financial Conduct Authority, are registered in England and Wales and have their registered office at Jubilee House, Gosforth, Newcastle upon Tyne NE3 4PL: Virgin Money Personal Financial Service Limited (Company no. 3072766) and Virgin Money Unit Trust Managers Limited (Company no. 3000482).<BR>
<BR>
For further details of Virgin Money group companies please visit our website at virginmoney.com<BR>
</BODY></HTML>