- (djm) Cleanup Redhat RPMs. Generate keys at runtime rather than install

time, spec file cleanup.
This commit is contained in:
Damien Miller 2000-08-08 16:53:28 +10:00
parent 52652f5cef
commit ab8d1921f4
4 changed files with 141 additions and 53 deletions

View File

@ -1,3 +1,7 @@
20000808
- (djm) Cleanup Redhat RPMs. Generate keys at runtime rather than install
time, spec file cleanup.
20000807 20000807
- (djm) Set 0755 on binaries during install. Report from Lutz Jaenicke - (djm) Set 0755 on binaries during install. Report from Lutz Jaenicke
- (djm) Suppress error messages on channel close shutdown() failurs - (djm) Suppress error messages on channel close shutdown() failurs

View File

@ -1,5 +1,5 @@
# Version of OpenSSH # Version of OpenSSH
%define oversion 2.1.1p4 %define oversion 2.1.1p5
# Version of ssh-askpass # Version of ssh-askpass
%define aversion 1.0 %define aversion 1.0
@ -14,9 +14,9 @@ Summary: OpenSSH free Secure Shell (SSH) implementation
Name: openssh Name: openssh
Version: %{oversion} Version: %{oversion}
Release: 1 Release: 1
Packager: Damien Miller <djm@ibs.com.au> Packager: Damien Miller <djm@mindrot.org>
URL: http://www.openssh.com/ URL: http://www.openssh.com/
Source0: http://violet.ibs.com.au/openssh/files/openssh-%{oversion}.tar.gz Source0: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{oversion}.tar.gz
Source1: http://www.ntrnet.net/~jmknoble/software/x11-ssh-askpass/x11-ssh-askpass-%{aversion}.tar.gz Source1: http://www.ntrnet.net/~jmknoble/software/x11-ssh-askpass/x11-ssh-askpass-%{aversion}.tar.gz
Copyright: BSD Copyright: BSD
Group: Applications/Internet Group: Applications/Internet
@ -27,14 +27,14 @@ Requires: openssl >= 0.9.5a
BuildPreReq: perl BuildPreReq: perl
BuildPreReq: openssl-devel BuildPreReq: openssl-devel
BuildPreReq: tcp_wrappers BuildPreReq: tcp_wrappers
%if ! %{no_x11_askpass} %if ! %{no_gnome_askpass}
BuildPreReq: gnome-libs-devel BuildPreReq: gnome-libs-devel
%endif %endif
%package clients %package clients
Summary: OpenSSH Secure Shell protocol clients Summary: OpenSSH Secure Shell protocol clients
Requires: openssh Requires: openssh
Group: System Environment/Daemons Group: Applications/Internet
Obsoletes: ssh-clients Obsoletes: ssh-clients
%package server %package server
@ -127,6 +127,9 @@ patented algorithms to seperate libraries (OpenSSL).
This package contains the GNOME passphrase dialog. This package contains the GNOME passphrase dialog.
%changelog %changelog
* Tue Aug 08 2000 Damien Miller <djm@mindrot.org>
- Some surgery to sshd.init (generate keys at runtime)
- Cleanup of groups and removal of keygen calls
* Wed Jul 12 2000 Damien Miller <djm@mindrot.org> * Wed Jul 12 2000 Damien Miller <djm@mindrot.org>
- Make building of X11-askpass and gnome-askpass optional - Make building of X11-askpass and gnome-askpass optional
* Mon Jun 12 2000 Damien Miller <djm@mindrot.org> * Mon Jun 12 2000 Damien Miller <djm@mindrot.org>
@ -208,20 +211,12 @@ rm -rf $RPM_BUILD_ROOT
%post server %post server
/sbin/chkconfig --add sshd /sbin/chkconfig --add sshd
if [ ! -f /etc/ssh/ssh_host_key -o ! -s /etc/ssh/ssh_host_key ]; then if test -r /var/run/sshd.pid ; then
/usr/bin/ssh-keygen -b 1024 -f /etc/ssh/ssh_host_key -N '' >&2
fi
if [ ! -f /etc/ssh/ssh_host_dsa_key -o ! -s /etc/ssh/ssh_host_dsa_key ]; then
/usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' >&2
fi
if test -r /var/run/sshd.pid
then
/etc/rc.d/init.d/sshd restart >&2 /etc/rc.d/init.d/sshd restart >&2
fi fi
%preun server %preun server
if [ "$1" = 0 ] if [ "$1" = 0 ] ; then
then
/etc/rc.d/init.d/sshd stop >&2 /etc/rc.d/init.d/sshd stop >&2
/sbin/chkconfig --del sshd /sbin/chkconfig --del sshd
fi fi
@ -272,4 +267,3 @@ fi
%defattr(-,root,root) %defattr(-,root,root)
%attr(0755,root,root) /usr/libexec/ssh/gnome-ssh-askpass %attr(0755,root,root) /usr/libexec/ssh/gnome-ssh-askpass
%endif %endif

View File

@ -17,31 +17,59 @@
RETVAL=0 RETVAL=0
# Some functions to make the below more readable
KEYGEN=/usr/bin/ssh-keygen
RSA_KEY=/etc/ssh/ssh_host_key
DSA_KEY=/etc/ssh/ssh_host_dsa_key
PID_FILE=/var/run/sshd.pid
do_rsa_keygen() {
if $KEYGEN -R && ! test -f $RSA_KEY ; then
echo -n "Generating SSH RSA host key: "
if $KEYGEN -q -b 1024 -f $RSA_KEY -C '' -N '' >&/dev/null; then
success "RSA key generation"
echo
else
failure "RSA key generation"
echo
exit 1
fi
fi
}
do_dsa_keygen() {
if ! test -f $DSA_KEY ; then
echo -n "Generating SSH DSA host key: "
if $KEYGEN -q -d -b 1024 -f $DSA_KEY -C '' -N '' >&/dev/null; then
success "DSA key generation"
echo
else
failure "DSA key generation"
echo
exit 1
fi
fi
}
case "$1" in case "$1" in
start) start)
# Create keys if necessary
do_rsa_keygen;
do_dsa_keygen;
echo -n "Starting sshd: " echo -n "Starting sshd: "
if [ ! -f /var/run/sshd.pid ] ; then if [ ! -f $PID_FILE ] ; then
case "`type -type success`" in daemon sshd
function)
/usr/sbin/sshd && success "sshd startup" || failure "sshd startup"
RETVAL=$? RETVAL=$?
;; touch /var/lock/subsys/sshd
*)
/usr/sbin/sshd && echo -n "sshd "
RETVAL=$?
;;
esac
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd
fi fi
echo echo
;; ;;
stop) stop)
echo -n "Shutting down sshd: " echo -n "Shutting down sshd: "
if [ -f /var/run/sshd.pid ] ; then if [ -f $PID_FILE ] ; then
killproc sshd killproc sshd
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd
fi fi
echo echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd
;; ;;
restart) restart)
$0 stop $0 stop
@ -55,6 +83,7 @@ case "$1" in
*) *)
echo "Usage: sshd {start|stop|restart|status}" echo "Usage: sshd {start|stop|restart|status}"
exit 1 exit 1
;;
esac esac
exit $RETVAL exit $RETVAL

61
contrib/redhat/sshd.init-5.x Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
# Init file for OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: OpenSSH server daemon
#
# processname: sshd
# config: /etc/ssh/ssh_host_key
# config: /etc/ssh/ssh_host_key.pub
# config: /etc/ssh/ssh_random_seed
# config: /etc/ssh/sshd_config
# pidfile: /var/run/sshd.pid
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
case "$1" in
start)
echo -n "Starting sshd: "
if [ ! -f /var/run/sshd.pid ] ; then
case "`type -type success`" in
function)
/usr/sbin/sshd && success "sshd startup" || failure "sshd startup"
RETVAL=$?
;;
*)
/usr/sbin/sshd && echo -n "sshd "
RETVAL=$?
;;
esac
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd
fi
echo
;;
stop)
echo -n "Shutting down sshd: "
if [ -f /var/run/sshd.pid ] ; then
killproc sshd
fi
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
status)
status sshd
RETVAL=$?
;;
*)
echo "Usage: sshd {start|stop|restart|status}"
exit 1
;;
esac
exit $RETVAL