<div dir="ltr"><div dir="ltr"><div dir="ltr">On Tue, Apr 2, 2019 at 5:06 AM Ben Nemec <<a href="mailto:openstack@nemebean.com">openstack@nemebean.com</a>> wrote:</div><div dir="ltr"><br></div><div>[snip]</div><div dir="ltr"><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This matches my understanding of the intent behind privsep. Instead of <br>
trying to figure out how to filter out dangerous paths or whatever, you <br>
have the privileged code build the path out of sanitized data passed in. <br>
You still have to be careful about preventing injection attacks (say I <br>
pass in [uuid]/../../..), but at least you don't have to try to write a <br>
rootwrap filter for every possible path in every possible driver. The <br>
privileged driver code itself knows the correct path and won't allow <br>
anything else.<br></blockquote><div><br></div><div>I don't think anyone disputes that theory.</div><div><br></div><div>The issue here is that the calling code in nova makes that very hard in some cases. For example, nova.privsep.path.readfile exists because it is called by nova.virt.disk.localfs.read_file [1], which takes a raw path to read. That is in turn used by calling code to read at least two paths that are generated in calling code. Now all of that is fixable, and that's a relatively simple example, but it requires a call by call analysis that is quite expensive to do and will cause a lot of code churn to fix.</div><div><br></div><div>No one is saying we shouldn't do it. However, the current privsep code took the approach of an incremental improvement on top of what we already had, instead of attempting to boil the ocean in a single patch series. The code for nova.virt.disk.localfs.read_file used to call a method called read_file_as_root that was just as bad as what we have now, but used rootwrap to cat arbitrary files in the filesystem (git sha f535e8bb9905b5632416135af5789704db6d2867 is the original transition).</div><div><br></div><div>My point is that we need to start somewhere, and proposing that we abandon privsep entirely because its not immediately perfect isn't very helpful.</div><div><br></div><div>Michael</div><div><br></div><div>1: Well, there is one other caller, but you get the idea.</div></div></div></div>