[23963] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23573 - trunk/debathena/config/reactivate/debian

daemon@ATHENA.MIT.EDU (Evan Broder)
Sat Mar 7 17:21:19 2009

Date: Sat, 7 Mar 2009 17:20:31 -0500
From: Evan Broder <broder@MIT.EDU>
Message-Id: <200903072220.n27MKVnJ017027@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: broder
Date: 2009-03-07 17:20:31 -0500 (Sat, 07 Mar 2009)
New Revision: 23573

Added:
   trunk/debathena/config/reactivate/debian/policy-rc.d
Modified:
   trunk/debathena/config/reactivate/debian/athena-login-snapshot
   trunk/debathena/config/reactivate/debian/changelog
   trunk/debathena/config/reactivate/debian/debathena-reactivate.install
Log:
In reactivate:
  * Instead of generating policy-rc.d at login time, have a general
    policy-rc.d that works both inside and outside of the chroot. This
    fixes a potential issue if there's a reboot during a login session.


Modified: trunk/debathena/config/reactivate/debian/athena-login-snapshot
===================================================================
--- trunk/debathena/config/reactivate/debian/athena-login-snapshot	2009-03-07 21:50:03 UTC (rev 23572)
+++ trunk/debathena/config/reactivate/debian/athena-login-snapshot	2009-03-07 22:20:31 UTC (rev 23573)
@@ -29,7 +29,7 @@
 event=$1
 binddirs="/proc /sys /dev /dev/shm /dev/pts /var/run /var/lock /var/tmp /afs /mit /tmp /media /home"
 addgroups="admin lpadmin adm fuse cdrom floppy audio video plugdev scanner dialout"
-daemons="cups cupsys"
+daemons="$(/usr/sbin/policy-rc.d --daemons)"
 
 rootdev=$(awk '$2 == "/" { dev=$1 } END { print dev }' /proc/mounts)
 vgname=$(lvs --noheadings -o vg_name "$rootdev" | awk '{print $1}')
@@ -99,41 +99,9 @@
       chroot /login invoke-rc.d $daemon start || [ $? = 100 ]
     done
 
-    # Prevent most daemons from starting inside the chroot.
-    cat > /login/usr/sbin/policy-rc.d <<EOF
-#!/bin/sh
+    touch /login/ClusterLogin
+    touch /var/run/athena-login
 
-case "\$1" in
-    $(echo $daemons | sed -e 's/ /|/'))
-        if echo "\$2" | grep -q -v "(.*)"; then
-            exit 0
-        fi
-    ;;
-esac
-
-exit 101
-EOF
-    chmod 755 /login/usr/sbin/policy-rc.d
-    
-    # Prevent a few daemons from starting outside the chroot
-    cat > /usr/sbin/policy-rc.d <<EOF
-#!/bin/sh
-
-case "\$1" in
-    $(echo $daemons | sed -e 's/ /|/'))
-        exit 101
-    ;;
-esac
-
-if echo "\$2" | grep -q -v "(.*)"; then
-    exit 101
-fi
-
-exit 0
-
-EOF
-    chmod 755 /usr/sbin/policy-rc.d
-
     # Add an schroot.conf entry for the chroot.
     conf=/etc/schroot/schroot.conf
     sed -e '/###ATHENA-BEGIN###/,/###ATHENA-END###/d' $conf > $conf.new
@@ -150,9 +118,8 @@
     ;;
 
   login-end)
-    # Clean-up the policy-rc.d files that were created to change which
-    # daemons could start
-    rm /login/usr/sbin/policy-rc.d /usr/sbin/policy-rc.d
+    # Clean-up the temporary file to indicate the logged in state
+    rm /var/run/athena-login
 
     # Stop any daemons that were specifically started inside the
     # chroot

Modified: trunk/debathena/config/reactivate/debian/changelog
===================================================================
--- trunk/debathena/config/reactivate/debian/changelog	2009-03-07 21:50:03 UTC (rev 23572)
+++ trunk/debathena/config/reactivate/debian/changelog	2009-03-07 22:20:31 UTC (rev 23573)
@@ -1,3 +1,11 @@
+debathena-reactivate (1.13) unstable; urgency=low
+
+  * Instead of generating policy-rc.d at login time, have a general
+    policy-rc.d that works both inside and outside of the chroot. This
+    fixes a potential issue if there's a reboot during a login session.
+
+ -- Evan Broder <broder@mit.edu>  Sat, 07 Mar 2009 17:20:01 -0500
+
 debathena-reactivate (1.12) unstable; urgency=low
 
   * Restart a provided list of daemons inside the chroot at login.

Modified: trunk/debathena/config/reactivate/debian/debathena-reactivate.install
===================================================================
--- trunk/debathena/config/reactivate/debian/debathena-reactivate.install	2009-03-07 21:50:03 UTC (rev 23572)
+++ trunk/debathena/config/reactivate/debian/debathena-reactivate.install	2009-03-07 22:20:31 UTC (rev 23573)
@@ -3,3 +3,4 @@
 debian/PreSession/Default.debathena etc/gdm/PreSession
 debian/PostSession/Default.debathena etc/gdm/PostSession
 debian/updatedb.findutils.cron.local etc
+debian/policy-rc.d usr/sbin

Added: trunk/debathena/config/reactivate/debian/policy-rc.d
===================================================================
--- trunk/debathena/config/reactivate/debian/policy-rc.d	2009-03-07 21:50:03 UTC (rev 23572)
+++ trunk/debathena/config/reactivate/debian/policy-rc.d	2009-03-07 22:20:31 UTC (rev 23573)
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+daemons="cups|cupsys"
+
+if [ "--daemons" = "$1" ]; then
+    IFS='|'
+    echo $daemons
+    exit
+fi
+
+case "$2" in
+    \(*\))
+        exit 101
+        ;;
+esac
+
+# If nobody's logged in, follow the default policy
+if ! [ -e /var/run/athena-login ]; then
+    exit 0
+elif [ -e /ClusterLogin ]; then
+    case "$1" in
+        $daemons)
+            exit 0
+            ;;
+        *)
+            exit 101
+            ;;
+    esac
+else
+    case "$1" in
+        $daemons)
+            exit 101
+            ;;
+        *)
+            exit 0
+            ;;
+    esac
+fi


Property changes on: trunk/debathena/config/reactivate/debian/policy-rc.d
___________________________________________________________________
Name: svn:executable
   + *


home help back first fref pref prev next nref lref last post