[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/14: services: hurd-vm: Run QEMU as an unprivileged user.
From: |
guix-commits |
Subject: |
03/14: services: hurd-vm: Run QEMU as an unprivileged user. |
Date: |
Tue, 29 Sep 2020 06:03:42 -0400 (EDT) |
civodul pushed a commit to branch wip-childhurd
in repository guix.
commit 4044dfd70c767aa7ac6f8e621346cfe3231f0a9a
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Sep 26 16:50:49 2020 +0200
services: hurd-vm: Run QEMU as an unprivileged user.
Until qemu was running as "root", which is unnecessary.
* gnu/services/virtualization.scm (%hurd-vm-accounts): New variable.
(hurd-vm-service-type)[extensions]: Add ACCOUNT-SERVICE-TYPE extension.
---
gnu/services/virtualization.scm | 43 ++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm
index 20e104f..55a19d7 100644
--- a/gnu/services/virtualization.scm
+++ b/gnu/services/virtualization.scm
@@ -959,28 +959,45 @@ is added to the OS specified in CONFIG."
(with-imported-modules
(source-module-closure '((gnu build secret-service)
(guix build utils)))
- #~(let ((spawn (make-forkexec-constructor #$vm-command)))
- (lambda _
- (let ((pid (spawn))
- (port #$(hurd-vm-port config %hurd-vm-secrets-port))
- (root #$(hurd-vm-configuration-secret-root config)))
- (catch #t
- (lambda _
- (secret-service-send-secrets port root))
- (lambda (key . args)
- (kill (- pid) SIGTERM)
- (apply throw key args)))
- pid)))))
+ #~(lambda ()
+ (let ((pid (fork+exec-command #$vm-command
+ #:user "childhurd"
+ #:group "childhurd"
+ #:environment-variables
+ ;; QEMU tries to write to /var/tmp
+ ;; by default.
+ '("TMPDIR=/tmp")))
+ (port #$(hurd-vm-port config %hurd-vm-secrets-port))
+ (root #$(hurd-vm-configuration-secret-root config)))
+ (catch #t
+ (lambda _
+ (secret-service-send-secrets port root)
+ pid)
+ (lambda (key . args)
+ (kill (- pid) SIGTERM)
+ (apply throw key args)))))))
(modules `((gnu build secret-service)
(guix build utils)
,@%default-modules))
(stop #~(make-kill-destructor))))))
+(define %hurd-vm-accounts
+ (list (user-group (name "childhurd") (system? #t))
+ (user-account
+ (name "childhurd")
+ (group "childhurd")
+ (comment "Privilege separation user for the childhurd")
+ (home-directory "/var/empty")
+ (shell (file-append shadow "/sbin/nologin"))
+ (system? #t))))
+
(define hurd-vm-service-type
(service-type
(name 'hurd-vm)
(extensions (list (service-extension shepherd-root-service-type
- hurd-vm-shepherd-service)))
+ hurd-vm-shepherd-service)
+ (service-extension account-service-type
+ (const %hurd-vm-accounts))))
(default-value (hurd-vm-configuration))
(description
"Provide a Virtual Machine running the GNU/Hurd.")))
- branch wip-childhurd created (now 8eb7648), guix-commits, 2020/09/29
- 02/14: gnu: lzlib: Don't build static library., guix-commits, 2020/09/29
- 05/14: secret-service: Clarify the origin of messages., guix-commits, 2020/09/29
- 13/14: services: secret-service: Add initial client/server handshake., guix-commits, 2020/09/29
- 01/14: gnu: lzlib: Support cross-compilation., guix-commits, 2020/09/29
- 06/14: services: hurd-vm: Check whether /dev/kvm exists at run time., guix-commits, 2020/09/29
- 09/14: services: hurd-vm: Pass "-no-reboot" when spawning the Hurd VM., guix-commits, 2020/09/29
- 10/14: secret-service: Add a timeout when waiting for a client., guix-commits, 2020/09/29
- 12/14: services: secret-service: Move instance last in the list of services., guix-commits, 2020/09/29
- 03/14: services: hurd-vm: Run QEMU as an unprivileged user.,
guix-commits <=
- 04/14: services: childhurd: Tweak description., guix-commits, 2020/09/29
- 08/14: services: hurd-vm: Initialize the guest's SSH/Guix keys at activation time., guix-commits, 2020/09/29
- 11/14: secret-service: Fix file port leak in 'secret-service-send-secrets'., guix-commits, 2020/09/29
- 14/14: secret-service: Add proper logging procedure and log to syslog., guix-commits, 2020/09/29
- 07/14: services: guix: Generate key pair if needed during activation., guix-commits, 2020/09/29