summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-10-05 19:13:11 +0200
committerLudovic Courtès <ludo@gnu.org>2023-10-05 23:14:55 +0200
commite863274e67e2242b970845783172c9f4e49405ca (patch)
tree9551fd63dae3df2e711967bd3360aadebff054e5
parent917c17c052beebefa109c4eff3a7b0307460a4c7 (diff)
services: hurd-vm: Leave root password uninitialized when offloading.
Starting with 953c65ffdd43c02c934518fb7a1c68542584b223, offloading to the Hurd VM would be enabled by default. However, ‘root’ had an empty password so any user on the host could connect to the VM over VNC, log in as root, and potentially populate the host’s store from there. This change fixes that. * gnu/services/virtualization.scm (operating-system-with-locked-root-account): New procedure. (hurd-vm-disk-image)[transform]: Add ‘operating-system-with-locked-root-account’ when offloading.
-rw-r--r--gnu/services/virtualization.scm22
1 files changed, 21 insertions, 1 deletions
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm
index 076eca7ea29..f0f0ab3bf11 100644
--- a/gnu/services/virtualization.scm
+++ b/gnu/services/virtualization.scm
@@ -1085,6 +1085,20 @@ that will be listening to receive secret keys on port 1004, TCP."
1085 accounts) 1085 accounts)
1086 (operating-system-user-services os))))) 1086 (operating-system-user-services os)))))
1087 1087
1088(define (operating-system-with-locked-root-account os)
1089 "Return OS with a 'root' account whose password is uninitialized, thereby
1090preventing password-based authentication as 'root'."
1091 (define root
1092 ;; %ROOT-ACCOUNT has an empty password; change that to an uninitialized
1093 ;; password.
1094 (user-account
1095 (inherit %root-account)
1096 (password #f)))
1097
1098 (operating-system
1099 (inherit os)
1100 (users (cons root (operating-system-users os)))))
1101
1088(define %hurd-vm-operating-system 1102(define %hurd-vm-operating-system
1089 (operating-system 1103 (operating-system
1090 (inherit %hurd-default-operating-system) 1104 (inherit %hurd-default-operating-system)
@@ -1147,8 +1161,14 @@ that will be listening to receive secret keys on port 1004, TCP."
1147is added to the OS specified in CONFIG." 1161is added to the OS specified in CONFIG."
1148 (define transform 1162 (define transform
1149 (compose secret-service-operating-system 1163 (compose secret-service-operating-system
1164 ;; When offloading is enabled, (1) add the 'offloading' account,
1165 ;; and (2) prevent users from logging in as 'root' without a
1166 ;; password as this would allow any user on the host to populate
1167 ;; the host's store indirectly (for example by logging in as root
1168 ;; in the Hurd VM over VNC).
1150 (if (hurd-vm-configuration-offloading? config) 1169 (if (hurd-vm-configuration-offloading? config)
1151 operating-system-with-offloading-account 1170 (compose operating-system-with-locked-root-account
1171 operating-system-with-offloading-account)
1152 identity))) 1172 identity)))
1153 1173
1154 (let* ((os (transform (hurd-vm-configuration-os config))) 1174 (let* ((os (transform (hurd-vm-configuration-os config)))