* 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:10:36 -0500
+ -- Evan Broder <broder@mit.edu> Sun, 07 Dec 2008 10:17:06 -0500
invirt-console-server (0.1.3) unstable; urgency=low
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
--- /dev/null
+#
+# cron-jobs for invirt-console-host
+# Refresh the list of active VM consoles
+#
+
+MAILTO=root
+
+*/5 * * * * root python /usr/sbin/invirt-update-conserver
--- /dev/null
+#! /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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
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
--- /dev/null
+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
--- /dev/null
+<% from invirt.config import structs as cfg %>\
+access * {
+ trusted 127.0.0.1;
+ trusted ${cfg.console.ip};
+ limited *;
+}
--- /dev/null
+OPTS='-p 3109 '
+ASROOT=
--- /dev/null
+#!/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.authn[0].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])