Index: package_tags/invirt-console/0.2.4/debian/changelog
===================================================================
--- package_tags/invirt-console/0.2.4/debian/changelog	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/changelog	(revision 1839)
@@ -0,0 +1,315 @@
+invirt-console (0.2.4) unstable; urgency=low
+
+  * config.{authn[0] => kerberos}.realm
+
+ -- Evan Broder <broder@mit.edu>  Wed, 10 Dec 2008 23:06:24 -0500
+
+invirt-console (0.2.3) unstable; urgency=low
+
+  * ...and /home/machines
+
+ -- Evan Broder <broder@mit.edu>  Mon, 08 Dec 2008 09:47:20 -0500
+
+invirt-console (0.2.2) unstable; urgency=low
+
+  * Also create the /consolefs directory
+
+ -- Evan Broder <broder@mit.edu>  Mon, 08 Dec 2008 09:27:55 -0500
+
+invirt-console (0.2.1) unstable; urgency=low
+
+  * Be sure to create the /etc/conserver/conf.d directory
+
+ -- Evan Broder <broder@mit.edu>  Sun, 07 Dec 2008 10:29:35 -0500
+
+invirt-console (0.2.0) unstable; urgency=low
+
+  * Rename source package in preparation for merging invirt-console-server
+    with invirt-console-host
+  * Merge invirt-console-host into invirt-console (LP: #305681)
+
+ -- Evan Broder <broder@mit.edu>  Sun, 07 Dec 2008 10:17:06 -0500
+
+invirt-console-server (0.1.3) unstable; urgency=low
+
+  * Fix a gen_config -> gen_files
+
+ -- Greg Price <price@mit.edu>  Sat, 22 Nov 2008 19:27:59 -0500
+
+invirt-console-server (0.1.2) unstable; urgency=low
+
+  * Use gen-files.sh instead of rolling out own
+
+ -- Evan Broder <broder@mit.edu>  Sat, 22 Nov 2008 05:45:25 -0500
+
+invirt-console-server (0.1.1) unstable; urgency=low
+
+  * Clean up the init script with some ideas from debathena-pyhesiodfs.
+  * Switch to using std-init.
+
+ -- Evan Broder <broder@mit.edu>  Sat, 22 Nov 2008 05:26:22 -0500
+
+invirt-console-server (0.1.0) unstable; urgency=low
+
+  * Add real caching to consolefs
+  * Now that we're really caching, cache for a shorter period of time
+
+ -- Evan Broder <broder@mit.edu>  Mon, 17 Nov 2008 13:16:37 -0500
+
+invirt-console-server (0.0.13) unstable; urgency=low
+
+  * Actually get the password fields right for libnss-pgsql
+
+ -- Evan Broder <broder@mit.edu>  Mon, 10 Nov 2008 22:57:49 -0500
+
+invirt-console-server (0.0.12) unstable; urgency=low
+
+  * Fix the libnss-pgsql config - don't suggest that the password should
+    be in /etc/shadow
+
+ -- Evan Broder <broder@mit.edu>  Mon, 10 Nov 2008 20:34:14 -0500
+
+invirt-console-server (0.0.11) unstable; urgency=low
+
+  * Don't depend on invirt-mail-config
+
+ -- Evan Broder <broder@mit.edu>  Thu, 06 Nov 2008 22:47:47 -0500
+
+invirt-console-server (0.0.10) unstable; urgency=low
+
+  * Fix some uncaught bugs with the libnss-pgsql config
+
+ -- Evan Broder <broder@mit.edu>  Thu, 06 Nov 2008 22:21:12 -0500
+
+invirt-console-server (0.0.9) unstable; urgency=low
+
+  * Depend on invirt-mail-config
+
+ -- Evan Broder <broder@mit.edu>  Thu, 06 Nov 2008 21:48:34 -0500
+
+invirt-console-server (0.0.8) unstable; urgency=low
+
+  * The ACL file for remctl moved, but the reference to it didn't
+
+ -- Evan Broder <broder@mit.edu>  Thu, 06 Nov 2008 03:35:48 -0500
+
+invirt-console-server (0.0.7) unstable; urgency=low
+
+  * Apparently remctl scripts run without a PATH
+
+ -- Evan Broder <broder@mit.edu>  Sun, 02 Nov 2008 17:08:35 -0500
+
+invirt-console-server (0.0.6) unstable; urgency=low
+
+  * Use invoke-rc.d instead of calling init scripts directly
+
+ -- Evan Broder <broder@mit.edu>  Fri, 31 Oct 2008 06:32:17 -0400
+
+invirt-console-server (0.0.5) unstable; urgency=low
+
+  * sipb-xen-base -> invirt-base
+
+ -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 04:23:16 -0400
+
+invirt-console-server (0.0.4) unstable; urgency=low
+
+  * sipb-xen-database-common -> invirt-database
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 21:04:39 -0400
+
+invirt-console-server (0.0.3) unstable; urgency=low
+
+  * Remove dependency on sipb-xen-chrony-config - we need to take care of
+    the clock, but not through that package
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 19:18:06 -0400
+
+invirt-console-server (0.0.2) unstable; urgency=low
+
+  * Standardize on "Invirt project"
+
+ -- Evan Broder <broder@mit.edu>  Fri, 24 Oct 2008 13:32:17 -0400
+
+invirt-console-server (0.0.1) unstable; urgency=low
+
+  * sipb-xen -> invirt
+  *  -> -server while we're at it
+
+ -- Greg Price <price@mit.edu>  Fri, 24 Oct 2008 03:54:40 -0400
+
+sipb-xen-console (8.4) unstable; urgency=low
+
+  * Create a dummy console entry that exists by default so that conserver
+    won't quit if no consoles are defined.
+
+ -- Evan Broder <broder@mit.edu>  Tue, 14 Oct 2008 03:13:47 -0400
+
+sipb-xen-console (8.3) unstable; urgency=low
+
+  * Update nss-pgsql.conf.mako to reflect new config file format
+
+ -- Evan Broder <broder@mit.edu>  Mon, 06 Oct 2008 02:31:37 -0400
+
+sipb-xen-console (8.2) unstable; urgency=low
+
+  * Actually generate nscd.conf correctly
+
+ -- Evan Broder <broder@mit.edu>  Mon, 06 Oct 2008 01:45:33 -0400
+
+sipb-xen-console (8.1) unstable; urgency=low
+
+  * ConsoleFS is now RouteFS-based
+
+ -- Evan Broder <broder@mit.edu>  Sun, 05 Oct 2008 05:26:52 -0400
+
+sipb-xen-console (8.0) unstable; urgency=low
+
+  * Update config files to work with Hardy
+
+ -- Evan Broder <broder@mit.edu>  Sun, 05 Oct 2008 04:45:21 -0400
+
+sipb-xen-console (7.8) unstable; urgency=low
+
+  * generate config files using mako
+
+ -- Yang Zhang <y_z@mit.edu>  Thu, 14 Aug 2008 15:10:50 -0400
+
+sipb-xen-console (7.7) unstable; urgency=low
+
+  * sipb_xen_database -> invirt.database
+  * use invirt config in sipb-xen-consolefs
+  * added decomposition of DB URI
+  * generate nss-pgsql.conf and issue.net.no_tkt from debian init script
+
+ -- Yang Zhang <y_z@mit.edu>  Sun,  3 Aug 2008 01:13:37 -0400
+
+sipb-xen-console (7.6) unstable; urgency=low
+
+  * Use invirt-getconf to generate config.
+
+ -- Greg Price <price@mit.edu>  Wed, 30 Jul 2008 22:28:33 -0400
+
+sipb-xen-console (7.5) unstable; urgency=low
+
+  * Generate config at start/reload from /etc/invirt/*.
+
+ -- Greg Price <price@mit.edu>  Mon, 21 Jul 2008 18:29:43 -0400
+
+sipb-xen-console (7.4) unstable; urgency=low
+
+  * pull in sipb-xen-base
+
+ -- Greg Price <price@mit.edu>  Mon, 21 Jul 2008 17:41:01 -0400
+
+sipb-xen-console (7.3) unstable; urgency=low
+
+  * update for current config-package-dev
+
+ -- Greg Price <price@mit.edu>  Sun, 20 Jul 2008 15:41:50 -0400
+
+sipb-xen-console (7.3) unstable; urgency=low
+
+  * Move config details out to config package.
+
+ -- Greg Price <price@mit.edu>  Sun, 20 Jul 2008 01:01:26 -0400
+
+sipb-xen-console (7.2) unstable; urgency=low
+
+  * Multiplex consoles on multiple hosts.
+  
+ -- Greg Price <price@mit.edu>  Sun, 13 Jul 2008 08:52:18 -0400
+
+sipb-xen-console (7.1) unstable; urgency=low
+
+  * Remember to actually divert the conserver config
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 01:48:05 -0400
+
+sipb-xen-console (7) unstable; urgency=low
+
+  * Use conserver instead of ssh to connect to black-mesa
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Wed,  2 Apr 2008 00:52:05 -0400
+
+sipb-xen-console (6.2) unstable; urgency=low
+
+  * /etc/modules is no longer managed by this package
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Tue,  1 Apr 2008 22:25:09 -0400
+
+sipb-xen-console (6.1) unstable; urgency=low
+
+  * Don't add the "d_" to the domain name on this side - do it on the
+    black-mesa side
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Tue, 01 Apr 2008 22:20:47 -0400
+
+sipb-xen-console (6) unstable; urgency=low
+
+  * modprobe fuse before attaching consolefs
+  * Revert code to block dropping privileges to user accounts
+  * Add configuration to accept Kerberos config for users and error on
+    non-root users if Kerberos authentication fails
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Tue, 01 Apr 2008 20:03:11 -0400
+
+sipb-xen-console (5.1) unstable; urgency=low
+
+  * Package should create /consolefs so that sipb-xen-consolefs has
+    somewhere to mount to
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Sun, 30 Mar 2008 18:20:02 -0400
+
+sipb-xen-console (5) unstable; urgency=low
+
+  * modprobe fuse at boot
+
+ -- Evan Broder <broder@sipb-xen-dev.mit.edu>  Sun, 30 Mar 2008 17:57:36 -0400
+
+sipb-xen-console (4.1) unstable; urgency=low
+
+  * It should not be trivial for us to access the serial console of
+    users' machines
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Sun, 30 Mar 2008 17:42:04 -0400
+
+sipb-xen-console (4) unstable; urgency=low
+
+  * Added comments to sipb-xen-consolefs
+  * Added support for symlinks in the realpath
+  * Changed sipb-xen-consolefs to use syslog instead of printf debugging
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Sun, 30 Mar 2008 14:17:59 -0400
+
+sipb-xen-console (3.2) unstable; urgency=low
+
+  * Fixing a bug in sipb-xen-consolefs ('@' is not re-added to realms
+    in the .k5login
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Sun, 30 Mar 2008 06:39:30 -0400
+
+sipb-xen-console (3.1) unstable; urgency=low
+
+  * Clean up the motd a bit
+  * Add dependency on sipb-xen-chrony-config to make sure the clock is
+    staying synced
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Sun, 30 Mar 2008 06:33:55 -0400
+
+sipb-xen-console (3) unstable; urgency=low
+
+  * Make the motd useful instead of turning it off
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Sun, 30 Mar 2008 06:14:23 -0400
+
+sipb-xen-console (2) unstable; urgency=low
+
+  * Actually functional release.
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Sun, 30 Mar 2008 05:07:43 -0400
+
+sipb-xen-console (1) unstable; urgency=low
+
+  * Initial release.
+
+ -- SIPB Xen Project <sipb-xen@mit.edu>  Sun, 30 Mar 2008 01:08:50 -0400
Index: package_tags/invirt-console/0.2.4/debian/compat
===================================================================
--- package_tags/invirt-console/0.2.4/debian/compat	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/compat	(revision 1839)
@@ -0,0 +1,1 @@
+5
Index: package_tags/invirt-console/0.2.4/debian/control
===================================================================
--- package_tags/invirt-console/0.2.4/debian/control	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/control	(revision 1839)
@@ -0,0 +1,25 @@
+Source: invirt-console
+Section: servers
+Priority: extra
+Maintainer: Invirt project <invirt@mit.edu>
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 5), config-package-dev (>= 4.5~), nscd, openssh-server, debathena-ssh-server-config, initscripts
+Standards-Version: 3.7.2
+
+Package: invirt-console-server
+Architecture: all
+Provides: ${diverted-files}
+Conflicts: ${diverted-files}
+Depends: invirt-base, ${shlibs:Depends}, ${misc:Depends},
+ conserver-client, daemon, debathena-kerberos-config, fuse-utils,
+ libnss-pgsql1, nscd, openssh-server, python, python-routefs,
+ invirt-database, remctl-server, debathena-ssh-server-config
+Description: Invirt serial-console proxy server
+ This is the software for the serial-console proxy server.
+
+Package: invirt-console-host
+Architecture: all
+Provides: ${diverted-files}
+Conflicts: ${diverted-files}
+Depends: ${shlibs:Depends}, ${misc:Depends}, conserver-server, remctl-client, invirt-base, cron
+Description: SIPB Xen serial console server server
+  This configures the VMM for the server-side of the console server
Index: package_tags/invirt-console/0.2.4/debian/copyright
===================================================================
--- package_tags/invirt-console/0.2.4/debian/copyright	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/copyright	(revision 1839)
@@ -0,0 +1,16 @@
+This software was written as part of the Invirt project <invirt@mit.edu>.
+
+Copyright :
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in the file /usr/share/common-licenses/GPL.
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-host.cron.d
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-host.cron.d	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-host.cron.d	(revision 1839)
@@ -0,0 +1,8 @@
+#
+# cron-jobs for invirt-console-host
+# Refresh the list of active VM consoles
+#
+
+MAILTO=root
+
+*/5 * * * * root python /usr/sbin/invirt-update-conserver
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-host.init
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-host.init	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-host.init	(revision 1839)
@@ -0,0 +1,19 @@
+#! /bin/bash
+### BEGIN INIT INFO
+# Provides:          invirt-console-host
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: conserver config from invirt-config for Invirt host
+# Description:       
+### END INIT INFO
+
+PACKAGE=invirt-console-host
+PARENTPACKAGE=conserver-server
+GEN_FILES=/etc/conserver/invirt-genconfig.cf
+
+dpkg -s "$PACKAGE" >/dev/null 2>/dev/null || exit 0
+
+. /lib/init/config-init.sh
+config_init $1
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-host.install
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-host.install	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-host.install	(revision 1839)
@@ -0,0 +1,1 @@
+host/* .
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-host.postinst
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-host.postinst	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-host.postinst	(revision 1839)
@@ -0,0 +1,47 @@
+#!/bin/sh
+# postinst script for invirt-console-host
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+        # Clean up the old sudoers line before we add it back
+        perl -i.bak -ne 's%^### (BEGIN|END) invirt-console-host\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
+        
+        cat >>/etc/sudoers <<EOF
+### BEGIN invirt-console-host
+conservr ALL=(ALL) NOPASSWD: /usr/sbin/xm console d_*
+### END invirt-console-host
+EOF
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-host.prerm
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-host.prerm	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-host.prerm	(revision 1839)
@@ -0,0 +1,39 @@
+#!/bin/sh
+# prerm script for invirt-console-host
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+        perl -i.bak -ne 's%^### (BEGIN|END) invirt-console-host\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-server.dirs
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-server.dirs	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-server.dirs	(revision 1839)
@@ -0,0 +1,3 @@
+etc/conserver/conf.d
+consolefs
+home/machines
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-server.init
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-server.init	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-server.init	(revision 1839)
@@ -0,0 +1,86 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          invirt-console-server
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Invirt console proxy server
+# Description:       
+### END INIT INFO
+
+# Author: Invirt project <invirt@mit.edu>
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="the Invirt console server"
+NAME=invirt-console-server
+DAEMON=/usr/bin/invirt-consolefs
+MOUNTPOINT="/consolefs"
+DAEMON_ARGS="-f $MOUNTPOINT"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+GEN_FILES=(/etc/conserver/invirt-hosts.cf
+    /etc/remctl/acl/invirt-console-server
+    /etc/issue.net.no_tkt
+    /etc/nss-pgsql.conf)
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+. /lib/init/gen-files.sh
+. /lib/init/std-init.sh
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+    # Return
+    #   0 if daemon has been started
+    #   1 if daemon was already running
+    #   2 if daemon could not be started
+    
+    # Try to make sure fuse is setup
+    [ -e /dev/fuse ] || modprobe fuse || return 2
+    
+    if cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
+        return 1
+    fi
+    
+    gen_files
+    
+    daemon -r -O daemon.info -E daemon.err -n $NAME -- $DAEMON $DAEMON_ARGS || return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+    # Return
+    #   0 if daemon has been stopped
+    #   1 if daemon was already stopped
+    #   2 if daemon could not be stopped
+    #   other if a failure occurred
+    
+    if ! cat /proc/mounts | grep " $MOUNTPOINT " >/dev/null 2>&1; then
+        return 1
+    fi
+    
+    daemon --stop -n $NAME
+    RETVAL="$?"
+    [ "$RETVAL" = 2 ] && return 2
+    # Many daemons don't delete their pidfiles when they exit.
+    rm -f $PIDFILE
+}
+
+do_reload()
+{
+    gen_files
+    invoke-rc.d conserver-server reload
+}
+
+std_init "$1"
Index: package_tags/invirt-console/0.2.4/debian/invirt-console-server.install
===================================================================
--- package_tags/invirt-console/0.2.4/debian/invirt-console-server.install	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/invirt-console-server.install	(revision 1839)
@@ -0,0 +1,1 @@
+server/* .
Index: package_tags/invirt-console/0.2.4/debian/rules
===================================================================
--- package_tags/invirt-console/0.2.4/debian/rules	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/rules	(revision 1839)
@@ -0,0 +1,24 @@
+#!/usr/bin/make -f
+
+DEB_DIVERT_EXTENSION = .invirt
+DEB_TRANSFORM_FILES_invirt-console-server += \
+	/etc/init.d/bootmisc.sh.invirt \
+	/etc/nsswitch.conf.invirt \
+	/etc/nscd.conf.invirt \
+	/etc/pam.d/sshd.invirt \
+	/etc/ssh/sshd_config.debathena.invirt
+
+ifneq ($(wildcard /usr/share/base-files/nsswitch.conf),)
+    DEB_CHECK_FILES_SOURCE_/etc/nsswitch.conf.invirt = \
+        /usr/share/base-files/nsswitch.conf
+endif
+
+DEB_DIVERT_FILES_invirt-console-server += \
+	/etc/conserver/conserver.cf.invirt \
+	/etc/motd.invirt
+DEB_DIVERT_FILES_invirt-console-host += \
+	/etc/conserver/conserver.cf.invirt \
+	/etc/conserver/server.conf.invirt
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/config-package.mk
Index: package_tags/invirt-console/0.2.4/debian/transform_bootmisc.sh.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/debian/transform_bootmisc.sh.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/transform_bootmisc.sh.invirt	(revision 1839)
@@ -0,0 +1,14 @@
+#!/bin/bash
+patch -p0 -o /dev/fd/4 3<&0 4>&1 1>/dev/null <<EOF
+
+# Yes, I there's no context. But the lines being replaced are less
+# likely to change than the lines around them
+
+--- Ignored
++++ /dev/fd/3
+@@ -42,3 +42,2 @@
+-	# Update motd
+-	uname -snrvm > /var/run/motd
+-	[ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd
++	# Do not update motd
++	cp /etc/motd /var/run/motd
Index: package_tags/invirt-console/0.2.4/debian/transform_nscd.conf.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/debian/transform_nscd.conf.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/transform_nscd.conf.invirt	(revision 1839)
@@ -0,0 +1,6 @@
+#!/usr/bin/perl -0p
+s/^(\s*negative-time-to-live\s*passwd\s*).*$/${1}3/m or die;
+s/^(\s*negative-time-to-live\s*group\s*).*$/${1}3/m or die;
+s/^(\s*persistent\s*passwd\s*).*$/\1no/m or die;
+s/^(\s*persistent\s*group\s*).*$/\1no/m or die;
+
Index: package_tags/invirt-console/0.2.4/debian/transform_nsswitch.conf.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/debian/transform_nsswitch.conf.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/transform_nsswitch.conf.invirt	(revision 1839)
@@ -0,0 +1,3 @@
+#!/usr/bin/perl -0p
+s/^(passwd: .*)$/$1 pgsql/m or die;
+s/^(group: .*)$/$1 pgsql/m or die;
Index: package_tags/invirt-console/0.2.4/debian/transform_sshd.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/debian/transform_sshd.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/transform_sshd.invirt	(revision 1839)
@@ -0,0 +1,11 @@
+#!/bin/sh
+echo "# If they're not root, but their user exists (success),"
+echo 'auth    [success=ignore ignore=ignore default=1 module_unknown=die]   pam_succeed_if.so uid > 0'
+echo "# print the \"You don\'t have tickets\" error:"
+echo 'auth    [success=die ignore=reset default=die module_unknown=die]     pam_echo.so file=/etc/issue.net.no_tkt'
+echo "# If !(they are root),"
+echo 'auth    [success=1 ignore=ignore default=ignore module_unknown=die]   pam_succeed_if.so uid eq 0'
+echo "# print the \"your account doesn't exist\" error:"
+echo 'auth    [success=die ignore=reset default=die module_unknown=die]     pam_echo.so file=/etc/issue.net.no_user'
+echo
+exec cat
Index: package_tags/invirt-console/0.2.4/debian/transform_sshd_config.debathena.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/debian/transform_sshd_config.debathena.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/debian/transform_sshd_config.debathena.invirt	(revision 1839)
@@ -0,0 +1,2 @@
+#!/usr/bin/perl -0p
+s/^#?PrintLastLog .*$/PrintLastLog no/m or die;
Index: package_tags/invirt-console/0.2.4/host/etc/conserver/conserver.cf.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/host/etc/conserver/conserver.cf.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/host/etc/conserver/conserver.cf.invirt	(revision 1839)
@@ -0,0 +1,25 @@
+config * {
+	sslrequired yes;
+}
+
+# If no consoles are defined, as is the case when the host first boots
+# up, conserver will quit. This keeps it running.
+#
+# Should someone create a VM called dummy-console, their VM will
+# shadow over this one.
+console dummy-console {
+        master localhost;
+        type noop;
+}
+
+default * {
+	logfile /var/log/conserver/&.log;
+	timestamp "1lab";
+	rw *;
+	type exec;
+	exec sudo xm console d_f;
+	execsubst f=cs;
+}
+
+#include /etc/conserver/invirt-genconfig.cf
+#include /etc/conserver/invirt-consoles.cf
Index: package_tags/invirt-console/0.2.4/host/etc/conserver/invirt-genconfig.cf.mako
===================================================================
--- package_tags/invirt-console/0.2.4/host/etc/conserver/invirt-genconfig.cf.mako	(revision 1839)
+++ package_tags/invirt-console/0.2.4/host/etc/conserver/invirt-genconfig.cf.mako	(revision 1839)
@@ -0,0 +1,6 @@
+<% from invirt.config import structs as cfg %>\
+access * {
+       trusted 127.0.0.1;
+       trusted ${cfg.console.ip};
+       limited *;
+}
Index: package_tags/invirt-console/0.2.4/host/etc/conserver/server.conf.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/host/etc/conserver/server.conf.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/host/etc/conserver/server.conf.invirt	(revision 1839)
@@ -0,0 +1,2 @@
+OPTS='-p 3109  '
+ASROOT=
Index: package_tags/invirt-console/0.2.4/host/usr/sbin/invirt-update-conserver
===================================================================
--- package_tags/invirt-console/0.2.4/host/usr/sbin/invirt-update-conserver	(revision 1839)
+++ package_tags/invirt-console/0.2.4/host/usr/sbin/invirt-update-conserver	(revision 1839)
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+import subprocess
+import os
+import socket
+from invirt.config import structs as config
+
+def live_vms():
+    p = subprocess.Popen(['/usr/sbin/xm', 'list'], stdout=subprocess.PIPE)
+    p.wait()
+    output = p.stdout.read()
+    vms = [x.split()[0][2:] for x in output.splitlines() if x.startswith('d_')]
+    return vms
+
+def reload_conserver():
+    p = subprocess.Popen(['/usr/sbin/invoke-rc.d', 'conserver-server', 'reload'], stdout=subprocess.PIPE)
+    p.wait()
+
+if __name__ == '__main__':
+    hostname = socket.getfqdn().lower()
+    realm = config.kerberos.realm
+    principal = 'host/'+hostname+'@'+realm
+    conftext = '\n'.join('console %s { master %s; }' % (vm, hostname)
+                         for vm in live_vms())
+    f = open('/etc/conserver/invirt-consoles.cf', 'w')
+    f.write(conftext)
+    f.close()
+    reload_conserver()
+    subprocess.call(['/usr/bin/kinit', '-k', '-t', '/etc/krb5.keytab',
+                     principal])
+    subprocess.call(['/usr/bin/remctl', config.console.hostname,
+                     'console', 'update', conftext])
Index: package_tags/invirt-console/0.2.4/server/etc/conserver/conserver.cf.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/conserver/conserver.cf.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/conserver/conserver.cf.invirt	(revision 1839)
@@ -0,0 +1,23 @@
+# default config for console
+config * {
+	sslrequired yes;
+}
+# If no consoles are defined, as is the case when the host first boots
+# up, conserver will quit. This keeps it running.
+#
+# Should someone create a VM called dummy-console, their VM will
+# shadow over this one
+console dummy-console {
+        master localhost;
+        type noop;
+}
+
+default * {
+        type exec;
+}
+access * {
+        trusted 127.0.0.1;
+        limited *;
+}
+
+#include /etc/conserver/invirt-hosts.cf
Index: package_tags/invirt-console/0.2.4/server/etc/conserver/console.cf
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/conserver/console.cf	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/conserver/console.cf	(revision 1839)
@@ -0,0 +1,5 @@
+config * {
+  master localhost;
+  port   3109;
+  sslenabled yes;
+}
Index: package_tags/invirt-console/0.2.4/server/etc/conserver/invirt-hosts.cf.mako
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/conserver/invirt-hosts.cf.mako	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/conserver/invirt-hosts.cf.mako	(revision 1839)
@@ -0,0 +1,4 @@
+<% from invirt.config import structs as cfg %>\
+% for h in cfg.hosts:
+#include /etc/conserver/conf.d/${h.hostname}
+% endfor
Index: package_tags/invirt-console/0.2.4/server/etc/issue.net.no_tkt.mako
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/issue.net.no_tkt.mako	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/issue.net.no_tkt.mako	(revision 1839)
@@ -0,0 +1,4 @@
+<% from invirt.config import structs as cfg %>\
+You must login to the ${cfg.console.hostname} console server using
+Kerberos tickets, but your ssh client did not pass a valid ticket to the
+console server.
Index: package_tags/invirt-console/0.2.4/server/etc/issue.net.no_user
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/issue.net.no_user	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/issue.net.no_user	(revision 1839)
@@ -0,0 +1,2 @@
+The VM you are attempting to access does not appear to exist.
+
Index: package_tags/invirt-console/0.2.4/server/etc/motd.invirt
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/motd.invirt	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/motd.invirt	(revision 1839)
@@ -0,0 +1,3 @@
+
+Type Ctrl-e, then c, then . to escape from the console
+
Index: package_tags/invirt-console/0.2.4/server/etc/nss-pgsql.conf.mako
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/nss-pgsql.conf.mako	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/nss-pgsql.conf.mako	(revision 1839)
@@ -0,0 +1,10 @@
+<% from invirt.config import structs as cfg %>
+connectionstring = host=${cfg.db.host} dbname=${cfg.db.dbname} user=${cfg.db.user} port=${cfg.db.port}
+
+getpwnam = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines WHERE name = $1
+getpwuid = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines WHERE machine_id + 1000 = $1
+allusers = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines
+getgrnam = SELECT name, 'x', machine_id + 1000, NULL FROM machines WHERE name = $1
+getgrgid = SELECT name, 'x', machine_id + 1000, NULL FROM machines WHERE machine_id + 1000 = $1
+groups_dyn = SELECT NULL LIMIT 0;
+allgroups = SELECT name, 'x', machine_id + 1000, NULL FROM machines
Index: package_tags/invirt-console/0.2.4/server/etc/remctl/acl/invirt-console-server.mako
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/remctl/acl/invirt-console-server.mako	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/remctl/acl/invirt-console-server.mako	(revision 1839)
@@ -0,0 +1,4 @@
+<% from invirt.config import structs as cfg %>\
+% for h in cfg.hosts:
+host/${h.hostname}@${cfg.kerberos.realm}
+% endfor
Index: package_tags/invirt-console/0.2.4/server/etc/remctl/conf.d/invirt-console
===================================================================
--- package_tags/invirt-console/0.2.4/server/etc/remctl/conf.d/invirt-console	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/etc/remctl/conf.d/invirt-console	(revision 1839)
@@ -0,0 +1,1 @@
+console update /usr/sbin/invirt-console-update /etc/remctl/acl/invirt-console-server
Index: package_tags/invirt-console/0.2.4/server/usr/bin/invirt-consolefs
===================================================================
--- package_tags/invirt-console/0.2.4/server/usr/bin/invirt-consolefs	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/usr/bin/invirt-consolefs	(revision 1839)
@@ -0,0 +1,94 @@
+#!/usr/bin/python
+
+import routefs
+from routes import Mapper
+
+from syslog import *
+from time import time
+
+import os
+import errno
+
+from invirt.config import structs as config
+from invirt import database
+
+realpath = "/home/machines/"
+
+class ConsoleFS(routefs.RouteFS):
+    """
+    ConsoleFS creates a series of subdirectories each mirroring the same real
+    directory, except for a single file - the .k5login - which is dynamically
+    generated for each subdirectory
+    """
+    
+    def __init__(self, *args, **kw):
+        """Initialize the filesystem and set it to allow_other access besides
+        the user who mounts the filesystem (i.e. root)
+        """
+        super(ConsoleFS, self).__init__(*args, **kw)
+        self.lasttime = 0
+        self.machines = []
+        self.fuse_args.add("allow_other", True)
+        
+        openlog('invirt-consolefs ', LOG_PID, LOG_DAEMON)
+        
+        syslog(LOG_DEBUG, 'Init complete.')
+    
+    def make_map(self):
+        m = Mapper()
+        m.connect('', controller='getMachines')
+        m.connect(':machine', controller='getMirror')
+        m.connect(':machine/.k5login', controller='getK5login')
+        m.connect(':machine/*(path)', controller='getMirror')
+        return m
+    
+    def recache(self):
+        if time() - self.lasttime > 5:
+            self.lasttime = time()
+            database.clear_cache()
+            self.machines = dict((machine.name, machine) for machine in database.session.query(database.Machine).all())
+
+    def getMachines(self, **kw):
+        self.recache()
+        return self.machines.keys()
+    
+    def getMirror(self, machine, path='', **kw):
+        """Translate the path into its realpath equivalent, and return that
+        """
+        real = realpath + path
+        if os.path.isdir(real):
+            # The list is converted to a set so that we can handle the case 
+            # where there is already a .k5login in the realpath gracefully    
+            return routefs.Directory(set(os.listdir(real) + ['.k5login']))
+        elif os.path.islink(real):
+            return routefs.Symlink(os.readlink(real))
+        elif os.path.isfile(real):
+            return open(real).read()
+        else:
+            return -errno.EINVAL
+    
+    def getK5login(self, machine, **kw):
+        self.recache()
+        machine = self.machines[machine]
+        users = [acl.user for acl in machine.acl]
+        return "\n".join(map(self.userToPrinc, users) + [''])
+    
+    def mirrorPath(self, path):
+        """Translate a virtual path to its real path counterpart"""
+        return realpath + "/".join(getParts(path)[1:])
+    
+    def userToPrinc(self, user):
+        """Convert Kerberos v4-style names to v5-style and append a default
+        realm if none is specified
+        """
+        if '@' in user:
+            (princ, realm) = user.split('@')
+        else:
+            princ = user
+            realm = config.kerberos.realm
+        
+        return princ.replace('.', '/') + '@' + realm
+
+if __name__ == '__main__':
+    database.connect()
+    routefs.main(ConsoleFS)
Index: package_tags/invirt-console/0.2.4/server/usr/bin/invirt-consolesh
===================================================================
--- package_tags/invirt-console/0.2.4/server/usr/bin/invirt-consolesh	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/usr/bin/invirt-consolesh	(revision 1839)
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec /usr/bin/console "$USER"
Index: package_tags/invirt-console/0.2.4/server/usr/sbin/invirt-console-update
===================================================================
--- package_tags/invirt-console/0.2.4/server/usr/sbin/invirt-console-update	(revision 1839)
+++ package_tags/invirt-console/0.2.4/server/usr/sbin/invirt-console-update	(revision 1839)
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+import sys
+import os
+import subprocess
+
+def main(args):
+  contents = args[2]
+  hostname = os.environ['REMOTE_HOST'].lower()
+  f = file('/etc/conserver/conf.d/'+hostname, 'w')
+  f.write(contents)
+  f.close()
+  p = subprocess.Popen(['/usr/sbin/invoke-rc.d', 'conserver-server', 'reload'],
+                       stdout=subprocess.PIPE)
+  p.wait()
+  return 0
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))
