All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian.Jackson@eu.citrix.com, Jim Fehlig <jfehlig@suse.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, 1 Jul 2015 17:29:03 +0200	[thread overview]
Message-ID: <1435764543.25170.389.camel@citrix.com> (raw)
In-Reply-To: <1435755052-19447-1-git-send-email-stefano.stabellini@eu.citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 1986 bytes --]

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.

Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2015-07-01 15:29 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 [this message]
2015-07-01 15:34   ` Stefano Stabellini
2015-07-01 21:03     ` Jim Fehlig
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=1435764543.25170.389.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jfehlig@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.