Use sudo in VM
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 7 Feb 2015 11:47:09 +0000 (13:47 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 7 Feb 2015 11:47:09 +0000 (13:47 +0200)
ex/makevm
ex/vm.conf
gruntmaster-exec

index c054cf15700bdf184137a2ecf3ec9d8c4039c3e4..bf240c3c58e66a78889a9a977a3df3898c7d6349 100755 (executable)
--- a/ex/makevm
+++ b/ex/makevm
@@ -24,8 +24,12 @@ squashfs
 9pnet
 9pnet_virtio
 EOF
+cat >> vm/etc/sudoers <<EOF
+Defaults>nobody closefrom=5
+Defaults>nobody !env_check
+Defaults>nobody env_keep="ONLINE_JUDGE PATH HOME"
+EOF
 install gruntmaster-exec gruntmaster-compile vm/usr/bin/
-sed -i -e "s/USER => 65534/USER => $USER/" -e "s/GROUP => 65534/GROUP => $GROUP/" vm/usr/bin/gruntmaster-exec
 chroot vm update-initramfs -d -k 3.2.0-4-amd64
 chroot vm update-initramfs -c -k 3.2.0-4-amd64
 umount vm/proc
index 05323edbdf07da40220b184ef663d66528502e86..f2aab06f6d97ab406eae9b0b1cf1cd7d9ed49acd 100644 (file)
@@ -5,7 +5,7 @@ bootstrap=Debian
 aptsources=Debian
 
 [Debian]
-packages=linux-image-3.2.0-4-amd64 mawk libbsd-resource-perl libipc-signal-perl gcc g++ mono-gmcs default-jdk golang-go gccgo ghc fpc perl python
+packages=linux-image-3.2.0-4-amd64 mawk libbsd-resource-perl libipc-signal-perl gcc g++ mono-gmcs default-jdk golang-go gccgo ghc fpc perl python sudo
 source=http://ftp.ro.debian.org/debian
 keyring=debian-archive-keyring
 suite=wheezy
index d8028b8f4f2c5bf15f12c6625a604f480a840680..8ab857b2c469504182859214d6d2ab402489b5fc 100755 (executable)
@@ -18,9 +18,6 @@ use constant +{
        DIED => 5,
        REJ => 10,
 };
-# These constants are changed by ex/makevm
-use constant USER => 65534;
-use constant GROUP => 65534;
 
 use BSD::Resource qw/setrlimit RLIMIT_AS RLIMIT_FSIZE RLIMIT_NPROC/;
 use IPC::Signal qw/sig_name sig_num/;
@@ -93,8 +90,6 @@ if ($ret) {
        setrlimit RLIMIT_AS, $mlimit, $mlimit or die $! if $mlimit;
        setrlimit RLIMIT_FSIZE, $olimit, $olimit or die $! if $olimit;
        setrlimit RLIMIT_NPROC, $nproc, $nproc or die $! if $nobody;
-       POSIX::setgid $nobody ? 65534 : USER;
-       POSIX::setuid $nobody ? 65534 : GROUP;
        unshift @ARGV, @sudo;
        say STDERR "Executing: ", join ' ', map { "'$_'" } @ARGV if $debug;
        exec @ARGV;
This page took 0.01166 seconds and 4 git commands to generate.