summaryrefslogtreecommitdiff
path: root/contrib/redhat
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-08-08 16:53:28 +1000
committerDamien Miller <djm@mindrot.org>2000-08-08 16:53:28 +1000
commitab8d1921f4598baa9b8596d7f8b6bbded9acfb33 (patch)
treee3301ff26a8093a6e9faa5894c2ac3e05269e2aa /contrib/redhat
parent52652f5cef3d2a4441117cde95855d039a866bbe (diff)
- (djm) Cleanup Redhat RPMs. Generate keys at runtime rather than install
time, spec file cleanup.
Diffstat (limited to 'contrib/redhat')
-rw-r--r--contrib/redhat/openssh.spec26
-rwxr-xr-xcontrib/redhat/sshd.init101
-rwxr-xr-xcontrib/redhat/sshd.init-5.x61
3 files changed, 136 insertions, 52 deletions
diff --git a/contrib/redhat/openssh.spec b/contrib/redhat/openssh.spec
index e1feb778e..e593f2813 100644
--- a/contrib/redhat/openssh.spec
+++ b/contrib/redhat/openssh.spec
@@ -1,5 +1,5 @@
1# Version of OpenSSH 1# Version of OpenSSH
2%define oversion 2.1.1p4 2%define oversion 2.1.1p5
3 3
4# Version of ssh-askpass 4# Version of ssh-askpass
5%define aversion 1.0 5%define aversion 1.0
@@ -14,9 +14,9 @@ Summary: OpenSSH free Secure Shell (SSH) implementation
14Name: openssh 14Name: openssh
15Version: %{oversion} 15Version: %{oversion}
16Release: 1 16Release: 1
17Packager: Damien Miller <djm@ibs.com.au> 17Packager: Damien Miller <djm@mindrot.org>
18URL: http://www.openssh.com/ 18URL: http://www.openssh.com/
19Source0: http://violet.ibs.com.au/openssh/files/openssh-%{oversion}.tar.gz 19Source0: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{oversion}.tar.gz
20Source1: http://www.ntrnet.net/~jmknoble/software/x11-ssh-askpass/x11-ssh-askpass-%{aversion}.tar.gz 20Source1: http://www.ntrnet.net/~jmknoble/software/x11-ssh-askpass/x11-ssh-askpass-%{aversion}.tar.gz
21Copyright: BSD 21Copyright: BSD
22Group: Applications/Internet 22Group: Applications/Internet
@@ -27,14 +27,14 @@ Requires: openssl >= 0.9.5a
27BuildPreReq: perl 27BuildPreReq: perl
28BuildPreReq: openssl-devel 28BuildPreReq: openssl-devel
29BuildPreReq: tcp_wrappers 29BuildPreReq: tcp_wrappers
30%if ! %{no_x11_askpass} 30%if ! %{no_gnome_askpass}
31BuildPreReq: gnome-libs-devel 31BuildPreReq: gnome-libs-devel
32%endif 32%endif
33 33
34%package clients 34%package clients
35Summary: OpenSSH Secure Shell protocol clients 35Summary: OpenSSH Secure Shell protocol clients
36Requires: openssh 36Requires: openssh
37Group: System Environment/Daemons 37Group: Applications/Internet
38Obsoletes: ssh-clients 38Obsoletes: ssh-clients
39 39
40%package server 40%package server
@@ -127,6 +127,9 @@ patented algorithms to seperate libraries (OpenSSL).
127This package contains the GNOME passphrase dialog. 127This package contains the GNOME passphrase dialog.
128 128
129%changelog 129%changelog
130* Tue Aug 08 2000 Damien Miller <djm@mindrot.org>
131- Some surgery to sshd.init (generate keys at runtime)
132- Cleanup of groups and removal of keygen calls
130* Wed Jul 12 2000 Damien Miller <djm@mindrot.org> 133* Wed Jul 12 2000 Damien Miller <djm@mindrot.org>
131- Make building of X11-askpass and gnome-askpass optional 134- Make building of X11-askpass and gnome-askpass optional
132* Mon Jun 12 2000 Damien Miller <djm@mindrot.org> 135* Mon Jun 12 2000 Damien Miller <djm@mindrot.org>
@@ -208,20 +211,12 @@ rm -rf $RPM_BUILD_ROOT
208 211
209%post server 212%post server
210/sbin/chkconfig --add sshd 213/sbin/chkconfig --add sshd
211if [ ! -f /etc/ssh/ssh_host_key -o ! -s /etc/ssh/ssh_host_key ]; then 214if test -r /var/run/sshd.pid ; then
212 /usr/bin/ssh-keygen -b 1024 -f /etc/ssh/ssh_host_key -N '' >&2
213fi
214if [ ! -f /etc/ssh/ssh_host_dsa_key -o ! -s /etc/ssh/ssh_host_dsa_key ]; then
215 /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' >&2
216fi
217if test -r /var/run/sshd.pid
218then
219 /etc/rc.d/init.d/sshd restart >&2 215 /etc/rc.d/init.d/sshd restart >&2
220fi 216fi
221 217
222%preun server 218%preun server
223if [ "$1" = 0 ] 219if [ "$1" = 0 ] ; then
224then
225 /etc/rc.d/init.d/sshd stop >&2 220 /etc/rc.d/init.d/sshd stop >&2
226 /sbin/chkconfig --del sshd 221 /sbin/chkconfig --del sshd
227fi 222fi
@@ -272,4 +267,3 @@ fi
272%defattr(-,root,root) 267%defattr(-,root,root)
273%attr(0755,root,root) /usr/libexec/ssh/gnome-ssh-askpass 268%attr(0755,root,root) /usr/libexec/ssh/gnome-ssh-askpass
274%endif 269%endif
275
diff --git a/contrib/redhat/sshd.init b/contrib/redhat/sshd.init
index cac91bb51..487d12897 100755
--- a/contrib/redhat/sshd.init
+++ b/contrib/redhat/sshd.init
@@ -17,44 +17,73 @@
17 17
18RETVAL=0 18RETVAL=0
19 19
20case "$1" in 20# Some functions to make the below more readable
21 start) 21KEYGEN=/usr/bin/ssh-keygen
22 echo -n "Starting sshd: " 22RSA_KEY=/etc/ssh/ssh_host_key
23 if [ ! -f /var/run/sshd.pid ] ; then 23DSA_KEY=/etc/ssh/ssh_host_dsa_key
24 case "`type -type success`" in 24PID_FILE=/var/run/sshd.pid
25 function) 25do_rsa_keygen() {
26 /usr/sbin/sshd && success "sshd startup" || failure "sshd startup" 26 if $KEYGEN -R && ! test -f $RSA_KEY ; then
27 RETVAL=$? 27 echo -n "Generating SSH RSA host key: "
28 ;; 28 if $KEYGEN -q -b 1024 -f $RSA_KEY -C '' -N '' >&/dev/null; then
29 *) 29 success "RSA key generation"
30 /usr/sbin/sshd && echo -n "sshd " 30 echo
31 RETVAL=$? 31 else
32 ;; 32 failure "RSA key generation"
33 esac 33 echo
34 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd 34 exit 1
35 fi
35 fi 36 fi
36 echo 37}
37 ;; 38do_dsa_keygen() {
38 stop) 39 if ! test -f $DSA_KEY ; then
39 echo -n "Shutting down sshd: " 40 echo -n "Generating SSH DSA host key: "
40 if [ -f /var/run/sshd.pid ] ; then 41 if $KEYGEN -q -d -b 1024 -f $DSA_KEY -C '' -N '' >&/dev/null; then
41 killproc sshd 42 success "DSA key generation"
43 echo
44 else
45 failure "DSA key generation"
46 echo
47 exit 1
48 fi
42 fi 49 fi
43 echo 50}
44 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd 51
45 ;; 52case "$1" in
46 restart) 53 start)
47 $0 stop 54 # Create keys if necessary
48 $0 start 55 do_rsa_keygen;
49 RETVAL=$? 56 do_dsa_keygen;
50 ;; 57
51 status) 58 echo -n "Starting sshd: "
52 status sshd 59 if [ ! -f $PID_FILE ] ; then
53 RETVAL=$? 60 daemon sshd
54 ;; 61 RETVAL=$?
55 *) 62 touch /var/lock/subsys/sshd
56 echo "Usage: sshd {start|stop|restart|status}" 63 fi
57 exit 1 64 echo
65 ;;
66 stop)
67 echo -n "Shutting down sshd: "
68 if [ -f $PID_FILE ] ; then
69 killproc sshd
70 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd
71 fi
72 echo
73 ;;
74 restart)
75 $0 stop
76 $0 start
77 RETVAL=$?
78 ;;
79 status)
80 status sshd
81 RETVAL=$?
82 ;;
83 *)
84 echo "Usage: sshd {start|stop|restart|status}"
85 exit 1
86 ;;
58esac 87esac
59 88
60exit $RETVAL 89exit $RETVAL
diff --git a/contrib/redhat/sshd.init-5.x b/contrib/redhat/sshd.init-5.x
new file mode 100755
index 000000000..e836b6919
--- /dev/null
+++ b/contrib/redhat/sshd.init-5.x
@@ -0,0 +1,61 @@
1#!/bin/bash
2
3# Init file for OpenSSH server daemon
4#
5# chkconfig: 2345 55 25
6# description: OpenSSH server daemon
7#
8# processname: sshd
9# config: /etc/ssh/ssh_host_key
10# config: /etc/ssh/ssh_host_key.pub
11# config: /etc/ssh/ssh_random_seed
12# config: /etc/ssh/sshd_config
13# pidfile: /var/run/sshd.pid
14
15# source function library
16. /etc/rc.d/init.d/functions
17
18RETVAL=0
19
20case "$1" in
21 start)
22 echo -n "Starting sshd: "
23 if [ ! -f /var/run/sshd.pid ] ; then
24 case "`type -type success`" in
25 function)
26 /usr/sbin/sshd && success "sshd startup" || failure "sshd startup"
27 RETVAL=$?
28 ;;
29 *)
30 /usr/sbin/sshd && echo -n "sshd "
31 RETVAL=$?
32 ;;
33 esac
34 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd
35 fi
36 echo
37 ;;
38 stop)
39 echo -n "Shutting down sshd: "
40 if [ -f /var/run/sshd.pid ] ; then
41 killproc sshd
42 fi
43 echo
44 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd
45 ;;
46 restart)
47 $0 stop
48 $0 start
49 RETVAL=$?
50 ;;
51 status)
52 status sshd
53 RETVAL=$?
54 ;;
55 *)
56 echo "Usage: sshd {start|stop|restart|status}"
57 exit 1
58 ;;
59esac
60
61exit $RETVAL