xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jim Fehlig <jfehlig@suse.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Dario Faggioli <dario.faggioli@citrix.com>
Cc: Ian.Jackson@eu.citrix.com, xen-devel@lists.xensource.com,
	wei.liu2@citrix.com, ian.campbell@citrix.com
Subject: Re: [PATCH v6] run QEMU as non-root
Date: Wed, 01 Jul 2015 15:03:03 -0600	[thread overview]
Message-ID: <55945587.70707@suse.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1507011630270.17378@kaball.uk.xensource.com>

On 07/01/2015 09:34 AM, Stefano Stabellini wrote:
> On Wed, 1 Jul 2015, Dario Faggioli wrote:
>> On Wed, 2015-07-01 at 13:50 +0100, Stefano Stabellini wrote:
>>> --- /dev/null
>>> +++ b/docs/misc/qemu-deprivilege.txt
>>> @@ -0,0 +1,31 @@
>>> +For security reasons, libxl tries to pass a non-root username to QEMU as
>>> +argument. During initialization QEMU calls setuid and setgid with the
>>> +user ID and the group ID of the user passed as argument.
>>> +Libxl looks for the following users in this order:
>>> +
>>> +1) a user named "xen-qemuuser-domid$domid",
>>> +Where $domid is the domid of the domain being created.
>>> +This requires the reservation of 65535 uids from xen-qemuuser-domid1
>>> +to xen-qemuuser-domid65535. To use this mechanism, you might want to
>>> +create a large number of users at installation time. For example:
>>> +
>>> +for ((i=1; i<65536; i++))
>>> +do
>>> +    adduser --no-create-home --system xen-qemuuser-domid$i
>>> +done
>>> +
>>> +You might want to consider passing --group to adduser to create a new
>>> +group for each new user.
>>> +
>> This is, IMHO, a lot of policing, for something like libxl.
>>
>> I'm saying this only now because, although always being always dubious
>> about it, it was Jim's comment to v5 that made me realize it properly,
>> and you're own reply to him in that thread, would actually be a great
>> alternative!
>>
>> In fact, what about:
>>   * in libxl:
>>      - provide and honour (as first option) device_model_user, as you're
>>        doing here;
>>      - if the above is not provided, check the availability of the
>>        'shared' user, and use it if it's there;
>>      - if that is not there either, use root.
>>   * in xl (as you said yourself in v5's review):
>>      - build up the per-domain username and (if available) use
>>        device_model_user to pass it to libxl.
> That is of course possible and was my first suggestion in my reply.
>
> However after speaking with IanC, I was convinced that offering a good
> default security mechanism in libxl is better, so that all libxl users,
> including hyper for example, get good security by default without any
> need to do anything (except creating some users).
>
> I think that libvirt is a bit of a special case here, given that it
> already knows about users. I would expect most other toolstacks not to.

Perhaps.  But thanks for providing a way (b_info->device_model_user) for apps to 
override the libxl policy.

Regards,
Jim

  reply	other threads:[~2015-07-01 21:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 12:50 [PATCH v6] run QEMU as non-root Stefano Stabellini
2015-07-01 15:29 ` Dario Faggioli
2015-07-01 15:34   ` Stefano Stabellini
2015-07-01 21:03     ` Jim Fehlig [this message]
2015-07-09 10:34       ` Ian Campbell
2015-07-09 23:14         ` Jim Fehlig
2015-07-10  8:40           ` Ian Campbell
2015-07-09 10:31 ` Ian Campbell
2015-07-23 17:04   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55945587.70707@suse.com \
    --to=jfehlig@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).