File portsentry.spec of Package portsentry

#
# spec file for package portsentry (Version 1.1)
#
# Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://www.suse.de/feedback/
#

# norootforbuild

Name:         portsentry
Version:      1.1
Release:      194
Group:        Productivity/Networking/Security
License:      Contact author
Autoreqprov:  on
URL:          http://www.psionic.com/products/index.html
Summary:      A port scan detection and active response tool
PreReq:       %insserv_prereq  %fillup_prereq
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1220
BuildRequires: systemd
%endif
# - hmpf...???? %{?systemd_requires}
Source0:      http://www.psionic.com/downloads/%{name}-%{version}.tar.bz2
Source1:      rc.%{name}
Source2:      sysconfig.%{name}
Source3:      systemd.%{name}
Patch0:       %{name}-compile.patch

%description
PortSentry is a program designed to detect and respond to port scans in
real-time.



Authors:
--------
    Craig H. Rowland <business@psionic.com>

%define bin_dir         %{_sbindir}
%define conf_dir        %{_sysconfdir}/%{name}

%prep
%setup0
%patch0 -p1
%if 0%{?suse_version} <= 1210
%{?suse_update_config:%{suse_update_config}}
%endif
perl -pi -e 's:(CONFIG_FILE ")/usr/local/psionic/portsentry/(portsentry.conf"):$1'%{conf_dir}'/$2:' portsentry_config.h

%build
make linux CFLAGS="$RPM_OPT_FLAGS"

%install
[ "$RPM_BUILD_ROOT" != "" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
install -d $RPM_BUILD_ROOT/%{bin_dir}
install -d -m 700 $RPM_BUILD_ROOT/%{conf_dir}
install -d $RPM_BUILD_ROOT/etc/init.d
install -d $RPM_BUILD_ROOT/%{_fillupdir}
install -m 600 %{name}.conf %{name}.ignore $RPM_BUILD_ROOT/%{conf_dir}
perl -pi -e 's:#(KILL_ROUTE.*/usr/)local/(bin/iptables.*$):$1s$2: +\
	    s:/usr/local/psionic/portsentry:'%{conf_dir}': +\
	    s:^#(PORT_BANNER=):$1: +\
	    s:(RESOLVE_HOST) = :$1=:' \
	    $RPM_BUILD_ROOT/%{conf_dir}/%{name}.conf
touch $RPM_BUILD_ROOT/%{conf_dir}/%{name}.blocked
chmod 600 $RPM_BUILD_ROOT/%{conf_dir}/%{name}.blocked
install -m 700 %{name} $RPM_BUILD_ROOT/%{bin_dir}
install -m 700 %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/%{name}
perl -pi -e 's:\@bindir\@:'%{bin_dir}': +\
		s:\@confdir\@:'%{conf_dir}:  $RPM_BUILD_ROOT/etc/init.d/%{name}
ln -s ../../etc/init.d/%{name} $RPM_BUILD_ROOT/usr/sbin/rc%{name}
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_fillupdir}
install -d examples
mv ignore.csh examples
%if 0%{?suse_version} >= 1220
install -D -m 644 %{SOURCE3} %{buildroot}/%{_unitdir}/%{name}.service
%endif
 

%post
%{fillup_only -n portsentry}

%postun
%{insserv_cleanup}

%files
%defattr(-, root, root)
%dir %{conf_dir}
%config %attr(0600,root,root) %{conf_dir}/%{name}.conf
%config %attr(0600,root,root) %{conf_dir}/%{name}.ignore
%config %attr(0600,root,root) %{conf_dir}/%{name}.blocked
%{bin_dir}/%{name}
%config %attr(0700,root,root) /etc/init.d/%{name}
/usr/sbin/rc%{name}
%if 0%{?suse_version} >= 1220
%{_unitdir}/%{name}.service
%endif
%{_fillupdir}/sysconfig.%{name}
%doc CHANGES CREDITS LICENSE README.COMPAT README.install README.methods
%doc README.stealth examples

%changelog -n portsentry
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Sep 28 2005 - meissner@suse.de
- use RPM_OPT_FLAGS correctly.
* Tue Mar 02 2004 - kssingvo@suse.de
- shutdown re-enables blocked hosts
* Sun Jan 11 2004 - adrian@suse.de
- fix build as user
* Mon Aug 18 2003 - kssingvo@suse.de
- enhanced metadata of sysconfig (bugzilla#28920)
* Thu Feb 20 2003 - mmj@suse.de
- Add sysconfig metadata [#22674]
* Wed Oct 09 2002 - kssingvo@suse.de
- initial package
openSUSE Build Service is sponsored by