File sslh.spec of Package sslh

# spec file for package sslh
# 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.

Name:           sslh
Version:        1.16
Release:        0
License:        GPL-2.0+
Summary:        SSL/SSH multiplexer
Group:          Productivity/Networking/SSH
Source1:        sslh.init
Source2:        sslh.sysconfig
Source3:        sslh.conf.d
Patch1:         missing-call-to-setgroups-before-setuid.patch
BuildRequires:  libcap-devel
BuildRequires:  tcpd-devel
BuildRequires:  libconfig-devel
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
PreReq:         coreutils
PreReq:         pwdutils
Requires:       openssh
Requires:       openssl
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define         sslh_user sslh

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.

%setup -q -n %{name}-v%{version}
%patch1 -p1
cp -a %{S:1} .


MAKEOPTS="USELIBCAP=1 PREFIX=%{_prefix} DESTDIR=%{buildroot} install"
%if 0%{?suse_version} <= 1210
%if 0%{?suse_version} > 1210
# install default configuration
mkdir -p %{buildroot}%{_sysconfdir}/default
sed -e "s|USER=nobody|USER=%{sslh_user}|g;
		s|LISTEN=ifname:443|LISTEN=|g" scripts/etc.default.sslh > %{buildroot}%{_sysconfdir}/default/sslh
# install init script and depending sysconfig file
install -Dm755 sslh.init %{buildroot}%{_sysconfdir}/init.d/sslh
ln -s %{_sysconfdir}/init.d/sslh %{buildroot}%{_sbindir}/rcsslh
install -Dm644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
%if 0%{?suse_version} >= 1210
# install systemd service
install -Dm644 scripts/systemd.sslh.service %{buildroot}%{_unitdir}/%{name}.service
install -Dm644 %SOURCE3 %{buildroot}%{_sysconfdir}/conf.d/sslh


rm -fr %{buildroot}

# Create user on the system if necessary
    id %{sslh_user} > /dev/null 2>&1
    : OK user sslh already present
    useradd  -r -o -g nogroup -s /bin/false -c "User for SSLH" -d /var/lib/empty %{sslh_user} 2> /dev/null || :
%if 0%{?suse_version} >= 1210
%service_add_pre %{name}.service

%fillup_and_insserv %{name}
%if 0%{?suse_version} >= 1210
%service_add_post %{name}.service

%stop_on_removal %{name}
%if 0%{?suse_version} >= 1210
%service_del_preun %{name}.service

%restart_on_update %{name}
%if 0%{?suse_version} >= 1210
%service_del_postun %{name}.service

%defattr(-, root, root)
%doc ChangeLog
%if 0%{?suse_version} > 1210
%config(noreplace) %{_sysconfdir}/default/sslh
%if 0%{?suse_version} >= 1210
%dir %{_sysconfdir}/conf.d
%config(noreplace) %{_sysconfdir}/conf.d/sslh
%doc %{_mandir}/man8/sslh.8*

openSUSE Build Service is sponsored by