openssh/openssh.spec

519 lines
14 KiB
RPMSpec
Raw Normal View History

2012-02-01 14:38:48 +04:00
# Version of watchdog patch
%define wversion 4.4p1
# Version of the hpn patch
%define hpnver 13v6
2014-02-12 08:02:32 -05:00
%bcond_with skey
%bcond_without krb5
%bcond_with watchdog
%bcond_without gnomeaskpass
%bcond_with ldap
%bcond_with sftpcontrol
%bcond_with hpn
%bcond_with audit
%bcond_without libedit
2012-02-01 14:38:48 +04:00
%define OPENSSH_PATH "/usr/local/bin:/bin:%{_bindir}"
%define XAUTH %{_bindir}/xauth
Summary: OpenSSH free Secure Shell (SSH) implementation
Name: openssh
Version: 7.6p1
Release: 2
2012-02-01 14:38:48 +04:00
License: BSD
Group: Networking/Remote access
2014-02-12 08:02:32 -05:00
Url: http://www.openssh.com/
2017-01-22 20:56:15 +10:00
Source0: http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/%{name}-%{version}.tar.gz
Source1: http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/%{name}-%{version}.tar.gz.asc
2012-02-01 14:38:48 +04:00
# ssh-copy-id taken from debian, with "usage" added
Source3: ssh-copy-id
Source9: README.sftpfilecontrol
2012-02-01 18:01:49 +04:00
# this is never to be applied by default
2012-02-01 14:38:48 +04:00
# http://www.sc.isc.tohoku.ac.jp/~hgot/sources/openssh-watchdog.html
Source10: openssh-%{wversion}-watchdog.patch.tgz
Source12: ssh_ldap_key.pl
Source15: ssh-avahi-integration
Source17: sshd.pam
2014-02-12 08:02:32 -05:00
Source18: sshd.service
2012-02-01 14:38:48 +04:00
Source21: README.hpn
2014-02-12 08:02:32 -05:00
Source22: sshd-keygen
Source23: sshd.socket
Source24: sshd@.service
Source25: sshd-keygen.service
Patch1: openssh-7.6p1-config.patch
2012-02-01 14:38:48 +04:00
# rediffed from openssh-4.4p1-watchdog.patch.tgz
Patch4: openssh-4.4p1-watchdog.diff
# optional ldap support
# http://dev.inversepath.com/trac/openssh-lpk
#Patch6: http://dev.inversepath.com/openssh-lpk/openssh-lpk-4.6p1-0.3.9.patch
# new location for the lpk patch.
# rediffed from "svn checkout http://openssh-lpk.googlecode.com/svn/trunk/ openssh-lpk-read-only"
Patch6: openssh-lpk-5.4p1-0.3.10.diff
# http://sftpfilecontrol.sourceforge.net
# Not applied by default
# P7 is rediffed and slightly adjusted from http://sftplogging.sourceforge.net/download/v1.5/openssh-4.4p1.sftplogging-v1.5.patch
Patch7: openssh-4.9p1.sftplogging-v1.5.diff
# (tpg) http://www.psc.edu/networking/projects/hpn-ssh/
Patch11: http://www.psc.edu/networking/projects/hpn-ssh/openssh-5.2p1-hpn%{hpnver}.diff
Patch12: http://www.psc.edu/networking/projects/hpn-ssh/openssh5.1-peaktput.diff
#gw: from Fedora:
Patch14: openssh-4.7p1-audit.patch
Patch17: openssh-5.1p1-askpass-progress.patch
Patch18: openssh-4.3p2-askpass-grab-info.patch
Patch20: openssh-7.1p1-debian-restore-tcp-wrappers.patch
2016-09-30 05:06:40 -04:00
Patch21: openssh-7.2p2-x11.patch
Patch24: openssh-7.6p1-log-in-chroot.patch
2017-07-28 14:28:10 +03:00
Patch25: openssh-7.4p1-show-more-fingerprints.patch
# from upstream:
Patch30: openssh-7.6p1-permitopen-bug.patch
2014-02-12 08:02:32 -05:00
BuildRequires: groff-base
2017-01-22 20:56:15 +10:00
BuildRequires: systemd-units
%if %{with ldap}
BuildRequires: openldap-devel
%endif
2012-02-01 14:38:48 +04:00
BuildRequires: pam-devel
2014-02-12 08:02:32 -05:00
%if %{with skey}
2012-02-01 14:38:48 +04:00
BuildRequires: skey-devel
%endif
2017-01-22 20:56:15 +10:00
BuildRequires: tcp_wrappers-devel
%if %{with audit}
BuildRequires: pkgconfig(audit)
2012-02-01 14:38:48 +04:00
%endif
2014-02-12 08:02:32 -05:00
%if %{with gnomeaskpass}
BuildRequires: pkgconfig(gtk+-2.0)
2012-02-01 14:38:48 +04:00
%endif
2017-01-22 20:56:15 +10:00
%if %{with krb5}
BuildRequires: pkgconfig(krb5)
2012-02-01 14:38:48 +04:00
%endif
2014-02-12 08:02:32 -05:00
%if %{with libedit}
BuildRequires: pkgconfig(libedit)
BuildRequires: pkgconfig(ncurses)
2012-02-01 14:38:48 +04:00
%endif
2017-01-22 20:56:15 +10:00
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
2012-02-01 14:38:48 +04:00
BuildConflicts: libgssapi-devel
2014-02-12 08:02:32 -05:00
Requires: tcp_wrappers
2012-02-01 14:38:48 +04:00
%description
Ssh (Secure Shell) is a program for logging into a remote machine and for
executing commands in a remote machine. It is intended to replace
rlogin and rsh, and provide secure encrypted communications between
two untrusted hosts over an insecure network. X11 connections and
arbitrary TCP/IP ports can also be forwarded over the secure channel.
OpenSSH is OpenBSD's rework of the last free version of SSH, bringing it
up to date in terms of security and features, as well as removing all
patented algorithms to separate libraries (OpenSSL).
This package includes the core files necessary for both the OpenSSH
client and server. To make this package useful, you should also
install openssh-clients, openssh-server, or both.
2017-01-22 20:56:15 +10:00
%files
%doc ChangeLog OVERVIEW README* INSTALL CREDITS LICENCE TODO ssh_ldap_key.pl
%if %{with ldap}
%doc *.schema
%endif
%if %{with watchdog}
%doc CHANGES-openssh-watchdog openssh-watchdog.html
%endif
%if %{with sftpcontrol}
%doc README.sftpfilecontrol
%endif
%{_bindir}/ssh-keygen
%dir %{_sysconfdir}/ssh
%{_bindir}/ssh-keyscan
%attr(4711,root,root) %{_libdir}/ssh/ssh-keysign
%{_libdir}/ssh/ssh-pkcs11-helper
%{_mandir}/man1/ssh-keygen.1*
%{_mandir}/man1/ssh-keyscan.1*
%{_mandir}/man8/ssh-keysign.8*
%{_mandir}/man8/ssh-pkcs11-helper.8*
2012-02-01 14:38:48 +04:00
2017-01-22 20:56:15 +10:00
#----------------------------------------------------------------------------
2012-02-01 14:38:48 +04:00
2017-01-22 20:56:15 +10:00
%package clients
2012-02-01 14:38:48 +04:00
Summary: OpenSSH Secure Shell protocol clients
Group: Networking/Remote access
2017-01-22 20:56:15 +10:00
Requires: %{name} = %{EVRD}
Provides: ssh-clients = %{EVRD}
Provides: sftp = %{EVRD}
Provides: ssh = %{EVRD}
2012-02-01 14:38:48 +04:00
2017-01-22 20:56:15 +10:00
%description clients
2012-02-01 14:38:48 +04:00
This package includes the clients necessary to make encrypted connections
to SSH servers.
2017-01-22 20:56:15 +10:00
%files clients
%{_bindir}/scp
%{_bindir}/ssh
%{_bindir}/ssh-agent
%{_bindir}/ssh-add
%{_bindir}/ssh-copy-id
%{_bindir}/sftp
%{_mandir}/man1/scp.1*
%{_mandir}/man1/ssh-copy-id.1*
%{_mandir}/man1/ssh.1*
%{_mandir}/man1/ssh-agent.1*
%{_mandir}/man1/ssh-add.1*
%{_mandir}/man1/sftp.1*
%{_mandir}/man5/ssh_config.5*
%config(noreplace) %{_sysconfdir}/ssh/ssh_config
%{_sysconfdir}/profile.d/90ssh-client.sh
#----------------------------------------------------------------------------
%package server
2012-02-01 14:38:48 +04:00
Summary: OpenSSH Secure Shell protocol server (sshd)
Group: System/Servers
2017-01-22 20:56:15 +10:00
Requires: %{name}-clients = %{EVRD}
Requires(pre): pam
Requires(pre,post): %{name} = %{EVRD}
2014-02-12 08:02:32 -05:00
Requires(pre,postun,preun,postun): rpm-helper
%if %{with skey}
2012-02-01 14:38:48 +04:00
Requires: skey
%endif
2017-01-22 20:56:15 +10:00
Provides: ssh-server = %{EVRD}
Provides: sshd = %{EVRD}
2012-02-01 14:38:48 +04:00
2017-01-22 20:56:15 +10:00
%description server
This package contains the secure shell daemon. The sshd is the server
part of the secure shell protocol and allows ssh clients to connect to
2012-02-01 14:38:48 +04:00
your host.
2017-01-22 20:56:15 +10:00
%files server
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/sshd
%{_sbindir}/sshd
%{_sbindir}/sshd-keygen
%dir %{_libdir}/ssh
%{_libdir}/ssh/sftp-server
%{_mandir}/man5/sshd_config.5*
%{_mandir}/man5/moduli.5*
%{_mandir}/man8/sshd.8*
%{_mandir}/man8/sftp-server.8*
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/denyusers
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/pam.d/sshd
%config(noreplace) %{_sysconfdir}/avahi/services/%{name}.service
%config(noreplace) %{_sysconfdir}/ssh/moduli
%{_unitdir}/sshd.service
%{_unitdir}/sshd.socket
%{_unitdir}/sshd-keygen.service
%{_unitdir}/sshd@.service
%dir %attr(0755,root,root) /var/empty
%pre server
%_pre_useradd sshd /var/empty /bin/true
%post server
# do some key management
# %{_bindir}/ssh-keygen -A
# do some key management; taken from the initscript
KEYGEN=/usr/bin/ssh-keygen
RSA1_KEY=/etc/ssh/ssh_host_key
RSA_KEY=/etc/ssh/ssh_host_rsa_key
DSA_KEY=/etc/ssh/ssh_host_dsa_key
ECDSA_KEY=/etc/ssh/ssh_host_ecdsa_key
do_rsa1_keygen() {
if [ ! -s $RSA1_KEY ]; then
echo -n "Generating SSH1 RSA host key... "
if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then
chmod 600 $RSA1_KEY
chmod 644 $RSA1_KEY.pub
echo "done"
echo
else
echo "failed"
echo
exit 1
fi
fi
}
do_rsa_keygen() {
if [ ! -s $RSA_KEY ]; then
echo "Generating SSH2 RSA host key... "
if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then
chmod 600 $RSA_KEY
chmod 644 $RSA_KEY.pub
echo "done"
echo
else
echo "failed"
echo
exit 1
fi
fi
}
do_dsa_keygen() {
if [ ! -s $DSA_KEY ]; then
echo "Generating SSH2 DSA host key... "
if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then
chmod 600 $DSA_KEY
chmod 644 $DSA_KEY.pub
echo "done"
echo
else
echo "failed"
echo
exit 1
fi
fi
}
do_ecdsa_keygen() {
if [ ! -s $ECDSA_KEY ]; then
echo "Generating SSH2 EC DSA host key... "
if $KEYGEN -q -t dsa -f $ECDSA_KEY -C '' -N '' >&/dev/null; then
chmod 600 $ECDSA_KEY
chmod 644 $ECDSA_KEY.pub
echo "done"
echo
else
echo "failed"
echo
exit 1
fi
fi
}
do_rsa1_keygen
do_rsa_keygen
do_dsa_keygen
do_ecdsa_keygen
%postun server
%_postun_userdel sshd
#----------------------------------------------------------------------------
2012-02-01 14:38:48 +04:00
%package askpass-common
2014-02-12 08:02:32 -05:00
Summary: OpenSSH X11 passphrase common scripts
Group: Networking/Remote access
2012-02-01 14:38:48 +04:00
%description askpass-common
2017-01-22 20:56:15 +10:00
OpenSSH X11 passphrase common scripts.
%files askpass-common
%{_sysconfdir}/profile.d/90ssh-askpass.*
#----------------------------------------------------------------------------
2012-02-01 14:38:48 +04:00
2014-02-12 08:02:32 -05:00
%if %{with gnomeaskpass}
2017-01-22 20:56:15 +10:00
%package askpass-gnome
2012-02-01 14:38:48 +04:00
Summary: OpenSSH GNOME passphrase dialog
Group: Networking/Remote access
2017-01-22 20:56:15 +10:00
Requires: %{name}
Requires: %{name}-askpass-common
Requires(post,postun): update-alternatives
Provides: %{name}-askpass = %{EVRD}
Provides: ssh-askpass = %{EVRD}
Provides: ssh-extras = %{EVRD}
%description askpass-gnome
2012-02-01 14:38:48 +04:00
This package contains the GNOME passphrase dialog.
2017-01-22 20:56:15 +10:00
%files askpass-gnome
%{_libdir}/ssh/gnome-ssh-askpass
%post askpass-gnome
update-alternatives --install %{_libdir}/ssh/ssh-askpass ssh-askpass %{_libdir}/ssh/gnome-ssh-askpass 20
update-alternatives --install %{_bindir}/ssh-askpass bssh-askpass %{_libdir}/ssh/gnome-ssh-askpass 20
%postun askpass-gnome
[ $1 = 0 ] || exit 0
update-alternatives --remove ssh-askpass %{_libdir}/ssh/gnome-ssh-askpass
update-alternatives --remove bssh-askpass %{_libdir}/ssh/gnome-ssh-askpass
2012-02-01 14:38:48 +04:00
%endif
2017-01-22 20:56:15 +10:00
#----------------------------------------------------------------------------
2012-02-01 14:38:48 +04:00
%prep
2012-02-01 18:01:49 +04:00
%setup -q -a10
2012-02-01 14:38:48 +04:00
%patch1 -p1 -b .mdkconf
2014-02-12 08:02:32 -05:00
%if %{with watchdog}
2012-02-01 14:38:48 +04:00
#patch -p0 -s -z .wdog < %{name}-%{wversion}-watchdog.patch
%patch4 -p1 -b .watchdog
%endif
2014-02-12 08:02:32 -05:00
%if %{with ldap}
2012-02-01 14:38:48 +04:00
sed -i 's|UsePrivilegeSeparation yes|#UsePrivilegeSeparation yes|' sshd_config
%patch6 -p1 -b .lpk
rm -f README.lpk.lpk
%define _default_patch_fuzz 3
%else
%define _default_patch_fuzz 2
%endif
2014-02-12 08:02:32 -05:00
%if %{with sftpcontrol}
2012-02-01 14:38:48 +04:00
#cat %{SOURCE8} | patch -p1 -s -z .sftpcontrol
echo "This patch is broken or needs to be updated/rediffed"; exit 1
%patch7 -p1 -b .sftplogging-v1.5
# README with license terms for this patch
install -m 0644 %{SOURCE9} .
%endif
2014-02-12 08:02:32 -05:00
%if %{with hpn}
2012-02-01 14:38:48 +04:00
echo "This patch is broken or needs to be updated/rediffed"; exit 1
%patch11 -p1 -b .hpn
%patch12 -p1 -b .peak
install %{SOURCE21} .
%endif
2014-02-12 08:02:32 -05:00
%if %{with audit}
2012-02-01 14:38:48 +04:00
%patch14 -p1 -b .audit
%endif
%patch17 -p1 -b .progress
%patch18 -p1 -b .grab-info
%patch20 -p1 -b .tcp_wrappers
2016-09-30 05:06:40 -04:00
%patch21 -p1 -b .sshdt
%patch24 -p1 -b .fingerprint
2017-07-28 14:28:10 +03:00
%patch25 -p1 -b .memory
%patch30 -p1 -b .permitopen
2012-02-01 14:38:48 +04:00
install %{SOURCE12} .
2012-02-01 14:38:48 +04:00
install -m 0644 %{SOURCE17} sshd.pam
# fix attribs
chmod 644 ChangeLog OVERVIEW README* INSTALL CREDITS LICENCE TODO ssh_ldap_key.pl
# http://qa.mandriva.com/show_bug.cgi?id=22957
perl -pi -e "s|_OPENSSH_PATH_|%{OPENSSH_PATH}|g" sshd_config
autoreconf -fi
2014-02-12 08:02:32 -05:00
%build
%ifarch %{ix86}
%define _disable_ld_no_undefined 1
%endif
2012-02-01 14:38:48 +04:00
%serverbuild
%configure \
2014-02-12 08:02:32 -05:00
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir}/ssh \
--mandir=%{_mandir} \
--libdir=%{_libdir} \
--libexecdir=%{_libdir}/ssh \
--datadir=%{_datadir}/ssh \
--disable-strip \
--with-tcp-wrappers \
--with-pam \
--with-default-path=%{OPENSSH_PATH} \
--with-xauth=%{XAUTH} \
--with-privsep-path=/var/empty \
--without-zlib-version-check \
--with-maildir=/var/spool/mail \
--with-sandbox=rlimit \
--with-ssh1 \
2014-02-12 08:02:32 -05:00
%if %{with krb5}
--with-kerberos5=%{_prefix} \
2012-02-01 14:38:48 +04:00
%endif
2014-02-12 08:02:32 -05:00
%if %{with skey}
--with-skey \
2012-02-01 14:38:48 +04:00
%endif
2014-02-12 08:02:32 -05:00
%if %{with ldap}
--with-libs="-lldap -llber" \
--with-cppflags="-DWITH_LDAP_PUBKEY -DLDAP_DEPRECATED" \
2012-02-01 14:38:48 +04:00
%endif
2014-02-12 08:02:32 -05:00
--with-superuser-path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:%{_sbindir}:%{_bindir} \
%if %{with libedit}
--with-libedit \
2012-02-01 14:38:48 +04:00
%else
2014-02-12 08:02:32 -05:00
--without-libedit \
2012-02-01 14:38:48 +04:00
%endif
2014-02-12 08:02:32 -05:00
%if %{with audit}
--with-linux-audit \
2012-02-01 14:38:48 +04:00
%endif
%ifarch %{ix86} %{arm}
# crisb - ftrapv causes link error (missing mulodi4) on 32-bit systems
# seems the configure code does not detect this (despite attempts)
find . -name Makefile -exec sed -i 's|-ftrapv||' {} \;
%endif
2012-02-01 14:38:48 +04:00
%make
2014-02-12 08:02:32 -05:00
%if %{with gnomeaskpass}
2012-02-01 18:01:49 +04:00
pushd contrib
2017-01-22 20:56:15 +10:00
make gnome-ssh-askpass2 CC="%{__cc} %{optflags} %{ldflags}"
2012-02-01 18:01:49 +04:00
mv gnome-ssh-askpass2 gnome-ssh-askpass
popd
%endif
2012-02-01 14:38:48 +04:00
%install
%makeinstall_std
install -d %{buildroot}%{_sysconfdir}/ssh
install -d %{buildroot}%{_sysconfdir}/pam.d/
install -d %{buildroot}%{_sysconfdir}/sysconfig
2014-02-12 08:02:32 -05:00
install -d %{buildroot}%{_unitdir}
2012-02-01 14:38:48 +04:00
install -m644 sshd.pam %{buildroot}%{_sysconfdir}/pam.d/sshd
2014-02-12 08:02:32 -05:00
install -m644 %{SOURCE18} %{buildroot}%{_unitdir}/sshd.service
install -m755 %{SOURCE22} %{buildroot}%{_sbindir}/sshd-keygen
install -m644 %{SOURCE23} %{buildroot}%{_unitdir}/sshd.socket
install -m644 %{SOURCE24} %{buildroot}%{_unitdir}/sshd@.service
install -m644 %{SOURCE25} %{buildroot}%{_unitdir}/sshd-keygen.service
2012-02-01 14:38:48 +04:00
if [[ -f sshd_config.out ]]; then
install -m600 sshd_config.out %{buildroot}%{_sysconfdir}/ssh/sshd_config
else
install -m600 sshd_config %{buildroot}%{_sysconfdir}/ssh/sshd_config
fi
echo "root" > %{buildroot}%{_sysconfdir}/ssh/denyusers
if [[ -f ssh_config.out ]]; then
install -m644 ssh_config.out %{buildroot}%{_sysconfdir}/ssh/ssh_config
else
install -m644 ssh_config %{buildroot}%{_sysconfdir}/ssh/ssh_config
fi
echo " StrictHostKeyChecking no" >> %{buildroot}%{_sysconfdir}/ssh/ssh_config
mkdir -p %{buildroot}%{_libdir}/ssh
install -d %{buildroot}%{_sysconfdir}/profile.d/
2014-02-12 08:02:32 -05:00
%if %{with gnomeaskpass}
2012-02-01 14:38:48 +04:00
install -m 755 contrib/gnome-ssh-askpass %{buildroot}%{_libdir}/ssh/gnome-ssh-askpass
%endif
cat > %{buildroot}%{_sysconfdir}/profile.d/90ssh-askpass.csh <<EOF
setenv SSH_ASKPASS %{_libdir}/ssh/ssh-askpass
EOF
cat > %{buildroot}%{_sysconfdir}/profile.d/90ssh-askpass.sh <<EOF
export SSH_ASKPASS=%{_libdir}/ssh/ssh-askpass
EOF
cat > %{buildroot}%{_sysconfdir}/profile.d/90ssh-client.sh <<'EOF'
# fix hanging ssh clients on exit
if [ -n "$BASH_VERSION" ]; then
shopt -s huponexit
elif [ -n "$ZSH_VERSION" ]; then
setopt hup
fi
EOF
install -m 0755 %{SOURCE3} %{buildroot}/%{_bindir}/ssh-copy-id
chmod a+x %{buildroot}/%{_bindir}/ssh-copy-id
install -m 644 contrib/ssh-copy-id.1 %{buildroot}/%{_mandir}/man1/
# create pre-authentication directory
mkdir -p %{buildroot}/var/empty
# remove unwanted files
rm -f %{buildroot}%{_libdir}/ssh/ssh-askpass
cat > %{buildroot}%{_sysconfdir}/sysconfig/sshd << EOF
#SSHD="%{_sbindir}/sshd"
#PID_FILE="/var/run/sshd.pid"
#OPTIONS=""
EOF
# avahi integration support (misc)
mkdir -p %{buildroot}%{_sysconfdir}/avahi/services/
install -m 0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/avahi/services/%{name}.service
# make sure strip can touch it
chmod 755 %{buildroot}%{_libdir}/ssh/ssh-keysign