File sslh.spec of Package sslh
#
# spec file for package sslh
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (C) 2012 by Lars Vogdt
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define sslh_user sslh
Name: sslh
Version: 1.20
Release: 0
Summary: SSL/SSH multiplexer
License: GPL-2.0+
Group: Productivity/Networking/SSH
Url: http://www.rutschle.net/tech/sslh.shtml
Source: http://www.rutschle.net/tech/%{name}/%{name}-v%{version}.tar.gz
Source1: %{name}.init
Source2: %{name}.sysconfig
Source3: %{name}.conf.d
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: coreutils
PreReq: pwdutils
BuildRequires: libcap-devel
BuildRequires: libconfig-devel
BuildRequires: tcpd-devel
BuildRequires: pcre-devel
#
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%else
Requires(pre): %insserv_prereq
%endif
#
Requires: openssh
Requires: openssl
%description
sslh lets one accept both HTTPS and SSH connections on the same port. It makes
it possible to connect to an SSH server on port 443 (e.g. from inside a
corporate firewall) while still serving HTTPS on that port.
%prep
%setup -q -n %{name}-v%{version}
%build
#
%install
MAKEOPTS="USELIBCAP=1 PREFIX=%{_prefix} DESTDIR=%{buildroot} install"
%if 0%{?suse_version} <= 1210
MAKEOPTS="USELIBCONFIG=0 $MAKEOPTS"
%endif
make $MAKEOPTS
# systemd vs SysVinit
%if 0%{?has_systemd}
install -Dm644 scripts/systemd.%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -Dm644 %{S:3} %{buildroot}%{_sysconfdir}/conf.d/%{name}
ln -sf %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}
# install default configuration
mkdir -p %{buildroot}%{_sysconfdir}/default
cp scripts/etc.sysconfig.%{name} %{buildroot}%{_sysconfdir}/default/%{name}
%else #SysVinit
install -Dm755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/%{name}
ln -s %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
# install sysconfig file
install -Dm644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
%endif
%pre
# Create user on the system if necessary
if
id %{sslh_user} > /dev/null 2>&1
then
: OK user sslh already present
else
useradd -r -o -g nogroup -s /bin/false -c "User for SSLH" -d /var/lib/empty %{sslh_user} 2> /dev/null || :
fi
%if 0%{?has_systemd}
%service_add_pre %{name}.service
%endif
%post
%if 0%{?has_systemd}
%service_add_post %{name}.service
%else
%fillup_and_insserv %{name}
%endif
%preun
%if 0%{?has_systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal %{name}
%endif
%postun
%if 0%{?has_systemd}
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%insserv_cleanup
%endif
%files
%defattr(-, root, root)
%doc ChangeLog README.md
%{_sbindir}/%{name}
%{_sbindir}/rc%{name}
%if 0%{?has_systemd}
%{_unitdir}/%{name}.service
%dir %{_sysconfdir}/conf.d
%config(noreplace) %{_sysconfdir}/conf.d/%{name}
%config(noreplace) %{_sysconfdir}/default/%{name}
%else
%{_sysconfdir}/init.d/%{name}
/var/adm/fillup-templates/sysconfig.%{name}
%endif
%doc %{_mandir}/man8/%{name}.8*
%changelog