aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-27 16:10:28 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-27 16:10:28 -0700
commit745e5e4017d9c1947f669b508719afe30227fe5c (patch)
treef16bca2f6c60f03ae03b488dc18e0d5d711e1938
parent07ce1bef0c06f22a0faef73ebe91569f189b1bc3 (diff)
downloadconsfigurator-745e5e4017d9c1947f669b508719afe30227fe5c.tar.gz
:CHROOT.FORK: check for Lisp-type connection and root
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/connection/chroot/fork.lisp2
-rw-r--r--src/package.lisp2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/connection/chroot/fork.lisp b/src/connection/chroot/fork.lisp
index 0983def..50dcbc9 100644
--- a/src/connection/chroot/fork.lisp
+++ b/src/connection/chroot/fork.lisp
@@ -25,6 +25,8 @@
#-(or sbcl) (foreign-funcall "chroot" :string path :int))
(defmethod establish-connection ((type (eql :chroot.fork)) remaining &key into)
+ (unless (and (lisp-connection-p) (zerop (foreign-funcall "geteuid" :int)))
+ (error "~&Forking into a chroot requires a Lisp image running as root"))
(informat 1 "~&Forking into chroot at ~A" into)
(with-fork-connection (remaining)
(unless (zerop (chroot into))
diff --git a/src/package.lisp b/src/package.lisp
index c2fa817..26d5ef8 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -341,7 +341,7 @@
(:use #:cl
#:consfigurator
#:consfigurator.connection.fork
- #-(or sbcl) #:cffi))
+ #:cffi))
(defpackage :consfigurator.connection.chroot.shell
(:use #:cl