Browse Source

add fakesyslog support and daily logfile rotation

master
parent
commit
9d5f0aaa01
  1. 86
      openssh/openssh.spec
  2. 60
      openssh/rc.openssh

86
openssh/openssh.spec

@ -39,9 +39,10 @@ Release: %{l_branch}.0
# list of sources
Source0: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz
Source1: rc.openssh
Source2: sshd_config
Source3: ssh_config
Source1: fakesyslog.tar.gz
Source2: rc.openssh
Source3: sshd_config
Source4: ssh_config
# build information
Prefix: %{l_prefix}
@ -69,49 +70,64 @@ AutoReqProv: no
algorithms to separate libraries (OpenSSL).
%prep
%setup0 -q
%setup0 -q -c -a 0
%setup1 -q -T -D -a 1
%build
# configure source tree
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
LDFLAGS="-L%{l_prefix}/lib" \
LIBS="-lcrypt" \
./configure \
--prefix=%{l_prefix} \
--sbindir=%{l_prefix}/bin \
--mandir=%{l_prefix}/man \
--infodir=%{l_prefix}/info \
--sysconfdir=%{l_prefix}/etc/openssh \
--libexecdir=%{l_prefix}/libexec/openssh \
--localstatedir=%{l_prefix}/var/openssh \
--with-pid-dir=%{l_prefix}/var/openssh \
--with-ssl-dir=%{l_prefix} \
# build faked syslog(3) library
fakesyslogdir="`pwd`/fakesyslog"
( cd fakesyslog
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
./configure \
--with-logfile=%{l_prefix}/var/openssh/sshd.log
%{l_make} %{l_mflags}
)
# build OpenSSH
( cd openssh-%{version}
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
LDFLAGS="-L%{l_prefix}/lib -L$fakesyslogdir" \
LIBS="-lcrypt -lfakesyslog" \
./configure \
--prefix=%{l_prefix} \
--sbindir=%{l_prefix}/bin \
--mandir=%{l_prefix}/man \
--infodir=%{l_prefix}/info \
--sysconfdir=%{l_prefix}/etc/openssh \
--libexecdir=%{l_prefix}/libexec/openssh \
--localstatedir=%{l_prefix}/var/openssh \
--with-pid-dir=%{l_prefix}/var/openssh \
--with-ssl-dir=%{l_prefix} \
%if "%{with_pcre}" == "yes"
--with-pcre=%{l_prefix} \
--with-pcre=%{l_prefix} \
%endif
%if "%{with_skey}" == "yes"
--with-skey=%{l_prefix} \
--with-skey=%{l_prefix} \
%endif
--with-zlib=%{l_prefix} \
--with-ipv4-default \
--with-md5-passwords \
--with-pam \
--without-smartcard \
--without-kerberos4 \
--disable-suid-ssh \
--without-rsh \
--with-mantype=man \
--with-default-path=%{l_prefix}/bin:/bin:/usr/bin:/usr/local/bin
# build package
%{l_make} %{l_mflags -O}
--with-zlib=%{l_prefix} \
--with-ipv4-default \
--with-md5-passwords \
--with-pam \
--without-smartcard \
--without-kerberos4 \
--disable-suid-ssh \
--without-rsh \
--with-mantype=man \
--with-default-path=%{l_prefix}/bin:/bin:/usr/bin:/usr/local/bin
# build package
%{l_make} %{l_mflags -O}
)
%install
rm -rf $RPM_BUILD_ROOT
# perform standard installation procedure of OpenSSH
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
( cd openssh-%{version}
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
)
# strip down installation tree
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share

60
openssh/rc.openssh

@ -0,0 +1,60 @@
#!@l_prefix@/lib/rpm/bash @l_prefix@/etc/rc
##
## rc.openssh -- Run-Commands for OpenSSH Daemon
##
%config
openssh_enable="yes"
openssh_log_prolog="true"
openssh_log_epilog="true"
openssh_log_numfiles="10"
openssh_log_minsize="1M"
openssh_log_complevel="9"
%common
openssh_signal () {
if [ -f "@l_prefix@/var/openssh/sshd.pid" ]; then
kill -$1 `cat @l_prefix@/var/openssh/sshd.pid`
fi
}
%start -p 200 -u root
opServiceEnabled openssh || exit 0
@l_prefix@/bin/sshd
%stop -p 200 -u root
opServiceEnabled openssh || exit 0
openssh_signal TERM
%restart -u root
opServiceEnabled openssh || exit 0
openssh_signal TERM
sleep 2
@l_prefix@/bin/sshd
%daily -u root
opServiceEnabled openssh || exit 0
opTmpDirGen openssh
opTmpDirFile openssh hint hintfile
prolog="true"
if [ ".$openssh_log_prolog" != . ]; then
prolog="$prolog; $openssh_log_prolog"
fi
epilog="echo 'epilog' >$hintfile"
if [ ".$openssh_log_epilog" != . ]; then
epilog="$epilog; $openssh_log_epilog"
fi
shtool log -f \
-n${openssh_log_numfiles} -s${openssh_log_minsize} \
-d -z${openssh_log_complevel} \
-o@l_fsusr@ -g@l_fsgrp@ -m644 \
-P "$prolog" \
-E "$epilog" \
@l_prefix@/var/openssh/sshd.log
if [ ".`cat $hintfile`" = ".epilog" ]; then
openssh_signal TERM
sleep 2
@l_prefix@/bin/sshd
fi
opTmpDirDel openssh
Loading…
Cancel
Save