1 Summary: SSH server config for PlanetLab
5 Requires: autofs, openssh-server
7 URL: http://www.planet-lab.org
8 Group: System Environment/Base
9 Source: %{_fullname}.tar.gz
12 SSH server configuration for PlanetLab nodes. Configures an automounted
13 directory as source for authorized_keys files and points sshd to that
16 $Header: /cvs/pl_sshd/pl_sshd.spec,v 1.2 2003/12/01 14:56:00 sjm-pl_sshd Exp $.
24 mkdir -p $RPM_BUILD_ROOT/usr/local/sbin
25 mkdir -p $RPM_BUILD_ROOT/etc/{sysconfig,init.d}
26 mkdir -p $RPM_BUILD_ROOT/var/pl_sshd/keys
27 install -m 0755 pl_sshd.sh $RPM_BUILD_ROOT/usr/local/sbin
28 install -m 0755 pl_sshd $RPM_BUILD_ROOT/etc/init.d
29 install -m 0755 auto.pl_sshd $RPM_BUILD_ROOT/etc
32 rm -rf $RPM_BUILD_ROOT
36 %attr(0755,root,root) /usr/local/sbin/pl_sshd.sh
37 %attr(0755,root,root) /etc/init.d/pl_sshd
38 %attr(0755,root,root) /etc/auto.pl_sshd
44 RUNLEVEL=`/sbin/runlevel`
46 if [ "$1" -ge 1 ]; then
47 # create the magic directory for automount
48 keydir=/var/pl_sshd/keys
49 [ -d $keydir ] || mkdir -p $keydir
51 # add appropriate entry to auto.master
52 auto_master=/etc/auto.master
53 auto_master_entry="$keydir /etc/auto.pl_sshd"
54 grep -qF "$auto_master_entry" $auto_master || \
55 echo $auto_master_entry >>$auto_master
58 # use the sysconfig file to tell our system sshd to look in the
59 # magic location for authorized_keys files
61 sysconfig_sshd=/etc/sysconfig/sshd
62 [ -r $sysconfig_sshd ] && \
63 mv $sysconfig_sshd $sysconfig_sshd.pl_sshd
64 echo "OPTIONS='-o \"AuthorizedKeysFile $keydir/%u/authorized_keys\"'" \
67 # link sshd pam config to pl_sshd so that we can actually login
68 pam_pl_sshd=/etc/pam.d/pl_sshd
69 [ -r $pam_pl_sshd ] || ln -s sshd $pam_pl_sshd
71 chkconfig --add pl_sshd
73 if [[ "$RUNLEVEL" != "unknown" ]]; then
74 /etc/init.d/autofs restart
75 /etc/init.d/sshd restart
76 /etc/init.d/pl_sshd start
81 RUNLEVEL=`/sbin/runlevel`
85 # stop pl_sshd, remove it from rcX.d init dirs, remove link
86 # to sshd's pam config
88 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/pl_sshd stop
89 chkconfig --del pl_sshd
90 rm -f /etc/pam.d/pl_sshd
93 # remove funky config options for sshd (so that when we restart
94 # things will operate normally i.e., without automount magic),
97 rm /etc/sysconfig/sshd
98 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/sshd restart
101 # stop automounter, remove entry from auto.master, restart if
104 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs stop
105 auto_master=/etc/auto.master
106 mv $auto_master $auto_master.pl_sshd.preun
107 sed -e '\,^/var/pl_sshd/keys,d' $auto_master.pl_sshd.preun \
110 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs start
118 * Mon Dec 1 2003 Steve Muir <smuir@cs.princeton.edu>
119 - initial creation from files in sidewinder repository