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.6 2003/12/03 22:33:50 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
75 # don't try to start/restart various things automatically,
76 # it's too ugly (particularly if we're upgrading while
80 echo "You need to manually restart autofs and sshd, and"
81 echo "start the pl_sshd (ssh on port 806) service."
82 echo "Make sure you know what you're doing, particularly"
83 echo "if you're making this change over an ssh connection."
89 RUNLEVEL=`/sbin/runlevel`
91 if [ "$1" -ge "0" ]; then
93 # stop pl_sshd, remove it from rcX.d init dirs, remove link
94 # to sshd's pam config
96 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/pl_sshd stop
97 chkconfig --del pl_sshd
98 rm -f /etc/pam.d/pl_sshd
101 # remove funky config options for sshd (so that when we restart
102 # things will operate normally i.e., without automount magic)
104 rm /etc/sysconfig/sshd
105 if [ "$RUNLEVEL" != "unknown" ]; then
107 echo "You need to manually restart sshd."
108 echo "Make sure you know what you're doing, particularly"
109 echo "if you're making this change over an ssh connection."
114 # stop automounter, remove entry from auto.master, restart if
117 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs stop
118 auto_master=/etc/auto.master
119 mv $auto_master $auto_master.pl_sshd.preun
120 sed -e '\,^/var/pl_sshd/keys,d' $auto_master.pl_sshd.preun \
123 [ "$RUNLEVEL" != "unknown" ] && /etc/init.d/autofs start
131 * Mon Dec 1 2003 Steve Muir <smuir@cs.princeton.edu>
132 - initial creation from files in sidewinder repository