From: Greg Price Date: Mon, 5 May 2008 04:00:03 +0000 (-0400) Subject: first version of remote-server package X-Git-Tag: sipb-xen-remote-server/0.2~33 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/commitdiff_plain/c3517663370ab241d02acb939903d569997847a9 first version of remote-server package svn path=/trunk/packages/sipb-xen-remote-server/; revision=502 --- c3517663370ab241d02acb939903d569997847a9 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..d285728 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +sipb-xen-remote-server (0.1) unstable; urgency=low + + * First draft. + + -- Greg Price Sun, 30 Mar 2008 01:08:50 -0400 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..4d90648 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: sipb-xen-remote-server +Section: servers +Priority: important +Maintainer: sipb-xen@mit.edu +Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: sipb-xen-remote-server +Architecture: all +Provides: ${diverted-files} +Conflicts: ${diverted-files} +Depends: ${shlibs:Depends}, ${misc:Depends}, debathena-kerberos-config, fuse-utils, openssh-server, python-fuse, sipb-xen-chrony-config, sipb-xen-database-common, remctl-server, remctl-client +Description: SIPB Xen remote-control server + This package should be installed to set up the remote-control server. diff --git a/debian/control.in b/debian/control.in new file mode 100644 index 0000000..5a4d34b --- /dev/null +++ b/debian/control.in @@ -0,0 +1,14 @@ +Source: sipb-xen-remote-server +Section: servers +Priority: important +Maintainer: sipb-xen@mit.edu +Build-Depends: @cdbs@ +Standards-Version: 3.7.2 + +Package: sipb-xen-remote-server +Architecture: all +Provides: ${diverted-files} +Conflicts: ${diverted-files} +Depends: ${shlibs:Depends}, ${misc:Depends}, debathena-kerberos-config, fuse-utils, openssh-server, python-fuse, sipb-xen-chrony-config, sipb-xen-database-common, remctl-server, remctl-client +Description: SIPB Xen remote-control server + This package should be installed to set up the remote-control server. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..7789434 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,3 @@ +This package was created for internal use of the SIPB Xen Project of +the MIT Student Information Processing Board. Ask sipb-xen@mit.edu if +you have questions about redistribution. diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..974db80 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +sipb-xen-remote-server_0.1_all.deb servers important diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..0baf8cf --- /dev/null +++ b/debian/rules @@ -0,0 +1,11 @@ +#!/usr/bin/make -f + +DEB_AUTO_UPDATE_DEBIAN_CONTROL = 1 +DEB_DIVERT_EXTENSION = .sipb-xen +#DEB_DIVERT_FILES_sipb-xen-remote-server += \ +# /etc/init.d/bootmisc.sh \ +# /etc/nscd.conf \ +# /etc/nsswitch.conf \ +# /etc/ssh/sshd_config + +include /usr/share/cdbs/1/rules/debhelper.mk diff --git a/debian/sipb-xen-remote-server.install b/debian/sipb-xen-remote-server.install new file mode 100644 index 0000000..9da31b3 --- /dev/null +++ b/debian/sipb-xen-remote-server.install @@ -0,0 +1 @@ +files/* . diff --git a/files/etc/remctl/acl/web b/files/etc/remctl/acl/web new file mode 100644 index 0000000..be17dd3 --- /dev/null +++ b/files/etc/remctl/acl/web @@ -0,0 +1,2 @@ +price/root@ATHENA.MIT.EDU +daemon/sipb-xen.mit.edu@ATHENA.MIT.EDU diff --git a/files/etc/remctl/conf.d/sipb-xen-auto b/files/etc/remctl/conf.d/sipb-xen-auto new file mode 100644 index 0000000..45e6580 --- /dev/null +++ b/files/etc/remctl/conf.d/sipb-xen-auto @@ -0,0 +1 @@ +include /etc/remctl/sipb-xen-auto/machine.d diff --git a/files/etc/remctl/conf.d/sipb-xen-web b/files/etc/remctl/conf.d/sipb-xen-web new file mode 100644 index 0000000..20055fb --- /dev/null +++ b/files/etc/remctl/conf.d/sipb-xen-web @@ -0,0 +1,11 @@ +web lvcreate /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web lvremove /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web lvrename /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web lvresize /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web lvcopy /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web vmboot /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web register /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web moveregister /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web unregister /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web remctl-moira-update /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web +web listvms /usr/sbin/sipb-xen-remote-proxy-web /etc/remctl/acl/web diff --git a/files/usr/sbin/sipb-xen-remctl-update b/files/usr/sbin/sipb-xen-remctl-update new file mode 100755 index 0000000..f0254b9 --- /dev/null +++ b/files/usr/sbin/sipb-xen-remctl-update @@ -0,0 +1,124 @@ +#!/bin/sh +DIR=/etc/remctl/sipb-xen-auto +TEMPLATE=$DIR/conf.template +MACHINEDIR=$DIR/machine.d +MOIRADIR=$DIR/moira-acl +MOIRATMP=$DIR/moira-tmp +MACHINETMP=$DIR/machine-list-tmp +AUTOMACHINELIST=$DIR/auto-machine-list +AUTOMOIRALIST=$DIR/auto-moira-list +BINDIR=/usr/sbin +ACLDIR=$DIR/acl + +update_machine() +{ + machine="$1" + sed "s/#MACHINENAME#/$machine/g" "$TEMPLATE" | \ + sed "s,#BINDIR#,$BINDIR,g" >| "$MACHINETMP" + if ! cmp -s "$MACHINEDIR/$machine" "$MACHINETMP"; then + mv "$MACHINETMP" "$MACHINEDIR/$machine" + else + rm -f "$MACHINETMP" + fi +} + +update_moiragroup() +{ + group="$1" + # Should perhaps replace with LDAP, but fine for now. + + # We should do more careful error checking so we don't take away + # all bits and delete the moira-acl files whenever there's an AFS + # outage. + pts membership system:"$group" -noauth | tail -n+2 | \ + sed 's/\./\//' | \ + sed 's/^ //' | \ + sed 's/$/@ATHENA.MIT.EDU/g' >| "$MOIRATMP" + if test -s "$MOIRATMP"; then + if ! cmp -s "$MOIRADIR/$group" "$MOIRATMP"; then + mv "$MOIRATMP" "$MOIRADIR/$group" + fi + else + if test -e "$MOIRADIR/$group"; then + rm "$MOIRADIR/$group" + fi + fi + rm -f "$MOIRATMP" +} + +check_machine_name() +{ + machinename="$1" + if ! perl -0e 'exit($ARGV[0] !~ /^[A-Za-z0-9][A-Za-z0-9._-]*$/)' -- "$machinename"; then + echo "Bad machine name" + exit 1 + fi +} + +case "$1" in + moiragroup) + update_moiragroup "$2" + ;; + + all_machines) + # update the remctl.conf definitions + for machine in `cat "$AUTOMACHINELIST"`; do + update_machine "$machine" + done + ;; + all_moira) + # update our moira ACL lists + for group in `cat "$AUTOMOIRALIST"`; do + update_moiragroup "$group" + done + ;; + auto_machine_list) + # update the list of maintained machines + /bin/ls "$ACLDIR" >| "$AUTOMACHINELIST" + ;; + auto_moira_list) + # update the moira list-of-lists + # /bin/ls "$MOIRADIR" >| "$AUTOMOIRALIST" # BAD IDEA in case of outage + + # This extracts the list of all moira lists we care about, and updates those. + grep -R moira "$ACLDIR/" /etc/remctl/acl/ | perl -pe 's/.*moira-acl\/(.*)/$1/g' >| "$AUTOMOIRALIST" + ;; + unregister) + machine="$2" + check_machine_name "$machine" + rm -f "$ACLDIR"/"$machine" + rm -f "$MACHINEDIR"/"$machine" + "$0" web + ;; + moveregister) + oldmachine="$2" + newmachine="$3" + check_machine_name "$oldmachine" + check_machine_name "$newmachine" + mv "$ACLDIR"/"$oldmachine" "$ACLDIR"/"$newmachine" + rm -f "$MACHINEDIR"/"$oldmachine" + "$0" web + ;; + register) + machine="$2" + check_machine_name "$machine" + if [ -e "$ACLDIR"/"$machine" ]; then + echo "Machine already registered" + exit 1 + fi + echo "include /etc/remctl/acl/web" > "$ACLDIR/$machine" + "$0" web + ;; + web) + "$0" auto_machine_list + "$0" all_machines + ;; + remctl-moira-update|all) + "$0" auto_machine_list + "$0" all_machines + "$0" auto_moira_list + "$0" all_moira + ;; +esac + +exit 0 diff --git a/files/usr/sbin/sipb-xen-remote-proxy b/files/usr/sbin/sipb-xen-remote-proxy new file mode 100755 index 0000000..4a1364e --- /dev/null +++ b/files/usr/sbin/sipb-xen-remote-proxy @@ -0,0 +1,5 @@ +#!/bin/sh +# invoke as sipb-xen-remote-proxy-$TYPE, with "TYPE" in the remctl sense. +kinit -k host/sipb-vm-58.mit.edu +#echo remctl black-mesa remote ${0##*-} "$@" +remctl black-mesa remote ${0##*-} "$@" diff --git a/files/usr/sbin/sipb-xen-remote-proxy-control b/files/usr/sbin/sipb-xen-remote-proxy-control new file mode 120000 index 0000000..10a01cb --- /dev/null +++ b/files/usr/sbin/sipb-xen-remote-proxy-control @@ -0,0 +1 @@ +sipb-xen-remote-proxy \ No newline at end of file diff --git a/files/usr/sbin/sipb-xen-remote-proxy-web b/files/usr/sbin/sipb-xen-remote-proxy-web new file mode 120000 index 0000000..10a01cb --- /dev/null +++ b/files/usr/sbin/sipb-xen-remote-proxy-web @@ -0,0 +1 @@ +sipb-xen-remote-proxy \ No newline at end of file