Tagging module pl_sshd - pl_sshd-1.0-11
[pl_sshd.git] / pl_sshd.spec
index 0e3628e..b7408f1 100644 (file)
@@ -1,19 +1,35 @@
+#
+# $Id$
+#
+%define url $URL$
+
+%define name pl_sshd
+%define version 1.0
+%define taglevel 11
+
+%define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+
+Vendor: PlanetLab
+Packager: PlanetLab Central <support@planet-lab.org>
+Distribution: PlanetLab %{plrelease}
+URL: %(echo %{url} | cut -d ' ' -f 2)
+
 Summary: SSH server config for PlanetLab
-Name: pl_sshd
-Version: 0.1
-Release: 1
-Requires: automount, sshd
-Copyright: GPL
-URL: http://www.planet-lab.org
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Requires: openssh-server
+License: GPL
 Group: System Environment/Base
-Source: %{_fullname}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+
+Source0: %{name}-%{version}.tar.bz2
 
 %description 
-SSH server configuration for PlanetLab nodes.  Configures an automounted
+SSH server configuration for PlanetLab nodes. Configures an automounted
 directory as source for authorized_keys files and points sshd to that
 directory.
 
-Created from $Header$.
 %prep
 %setup
 
@@ -21,37 +37,78 @@ Created from $Header$.
 
 
 %install
-install -m 0755 -o root -g root pl_sshd.sh $RPM_BUILD_ROOT/usr/local/sbin
-install -m 0755 -o root -g root pl_sshd $RPM_BUILD_ROOT/etc/init.d
-install -m 0755 -o root -g root auto.pl_sshd $RPM_BUILD_ROOT/etc
-echo "OPTIONS='-p 806'" >$RPM_BUILD_ROOT/etc/sysconfig/sshd
+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
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root)
-%attr(0755,root,root) /usr/local/sbin/pl_sshd.sh
+%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
 
 
 %post
-RUNLEVEL=`/sbin/runlevel`
-
-if [ "$1" -ge 1 ]; then
-       chkconfig --add pl_sshd
-
-       if [[ "$RUNLEVEL" != "unknown" ]]; then
-               /etc/init.d/pl_sshd restart
-       fi
+# 1 = install, 2 = upgrade/reinstall
+if [ $1 -ge 1 ]; then
+    # link sshd pam config to pl_sshd so that we can actually login
+    pam_pl_sshd=/etc/pam.d/pl_sshd
+    [ -r $pam_pl_sshd ] || ln -s sshd $pam_pl_sshd
+
+    chkconfig --add pl_sshd
+
+    if [ "$1" -gt "1" ]; then  # upgrading
+       #
+       # remove funky config options for sshd (so that when we restart
+       # things will operate normally i.e., without automount magic)
+       #
+       rm -f /etc/sysconfig/sshd
+
+       #
+       # stop automounter, remove entry from auto.master, restart if
+       # necessary
+       #
+       [ "$PL_BOOTCD" != "1" ] && /etc/init.d/autofs stop
+       auto_master=/etc/auto.master
+       orig=$auto_master
+       backup=$auto_master.pl_sshd.post
+       mv $orig $backup
+       sed -e '\,^/var/pl_sshd/keys,d' $backup > $orig && rm $backup || \
+           mv $backup $orig
+
+       [ "$PL_BOOTCD" != "1" ] && /etc/init.d/autofs start
+    fi
+
+    if [[ "$PL_BOOTCD" != "1" ]]; then
+       #
+       # don't try to start/restart various things automatically,
+       # it's too ugly (particularly if we're upgrading while
+       # connected over ssh)
+       #
+       echo
+       echo "You need to manually restart autofs and sshd, and"
+       echo "start the pl_sshd (ssh on port 806) service."
+       echo "Make sure you know what you're doing, particularly"
+       echo "if you're making this change over an ssh connection."
+       echo
+    fi
 fi
 
 %preun
-if [ "$1" = 0 ]; then
+# 0 = erase, 1 = upgrade
+if [ $1 -eq 0 ]; then
+       #
+       # stop pl_sshd, remove it from rcX.d init dirs, remove link
+       # to sshd's pam config
+       #
+       [ "$PL_BOOTCD" = "1" ] || /etc/init.d/pl_sshd stop || :
        chkconfig --del pl_sshd
+       rm -f /etc/pam.d/pl_sshd
 fi
 
 
@@ -59,30 +116,19 @@ fi
 
 
 %changelog
-* Tue Nov 25 2003 Steve Muir <smuir@cs.princeton.edu>
-- fixed a couple of Node Manager bugs:
-  - bootstrapping pl_conf state when boot server unreachable
-  - canonical hostnames should be all lower-case
-- fixup UID and GID of users within vservers to match real world
-- enable access to dynamic slices through port 806 sshd
-
-* Sun Oct 26 2003 Aaron Klingaman <Aaron.L.Klingaman@intel.com>
-- readded start/stop only when runlevel is known, for install purposes
-
-* Thu Oct 16 2003 Jeff Sedayao <Jeff.Sedayao@intel.com>
-- Fixed bug in pl_conf  - it was getting negative wait times.  Also added
-  duke4 as a trusted user. 
+* Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - pl_sshd-1.0-11
+- 
 
-* Tue Oct  8 2003 Jeff Sedayao <Jeff.Sedayao@intel.com>
-- Removed special fetch login from init function, updated release
+* 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
 
-* Tue Oct  7 2003 Jeff Sedayao <Jeff.Sedayao@intel.com>
-- Moved special fetch login into main loop, fix account deletion
-  problem
+* Wed Oct 12 2005 Steve Muir <smuir@cs.princeton.edu>
+- fix pl_sshd script name and argv[0] to satisfy re-exec requirements
 
-* Tue Oct  7 2003 Aaron Klingaman <Aaron.L.Klingaman@intel.com>
-- Commented out code to start pl_* upon install
+* Thu Apr  7 2005 Steve Muir <smuir@cs.princeton.edu>
+- convert auto.pl_sshd to a python script (simpler and less error-prone)
 
-* Wed Aug 26 2003 Tammo Spalink <tammo.spalink@intel.com>
-- Initial build.
+* Mon Dec  1 2003 Steve Muir <smuir@cs.princeton.edu>
+- initial creation from files in sidewinder repository