<div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 20, 2012 at 10:53 AM, James Hunt <span dir="ltr"><<a href="mailto:james.hunt@ubuntu.com" target="_blank">james.hunt@ubuntu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Evan,<br>
<div class="im"><br>
On 20/11/12 13:58, Evan Huus wrote:<br>
> Hi James,<br>
><br>
> I've only scanned it briefly at this point, but I have one question regarding<br>
> security. At the moment the spec. states that system events will by default be<br>
> available to user sessions as well, but I think this is overly permissive. While<br>
> I can't actually think of a current system event that really must be hidden, I<br>
> feel that on principle system events should not be visible to user sessions<br>
> unless explicitly marked as such.<br>
><br>
> I would suggest a change to the new event syntax such that<br>
><br>
> - foo and ::foo are always equivalent, and emit an event only visible within the<br>
> current upstart namespace (system or user)<br>
> - :sys:foo and :user:foo are unchanged<br>
> - :all:foo (or :global:foo or :public:foo) emits an event visible to other<br>
> upstart namespaces as well<br>
<br>
</div>This would mean user jobs would not be able to react to system job events. That<br>
in itself might not be a problem [1], but it would also mean that user jobs have<br>
no access to system events (by default) that don't relate to jobs. I think this<br>
_is_ potentially more of an issue. My canonical example is being able to plug a<br>
USB headset in, and have a user job react to the udev event and start an<br>
application of my choice. This currently works if user jobs are enabled in<br>
Ubuntu and is a useful feature. If we did implement ':all:', we could change the<br>
upstart-udev-bridge to ensure it emits events to ':all:', but we're then back to<br>
the concern over permissiveness and it feels wrong to special-case one<br>
particular event source.<br></blockquote><div> <br>I don't think this is a bad solution - users need access to device events (and effectively already have them anyways) so it makes sense for upstart-udev-bridge to emit public events. It's just a question whether it does so explicitly or implicitly.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So, if we do 'hide' system events from user jobs by default, we would be<br>
breaking the current publish-subscribe behaviour. That's not to say we won't<br>
consider doing this [2], but we are striving to retain current behaviour so I'd<br>
like to understand better what the potential 'attack vector' might be with some<br>
real world examples.<br>
<br>
I think this needs to be explored further. Can anyone think of scenarios where<br>
user jobs should not be privy to system events?<br></blockquote><div><br>The case that originally came to mind was some sort of system audit or scan. If my system does an anti-virus scan, I don't want potential userspace malware to receive a nice convenient event notification that they should quiesce until the scan is finished (and then another notification to wake back up again once the scan completes).<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Note that Upstart is happy to run system jobs whose configuration files have<br>
perms 0400 and the /var/log/upstart/* files are not readable by normal users, so<br>
AFAICS, the risk is probably limited to users being able to 'sniff' system event<br>
environment variables. This is only a problem if an admin creates a job where<br>
they specify sensitive information in one of those variables. However, I have<br>
personally never seen such a job and is kind of analogous to an admin doing<br>
something inappropriate such as 'sudo chmod 777 /etc/shadow'.<br></blockquote><div> <br>This feels kind of hacky, but perhaps we should only publish system job events to users that have read access on the job file in question?<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
><br>
> Thoughts?<br>
><br>
> Cheers,<br>
> Evan<br>
><br>
><br>
> On Tue, Nov 20, 2012 at 5:09 AM, James Hunt <<a href="mailto:james.hunt@ubuntu.com">james.hunt@ubuntu.com</a><br>
</div><div><div class="h5">> <mailto:<a href="mailto:james.hunt@ubuntu.com">james.hunt@ubuntu.com</a>>> wrote:<br>
><br>
> Here is the draft plan for 'Enhanced Upstart User Sessions' ([1]), which will be<br>
> used to supervise desktop sessions in Ubuntu:<br>
><br>
> <a href="https://wiki.ubuntu.com/FoundationsTeam/Specs/RaringUpstartUserSessions" target="_blank">https://wiki.ubuntu.com/FoundationsTeam/Specs/RaringUpstartUserSessions</a><br>
><br>
> = Summary =<br>
><br>
> Allow Upstart to run as a non-privileged user to supervise a session in an<br>
> event-based manner.<br>
><br>
> This brings many advantages including:<br>
><br>
> - more dynamic and efficient session startup (desktop services only get started<br>
> *when required*).<br>
> - reliable session shutdown.<br>
> - automatic job output logging.<br>
> - more efficient use of system resources (helping to maximise battery life for<br>
> example).<br>
><br>
> Comments Welcome. If you would like to get involved in this project, please let<br>
> me know.<br>
><br>
> Kind regards,<br>
><br>
> James.<br>
><br>
> [1] -<br>
> <a href="https://blueprints.launchpad.net/ubuntu/+spec/foundations-r-upstart-user-session-enhancements" target="_blank">https://blueprints.launchpad.net/ubuntu/+spec/foundations-r-upstart-user-session-enhancements</a><br>
> --<br>
> James Hunt<br>
> ____________________________________<br>
> <a href="http://upstart.ubuntu.com/cookbook" target="_blank">http://upstart.ubuntu.com/cookbook</a><br>
> <a href="http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf" target="_blank">http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf</a><br>
><br>
> --<br>
> upstart-devel mailing list<br>
</div></div>> <a href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a> <mailto:<a href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a>><br>
<div class="im">> Modify settings or unsubscribe at:<br>
> <a href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
><br>
><br>
<br>
</div>Kind regards,<br>
<br>
James.<br>
<br>
[1] - Its unclear what use-cases there are for user jobs reacting to system<br>
_jobs_, so if you have some, please let us know. To lend weight to this, there<br>
is also the issue that even if user jobs can access system job events, they can<br>
only see those events that occur after their Session Init has started. See<br>
section 'Outstanding Issues' in the spec and bug 1065965.<br></blockquote><div><br>I don't have any use cases for user jobs reacting to system jobs which is why I figured they don't need to be exposed.<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
[2] - Since I don't think user jobs are widely used, and are in fact currently<br>
disabled in Ubuntu.<br></blockquote><div> <br>I certainly have never bothered to set them up.<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 20, 2012 at 10:53 AM, James Hunt <span dir="ltr"><<a href="mailto:james.hunt@ubuntu.com" target="_blank">james.hunt@ubuntu.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Evan,<br>
<div class="im"><br>
On 20/11/12 13:58, Evan Huus wrote:<br>
> Hi James,<br>
><br>
> I've only scanned it briefly at this point, but I have one question regarding<br>
> security. At the moment the spec. states that system events will by default be<br>
> available to user sessions as well, but I think this is overly permissive. While<br>
> I can't actually think of a current system event that really must be hidden, I<br>
> feel that on principle system events should not be visible to user sessions<br>
> unless explicitly marked as such.<br>
><br>
> I would suggest a change to the new event syntax such that<br>
><br>
> - foo and ::foo are always equivalent, and emit an event only visible within the<br>
> current upstart namespace (system or user)<br>
> - :sys:foo and :user:foo are unchanged<br>
> - :all:foo (or :global:foo or :public:foo) emits an event visible to other<br>
> upstart namespaces as well<br>
<br>
</div>This would mean user jobs would not be able to react to system job events. That<br>
in itself might not be a problem [1], but it would also mean that user jobs have<br>
no access to system events (by default) that don't relate to jobs. I think this<br>
_is_ potentially more of an issue. My canonical example is being able to plug a<br>
USB headset in, and have a user job react to the udev event and start an<br>
application of my choice. This currently works if user jobs are enabled in<br>
Ubuntu and is a useful feature. If we did implement ':all:', we could change the<br>
upstart-udev-bridge to ensure it emits events to ':all:', but we're then back to<br>
the concern over permissiveness and it feels wrong to special-case one<br>
particular event source.<br>
<br>
So, if we do 'hide' system events from user jobs by default, we would be<br>
breaking the current publish-subscribe behaviour. That's not to say we won't<br>
consider doing this [2], but we are striving to retain current behaviour so I'd<br>
like to understand better what the potential 'attack vector' might be with some<br>
real world examples.<br>
<br>
I think this needs to be explored further. Can anyone think of scenarios where<br>
user jobs should not be privy to system events?<br>
<br>
Note that Upstart is happy to run system jobs whose configuration files have<br>
perms 0400 and the /var/log/upstart/* files are not readable by normal users, so<br>
AFAICS, the risk is probably limited to users being able to 'sniff' system event<br>
environment variables. This is only a problem if an admin creates a job where<br>
they specify sensitive information in one of those variables. However, I have<br>
personally never seen such a job and is kind of analogous to an admin doing<br>
something inappropriate such as 'sudo chmod 777 /etc/shadow'.<br>
<div class="im"><br>
><br>
> Thoughts?<br>
><br>
> Cheers,<br>
> Evan<br>
><br>
><br>
> On Tue, Nov 20, 2012 at 5:09 AM, James Hunt <<a href="mailto:james.hunt@ubuntu.com">james.hunt@ubuntu.com</a><br>
</div><div><div class="h5">> <mailto:<a href="mailto:james.hunt@ubuntu.com">james.hunt@ubuntu.com</a>>> wrote:<br>
><br>
> Here is the draft plan for 'Enhanced Upstart User Sessions' ([1]), which will be<br>
> used to supervise desktop sessions in Ubuntu:<br>
><br>
> <a href="https://wiki.ubuntu.com/FoundationsTeam/Specs/RaringUpstartUserSessions" target="_blank">https://wiki.ubuntu.com/FoundationsTeam/Specs/RaringUpstartUserSessions</a><br>
><br>
> = Summary =<br>
><br>
> Allow Upstart to run as a non-privileged user to supervise a session in an<br>
> event-based manner.<br>
><br>
> This brings many advantages including:<br>
><br>
> - more dynamic and efficient session startup (desktop services only get started<br>
> *when required*).<br>
> - reliable session shutdown.<br>
> - automatic job output logging.<br>
> - more efficient use of system resources (helping to maximise battery life for<br>
> example).<br>
><br>
> Comments Welcome. If you would like to get involved in this project, please let<br>
> me know.<br>
><br>
> Kind regards,<br>
><br>
> James.<br>
><br>
> [1] -<br>
> <a href="https://blueprints.launchpad.net/ubuntu/+spec/foundations-r-upstart-user-session-enhancements" target="_blank">https://blueprints.launchpad.net/ubuntu/+spec/foundations-r-upstart-user-session-enhancements</a><br>
> --<br>
> James Hunt<br>
> ____________________________________<br>
> <a href="http://upstart.ubuntu.com/cookbook" target="_blank">http://upstart.ubuntu.com/cookbook</a><br>
> <a href="http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf" target="_blank">http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf</a><br>
><br>
> --<br>
> upstart-devel mailing list<br>
</div></div>> <a href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a> <mailto:<a href="mailto:upstart-devel@lists.ubuntu.com">upstart-devel@lists.ubuntu.com</a>><br>
<div class="im">> Modify settings or unsubscribe at:<br>
> <a href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
><br>
><br>
<br>
</div>Kind regards,<br>
<br>
James.<br>
<br>
[1] - Its unclear what use-cases there are for user jobs reacting to system<br>
_jobs_, so if you have some, please let us know. To lend weight to this, there<br>
is also the issue that even if user jobs can access system job events, they can<br>
only see those events that occur after their Session Init has started. See<br>
section 'Outstanding Issues' in the spec and bug 1065965.<br>
<br>
[2] - Since I don't think user jobs are widely used, and are in fact currently<br>
disabled in Ubuntu.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
James Hunt<br>
____________________________________<br>
<a href="http://upstart.ubuntu.com/cookbook" target="_blank">http://upstart.ubuntu.com/cookbook</a><br>
<a href="http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf" target="_blank">http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf</a><br>
</div></div></blockquote></div><br></div>