<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 22, 2018 at 5:27 AM, Cédric Jeanneret <span dir="ltr"><<a href="mailto:cjeanner@redhat.com" target="_blank">cjeanner@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 05/21/2018 03:49 PM, Luke Hinds wrote:<br>
> A few operators have requested if its possible to limit sudo's coverage<br>
> on both the under / overcloud. There is concern over `ALL=(ALL)<br>
> NOPASSWD:ALL` , which allows someone to  `sudo su`.<br>
> <br>
> This task has come under the care of the tripleo security squad.<br>
> <br>
> The work is being tracked and discussed here [0].<br>
> <br>
> So far it looks like the approach will be to use regexp within<br>
> /etc/sudoers.d/*., to narrow down as close as possible to the specific<br>
> commands called. Some services already do this with rootwrap:<br>
> <br>
> ironic ALL = (root) NOPASSWD: /usr/bin/ironic-rootwrap<br>
> /etc/ironic/rootwrap.conf *   <br>
> <br>
> It's fairly easy to pick up a list of all sudo calls using a simple<br>
> script [1]<br>
> <br>
> The other prolific user of sudo is ansible / stack, for example:<br>
> <br>
> /bin/sh -c echo BECOME-SUCCESS-<wbr>kldpbeueyodisjajjqthpafzadrncd<wbr>ff;<br>
> /usr/bin/python<br>
> /home/stack/.ansible/tmp/<wbr>ansible-tmp-1526579105.0-<wbr>109863952786117/systemd.py;<br>
> rm -rf<br>
> "/home/stack/.ansible/tmp/<wbr>ansible-tmp-1526579105.0-<wbr>109863952786117/" ><br>
> /dev/null 2>&1<br>
> <br>
> My feelings here are to again use regexp around the immutable non random<br>
> parts of the command.  cjeanner also made some suggestions in the<br>
> etherpad [0].<br>
<br>
</span>Might be a temporary way to limit the surface indeed, but an upstream<br>
change in Ansible would still be really nice. Predictable names is the<br>
only "right" way, although this will create a long sudo ruleset. A<br>
really long one to be honnest. Maintainability is also to be discussed<br>
in either way (maintain a couple of regexp vs 200+ rules.. hmmm).<br>
<span class=""><br></span></blockquote><div><br></div><div>As I understand it, the problem with predicable names is they also become predictable to attackers (this would be the reason ansible adds in the random string). It helps prevent someone creating a race condition to replace the python script with something more nefarious. Its the same reason commands such as mktemp exists.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> <br>
> However aside to the approach, we need to consider the impact locking<br>
> down might have should someone create a develop a new bit of code that<br>
> leverages commands wrapped in sudo and assumes ALL with be in place.<br>
> This of course will be blocked.<br>
<br>
</span>This will indeed require some doc, as this is a "major" change. However,<br>
the use of regexp should somewhat limit the impact, especially since<br>
Ansible pushes its exec script in the same location.<br>
Even new parts should be allowed (that might be a bit of concern if we<br>
want to really dig in the consequences of a bad template being injected<br>
in some way [looking config-download ;)]).<br>
But at some point, we might also decide to let the OPs ensure their<br>
infra isn't compromised.<br>
Always the same thread-of with Security vs The World - convenience vs<br>
cumbersome management, and so on.<br>
<div class="HOEnZb"><div class="h5"><br>
> <br>
> Now my guess is that our CI would capture this as the deploy would<br>
> fail(?) and the developer should work out an entry is needed when<br>
> testing their patch, but wanted to open this up to others who know<br>
> testing at gate better much better than myself.  Also encourage any<br>
> thoughts on the topic to be introduced to the etherpad [0]<br>
> <br>
> [0] <a href="https://etherpad.openstack.org/p/tripleo-heat-admin-security" rel="noreferrer" target="_blank">https://etherpad.openstack.<wbr>org/p/tripleo-heat-admin-<wbr>security</a><br>
> [1] <a href="https://gist.github.com/lukehinds/4cdb1bf4de526a049c51f05698b8b04f" rel="noreferrer" target="_blank">https://gist.github.com/<wbr>lukehinds/<wbr>4cdb1bf4de526a049c51f05698b8b0<wbr>4f</a><br>
> <br>
> -- <br>
> Luke Hinds<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">-- <br>
Cédric Jeanneret<br>
Software Engineer<br>
DFG:DF<br>
<br>
</font></span><br>______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="font-size:12.8px">Luke Hinds | NFV Partner Engineering | CTO Office | Red Hat</span><br style="font-size:12.8px"><span style="font-size:12.8px">e: </span><a href="mailto:lhinds@redhat.com" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">lhinds@redhat.com</a><span style="font-size:12.8px"> | irc: lhinds @freenode |</span><span style="font-size:12.8px"> t: </span>+44 12 52 36 2483<br style="font-size:12.8px"></div></div></div></div></div></div>
</div></div>