File suricata.spec of Package suricata

# spec file for package suricata
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# 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

%if 0%{?suse_version} > 1500
%ifarch %{ix86} x86_64
%bcond_without hyperscan
Name:           suricata
Version:        4.1.8
Release:        0
Summary:        Open Source Next Generation Intrusion Detection and Prevention Engine
License:        GPL-2.0-only
Source2:        suricata.service
Source3:        suricata.sysconfig
Source4:        suricata.logrotate
BuildRequires:  coccinelle
BuildRequires:  file-devel
BuildRequires:  libnet-devel
BuildRequires:  libpcap-devel
BuildRequires:  pkgconfig
BuildRequires:  python3
BuildRequires:  python3-PyYAML
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(geoip)
BuildRequires:  pkgconfig(hiredis)
BuildRequires:  pkgconfig(htp)
BuildRequires:  pkgconfig(jansson)
BuildRequires:  pkgconfig(libcap-ng)
BuildRequires:  pkgconfig(liblz4)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libnetfilter_log)
BuildRequires:  pkgconfig(libnetfilter_queue)
BuildRequires:  pkgconfig(libnfnetlink)
BuildRequires:  pkgconfig(libpcre)
BuildRequires:  pkgconfig(libprelude)
BuildRequires:  pkgconfig(lua)
BuildRequires:  pkgconfig(nspr)
BuildRequires:  pkgconfig(nss)
BuildRequires:  pkgconfig(yaml-0.1)
BuildRequires:  pkgconfig(zlib)
Requires(pre):  %fillup_prereq
Recommends:     jq
Recommends:     logrotate
%if 0%{with hyperscan}
BuildRequires:  pkgconfig(libhs)

The Suricata Engine is an Open Source Next Generation Intrusion Detection and Prevention Engine. This engine is not intended to just replace or emulate the existing tools in the industry, but will bring new ideas and technologies to the field.

OISF is part of and funded by the Department of Homeland Security's Directorate for Science and Technology HOST program (Homeland Open Security Technology), by the the Navy's Space and Naval Warfare Systems Command (SPAWAR), as well as through the very generous support of the members of the OISF Consortium. More information about the Consortium is available, as well as a list of our current Consortium Members.

%setup -q
# Fix path in manpage
sed -i 's|%{_prefix}/local||g' doc/userguide/suricata.1

export HAVE_PYTHON=/usr/bin/python3
%configure \
    --enable-gccmarch-native=no \
    --enable-nflog \
    --with-libnetfilter_log-includes=`pkg-config libnetfilter_log --variable=includedir` \
    --enable-nfqueue \
    --enable-prelude \
    --enable-gccprotect \
    --enable-old-barnyard2 \
    --enable-non-bundled-htp \
    --enable-geoip \
    --enable-lua \
%if 0%{with hyperscan}
    --enable-hyperscan \
make %{?_smp_mflags}

mkdir -p %{buildroot}%{_localstatedir}/log/suricata
mkdir -p %{buildroot}%{_localstatedir}/lib/suricata
mkdir -p %{buildroot}%{_sysconfdir}/suricata
mkdir -p %{buildroot}%{_sbindir}
cp *.config %{buildroot}%{_sysconfdir}/suricata/
cp suricata.yaml %{buildroot}%{_sysconfdir}/suricata/
cp -R rules %{buildroot}%{_sysconfdir}/suricata/
rm -rf %{buildroot}/%{_datadir}/doc/suricata
rm -rf %{buildroot}%{python3_sitelib}/suricata/__pycache__
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
install -Dpm 0644 %{SOURCE3} %{buildroot}%{_fillupdir}/sysconfig.%{name}
install -Dpm 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcsuricata
mkdir -p %{buildroot}%{_localstatedir}/log/suricata

%service_add_pre %{name}.service

%service_add_post %{name}.service

%service_del_preun %{name}.service

%service_del_postun %{name}.service

%license COPYING
%doc doc/AUTHORS doc/Basic_Setup.txt doc/GITGUIDE doc/INSTALL.PF_RING doc/Setting_up_IPSinline_for_Linux.txt doc/Third_Party_Installation_Guides.txt doc/TODO
%dir %{_localstatedir}/log/suricata
%dir %{_localstatedir}/lib/suricata
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}

openSUSE Build Service is sponsored by