Remove the automounter lookup script from the RPM
authorSteve Muir <smuir@cs.princeton.edu>
Wed, 2 Nov 2005 23:55:27 +0000 (23:55 +0000)
committerSteve Muir <smuir@cs.princeton.edu>
Wed, 2 Nov 2005 23:55:27 +0000 (23:55 +0000)
auto.pl_sshd.py [deleted file]
pl_sshd.spec

diff --git a/auto.pl_sshd.py b/auto.pl_sshd.py
deleted file mode 100644 (file)
index f30c3c5..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2005 Princeton University
-#
-# autofs(5) executable map for /var/pl_sshd/keys/
-#
-
-import cStringIO
-import os
-import pwd
-import pycurl
-import sys
-
-
-
-def abort(msg):
-    print >>sys.stderr, msg
-    sys.exit(1)
-    
-if len(sys.argv) != 2:
-    print >>sys.stderr, "usage:\n    %s <slicename>" % sys.argv[0]
-    sys.exit(1)
-
-slice = sys.argv[1]
-try:
-    (name, passwd, uid, gid, comment, home, sh) = pwd.getpwnam(slice)
-except KeyError, ex:
-    abort("no such user: " + slice)
-
-result = "--bind,-r :"
-
-sshdir = home + "/.ssh"
-keyfile = sshdir + "/authorized_keys"
-
-# check whether authorized_keys exists in the real home dir
-if os.access(keyfile, os.R_OK):
-    # yes - use it
-    result += sshdir
-else:
-    # no - look in the vserver
-    # try to get keys from KeySensor
-    sys.stderr.write("Retrieving SSH keys for %s... " % slice)
-    pycurl.global_init(pycurl.GLOBAL_ALL)
-    c = pycurl.Curl()
-    c.setopt(pycurl.URL, "http://localhost:815/keys?slice=" + slice)
-    out = cStringIO.StringIO()
-    c.setopt(pycurl.WRITEFUNCTION, out.write)
-    c.setopt(pycurl.NOSIGNAL, 1)
-    c.setopt(pycurl.TIMEOUT, 1)
-    try:
-        c.perform()
-        rc = c.getinfo(pycurl.HTTP_CODE)
-        if rc != 200:
-            abort("HTTP error: " + str(rc))
-    except pycurl.error, ex:
-        if ex[0] == 28:  # XXX - pycurl doesn't define error constants
-            abort("timed-out")
-        abort("curl error: " + ex[1])
-    keydata = out.getvalue()
-
-    # try to update keyfile
-    vsbase = "/vservers/" + slice
-    os.chroot(vsbase)
-    os.setgid(gid)
-    os.setuid(uid)
-    if not os.path.isdir(sshdir):
-        os.mkdir(sshdir, 0700)
-        
-    f = file(keyfile, "w")
-    f.write(keydata)
-    f.close()
-    os.chmod(keyfile, 0600)
-    result += vsbase + sshdir
-    print >>sys.stderr, "succeeded."
-
-print result
index 2bc2551..da87b21 100644 (file)
@@ -33,7 +33,6 @@ directory.
 mkdir -p $RPM_BUILD_ROOT/var/pl_sshd/keys
 install -D -m 0755 pl_sshd.sh $RPM_BUILD_ROOT/usr/local/sbin/pl_sshd
 install -D -m 0755 pl_sshd $RPM_BUILD_ROOT/etc/init.d/pl_sshd
-install -D -m 0755 auto.pl_sshd.py $RPM_BUILD_ROOT/etc/auto.pl_sshd
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -43,7 +42,6 @@ rm -rf $RPM_BUILD_ROOT
 %dir /var/pl_sshd/keys
 %attr(0755,root,root) /usr/local/sbin/pl_sshd
 %attr(0755,root,root) /etc/init.d/pl_sshd
-%attr(0755,root,root) /etc/auto.pl_sshd
 
 %pre
 
@@ -109,6 +107,10 @@ fi
 
 
 %changelog
+* Wed Nov  2 2005 Steve Muir <smuir@cs.princeton.edu>
+- don't fanny around using the automounter to access ssh keys in vservers,
+  pl_conf now writes them into the normal locations
+
 * Wed Oct 12 2005 Steve Muir <smuir@cs.princeton.edu>
 - fix pl_sshd script name and argv[0] to satisfy re-exec requirements