Don't proxy requests for the VNC cert if the requested hostname isn't invirt-remote-server/0.0.11
authorEvan Broder <broder@mit.edu>
Wed, 29 Oct 2008 03:17:24 +0000 (23:17 -0400)
committerEvan Broder <broder@mit.edu>
Wed, 29 Oct 2008 03:17:24 +0000 (23:17 -0400)
an Invirt host

svn path=/trunk/packages/invirt-remote-server/; revision=1411

debian/changelog
files/usr/sbin/invirt-remote-vnccert

index a971e00..c1d2208 100644 (file)
@@ -1,3 +1,10 @@
+invirt-remote-server (0.0.11) unstable; urgency=low
+
+  * Don't proxy requests for the VNC cert if the requested hostname isn't
+    an Invirt host
+
+ -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 23:17:10 -0400
+
 invirt-remote-server (0.0.10) unstable; urgency=low
 
   * All remctls of type 'web' have the same ACL - glob them together
index acf2816..019256a 100755 (executable)
@@ -1,6 +1,26 @@
-#!/bin/bash
-# Get the VNC cert for the host passed as the first argument
+#!/usr/bin/python
 
-klist -s || kinit -k
+"""
+Retrieves the VNC certificate from an Invirt host
+"""
 
-exec remctl "$1" remote web vnccert
+from invirt.config import structs as config
+from subprocess import Popen, call, PIPE
+import sys
+
+
+def main(argv):
+    if len(argv) < 2:
+        print >> sys.stderr, "usage: invirt-remote-vnccert <host>"
+        return 2
+    
+    host = argv[1]
+    
+    if host not in list(i.hostname for i in config.hosts):
+        print >> sys.stderr, "Invalid hostname specified"
+        return 1
+    
+    return call(['remctl', host, 'remote', 'web', 'vnccert'])
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))