<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 5, 2018 at 3:44 PM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello guys!<br>
<br>
I'm currently working on python-tripleoclient in order to squash the<br>
dreadful "NOPASSWD:ALL" allowed to the "stack" user.<br>
<br>
The start was an issue with the rights on some files being wrong (owner<br>
by root instead of stack, in stack home). After some digging and poking,<br>
it appears the undercloud deployment is called with a "sudo openstack<br>
tripleo deploy" command - this, of course, creates some major issues<br>
regarding both security and right management.<br>
<br>
I see a couple of ways to correct that bad situation:<br>
- let the global "sudo" call, and play with setuid/setgid when we<br>
actually don't need the root access (as it's mentioned in this comment¹)<br>
<br>
- drop that global sudo call, and replace all the necessary calls by<br>
some "sudo" when needed. This involves the replacement of native python<br>
code, like "os.mkdir" and the like.<br>
<br>
The first one isn't a solution - code maintenance will not be possible,<br>
having to thing "darn, os.setuid() before calling that, because I don't<br>
need root" is the current way, and it just doesn't apply.<br>
<br>
So I started the second one. It's, of course, longer, not really nice<br>
and painful, but at least this will end to a good status, and not so bad<br>
solution.<br>
<br>
This also meets the current work of the Security Squad about "limiting<br>
sudo rights and accesses".<br>
<br>
For now I don't have a proper patch to show, but it will most probably<br>
appear shortly, as a Work In Progress (I don't think it will be<br>
mergeable before some time, due to all the constraints we have regarding<br>
version portability, new sudoer integration and so on).<br>
<br>
I'll post the relevant review link as an answer of this thread when I<br>
have something I can show.<br>
<br>
Cheers,<br>
<br>
C.<br>
<br></blockquote><div><br></div><div>Hi Cédric,</div><div><br></div><div>Pleased to hear you are willing to take this on. <br></div><div><br></div><div>It makes sense we should co-ordinate efforts here as I have been looking at the same item, but planned to start with heat-admin over on the overcloud.</div><div><br></div><div>Due to the complexity / level of coverage in the use of sudo, it makes sense to have a spec where we can then get community consensus on the approach selected. This is important as it looks like we will need to have some sort of white list to maintain and make considerations around functional test coverage in CI (in case someone writes something new wrapped in sudo).</div><div><br></div><div>In regards to your suggested positions within python code such as the client, its worth looking at oslo.privsep [1] where a decorator can be used for when needing to setuid.</div><div><br></div><div>Let's discuss this also in the squad meeting tomorrow and try to synergize approach for all tripleo nix accounts.</div><div><br></div><div>[1] <a href="https://github.com/openstack/oslo.privsep">https://github.com/openstack/oslo.privsep</a><br></div><div><br></div><div>Cheers,</div><div><br></div><div>Luke</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
¹<br>
<a href="https://github.com/openstack/python-tripleoclient/blob/master/tripleoclient/v1/tripleo_deploy.py#L827-L829" rel="noreferrer" target="_blank">https://github.com/openstack/<wbr>python-tripleoclient/blob/<wbr>master/tripleoclient/v1/<wbr>tripleo_deploy.py#L827-L829</a><br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
-- <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-de</a></blockquote></div></div></div>