--- /dev/null
+# Runs once a day at 12pm to fetch the monitor account keys in case it was
+# inaccessible previously due to a network outage.
+
+0 12 * * * root /etc/init.d/monitor start > /dev/null 2>&1
+
--- /dev/null
+#!/bin/bash
+#
+# monitor Enables the monitor account by setting up the ssh key from the enabled PLC.
+#
+# Load before nm, vcached, and vservers, vserver-reference
+# chkconfig: 3 59 80
+# description: Fetch monitor ssh key to enable access to machine via monitor immediately.
+#
+# Stephen Soltesz <soltesz@cs.princeton.edu>
+# Copyright (C) 2008 The Trustees of Princeton University
+#
+# $Id$
+#
+
+case "$1" in
+ start|restart|reload)
+ ;;
+ stop|status)
+ exit 0
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+# NOTE: If user already exists, this just exists with status 9. I think it's
+# ok to simply let this command check and error out.
+# Parse PLC configuration
+if [ -r /etc/planetlab/plc_config ] ; then
+ . /etc/planetlab/plc_config
+else
+ PLC_NAME="PlanetLab"
+ PLC_SLICE_PREFIX="pl"
+ PLC_BOOT_HOST="boot.planet-lab.org"
+fi
+
+USER="${PLC_SLICE_PREFIX}_monitor"
+/usr/sbin/useradd -p "" -m $USER &> /dev/null || :
+
+if [ ! -d /home/$USER/.ssh ] ; then
+ mkdir /home/$USER/.ssh
+ chmod 700 /home/$USER/.ssh
+ chown $USER.$USER /home/$USER/.ssh
+fi
+
+URL="http://${PLC_BOOT_HOST}/PlanetLabConf/keys.php?$USER"
+curl -s "$URL" > /home/$USER/.ssh/authorized_keys
+chown $USER.$USER /home/$USER/.ssh/authorized_keys
--- /dev/null
+#
+# $Id$
+#
+
+%define url $URL: svn+ssh://svn.planet-lab.org/svn/monitor/trunk/monitor.spec $
+
+%define name monitor
+%define version 1.0
+%define taglevel 0
+
+%define release %{taglevel}%{?date:.%{date}}
+
+Summary: Monitor account initialization for the root image.
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Source0: %{name}-%{version}.tar.bz2
+License: GPL
+Group: Applications/System
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+
+Vendor: PlanetLab
+Packager: PlanetLab Central <support@planet-lab.org>
+Distribution: PlanetLab %{plrelease}
+URL: %(echo %{url} | cut -d ' ' -f 2)
+
+%description
+Scripts for creating the monitor account in the root filesystem, to enable node access
+without using the 'root' account.
+
+%prep
+%setup -q
+
+%build
+echo "There is no build stage. Simply copy files."
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -D -m 755 monitor.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
+install -D -m 755 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files %{name}
+%defattr(-,root,root)
+%{_initrddir}/monitor
+%{_sysconfdir}/cron.d/monitor
+
+%post %{slicefamily}
+chkconfig --add monitor
+chkconfig monitor on
+
+%changelog
+* Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
+- initial addition.