3 %define release 8.planetlab%{?date:.%{date}}
6 Packager: PlanetLab Central <support@planet-lab.org>
7 Distribution: PlanetLab 3.0
8 URL: http://cvs.planet-lab.org/cvs/pl_sshd
10 Summary: SSH server config for PlanetLab
14 Requires: autofs, openssh-server
16 Group: System Environment/Base
17 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
19 Source0: %{name}-%{version}.tar.bz2
22 SSH server configuration for PlanetLab nodes. Configures an automounted
23 directory as source for authorized_keys files and points sshd to that
33 mkdir -p $RPM_BUILD_ROOT/var/pl_sshd/keys
34 install -D -m 0755 pl_sshd.sh $RPM_BUILD_ROOT/usr/local/sbin/pl_sshd.sh
35 install -D -m 0755 pl_sshd $RPM_BUILD_ROOT/etc/init.d/pl_sshd
36 install -D -m 0755 auto.pl_sshd.py $RPM_BUILD_ROOT/etc/auto.pl_sshd
39 rm -rf $RPM_BUILD_ROOT
43 %dir /var/pl_sshd/keys
44 %attr(0755,root,root) /usr/local/sbin/pl_sshd.sh
45 %attr(0755,root,root) /etc/init.d/pl_sshd
46 %attr(0755,root,root) /etc/auto.pl_sshd
52 RUNLEVEL=`/sbin/runlevel`
54 # 1 = install, 2 = upgrade/reinstall
56 # create the magic directory for automount
57 keydir=/var/pl_sshd/keys
59 # add appropriate entry to auto.master
60 auto_master=/etc/auto.master
61 auto_master_entry="$keydir /etc/auto.pl_sshd"
62 grep -qF "$auto_master_entry" $auto_master || \
63 echo $auto_master_entry >>$auto_master
66 # use the sysconfig file to tell our system sshd to look in the
67 # magic location for authorized_keys files
69 sysconfig_sshd=/etc/sysconfig/sshd
70 [ -r $sysconfig_sshd ] && \
71 mv $sysconfig_sshd $sysconfig_sshd.pl_sshd
72 echo "OPTIONS='-o \"AuthorizedKeysFile $keydir/%u/authorized_keys\"'" \
75 # link sshd pam config to pl_sshd so that we can actually login
76 pam_pl_sshd=/etc/pam.d/pl_sshd
77 [ -r $pam_pl_sshd ] || ln -s sshd $pam_pl_sshd
79 chkconfig --add pl_sshd
81 if [[ "$RUNLEVEL" != "unknown" ]]; then
83 # don't try to start/restart various things automatically,
84 # it's too ugly (particularly if we're upgrading while
88 echo "You need to manually restart autofs and sshd, and"
89 echo "start the pl_sshd (ssh on port 806) service."
90 echo "Make sure you know what you're doing, particularly"
91 echo "if you're making this change over an ssh connection."
97 RUNLEVEL=`/sbin/runlevel`
99 # 0 = erase, 1 = upgrade
100 if [ $1 -eq 0 ]; then
102 # stop pl_sshd, remove it from rcX.d init dirs, remove link
103 # to sshd's pam config
105 [ "$RUNLEVEL" = "unknown" ] || /etc/init.d/pl_sshd stop || :
106 chkconfig --del pl_sshd
107 rm -f /etc/pam.d/pl_sshd
110 # remove funky config options for sshd (so that when we restart
111 # things will operate normally i.e., without automount magic)
113 rm /etc/sysconfig/sshd
114 if [ "$RUNLEVEL" != "unknown" ]; then
116 echo "You need to manually restart sshd."
117 echo "Make sure you know what you're doing, particularly"
118 echo "if you're making this change over an ssh connection."
123 # stop automounter, remove entry from auto.master, restart if
126 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs stop
127 auto_master=/etc/auto.master
128 mv $auto_master $auto_master.pl_sshd.preun
129 sed -e '\,^/var/pl_sshd/keys,d' $auto_master.pl_sshd.preun \
132 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs start
140 * Thu Apr 7 2005 Steve Muir <smuir@cs.princeton.edu>
141 - convert auto.pl_sshd to a python script (simpler and less error-prone)
143 * Mon Dec 1 2003 Steve Muir <smuir@cs.princeton.edu>
144 - initial creation from files in sidewinder repository