Blame dionaea.spec

Michal Ambroz aea04b
Name:           dionaea
Michal Ambroz 3dbb02
Version:        0.7.0
Michal Ambroz aea04b
Summary:        Low interaction honeypot
Michal Ambroz aea04b
Michal Ambroz a94045
# Show as the RPM release number (keep same number line for tarball and git builds)
rpmbuild 3e7a0d
%global         rel              5
Michal Ambroz a94045
Michal Ambroz aea04b
# Dionaea package is licensed with GPLv2
Michal Ambroz aea04b
# On top of that it is granting one exception extra - it is permitted by the license
Michal Ambroz aea04b
# to link modified binary files in the src/ directory against the openssl libraries.
Michal Ambroz aea04b
License:        GPLv2 with exceptions
Michal Ambroz aea04b
URL:            https://dionaea.readthedocs.io/
Michal Ambroz aea04b
#    Current source:
Michal Ambroz aea04b
#               https://github.com/DinoTools/dionaea
Michal Ambroz aea04b
#    Original site (dissappeared in 2013, but still available from archives):
Michal Ambroz aea04b
#               https://dionaea.carnivore.it -> https://web.archive.org/web/20150820080019/https://dionaea.carnivore.it
Michal Ambroz aea04b
#    Another forks:
Michal Ambroz aea04b
#               https://github.com/rep/dionaea
Michal Ambroz aea04b
#               https://gitlab.labs.nic.cz/honeynet/dionaea/
Michal Ambroz aea04b
#               https://github.com/devwerks/dionaea
Michal Ambroz aea04b
#               https://github.com/RootingPuntoEs/DionaeaFR/
Michal Ambroz aea04b
#               https://github.com/ManiacTwister/dionaea/
Michal Ambroz aea04b
#               https://github.com/tklengyel/dionaea
Michal Ambroz 2db08f
#               https://github.com/rep/dionaea
Michal Ambroz aea04b
#    Installation:
Michal Ambroz aea04b
#               https://www.aldeid.com/wiki/Dionaea/Installation
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Specification of the used GIT commit
Michal Ambroz aea04b
%global         gituser         DinoTools
Michal Ambroz aea04b
%global         gitname         dionaea
Michal Ambroz 3dbb02
%global         commit          079d014f47a71cc85a86bd836a9a4533e98d7385
Michal Ambroz 3dbb02
%global         gitdate         20180501
Michal Ambroz aea04b
%global         shortcommit     %(c=%{commit}; echo ${c:0:7})
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Use systemd unit files on Fedora and RHEL 7 and above.
Michal Ambroz aea04b
%global         _with_systemd   1
Michal Ambroz aea04b
Michal Ambroz aea04b
%if (0%{?rhel} && 0%{?rhel} < 7)
Michal Ambroz aea04b
    %global     _with_systemd   0
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Build source is github release=1 or git commit=0
Michal Ambroz 3dbb02
%global         build_release    1
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
%if 0%{?build_release}  > 0
5e9cd9
Release:        %{rel}%{?dist}.1
Michal Ambroz aea04b
Source0:        https://github.com/%{gituser}/%{gitname}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
#               not using 0. on the beginning of release as this git snapshot is past the 0.6.0 release
5e9cd9
Release:        %{rel}.%{gitdate}git%{shortcommit}%{?dist}.3
Michal Ambroz aea04b
Source0:        https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
Michal Ambroz aea04b
%endif #build_release
Michal Ambroz aea04b
Michal Ambroz aea04b
Source1:        %{name}.sysconfig
Michal Ambroz aea04b
Source2:        %{name}.initd
Michal Ambroz aea04b
Source3:        %{name}.service
Michal Ambroz aea04b
Source4:        %{name}.logrotate
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Use the glib CFLAGS and LDFLAGS during build where necessary
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/161
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/160
Michal Ambroz aea04b
# Merged in in https://github.com/DinoTools/dionaea/commit/1748f3b3936aa1da2d92500251ae8010fe181dfc
Michal Ambroz aea04b
# Patch1:         dionaea-01_glib.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Get rid of the warning about not used return value from chdir.
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/162
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/163
Michal Ambroz aea04b
# Merged in in https://github.com/DinoTools/dionaea/commit/ea5d54060af53250abfe3dde9f36af399fa30524
Michal Ambroz aea04b
# Patch2:         dionaea-02_warnerror.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# ipv6 structures in <netinet in.h=""> are used by the <sys socket.h="">
Michal Ambroz aea04b
# ipv6 structures needs explicit CFLAGS " -D_GNU_SOURCE" to compile on linux
Michal Ambroz aea04b
# just cosmetics - not reported yet to upstream
Michal Ambroz aea04b
Patch3:         dionaea-03_in6_pktinfo.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Unbundle the pyev library and use the system one
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/166
Michal Ambroz aea04b
Patch4:         dionaea-04_pyev.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Have a dedicated variable for the python sitelib, so it can be easily changed externally when building the system package.
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/164
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/165
Michal Ambroz aea04b
# Merged in in https://github.com/DinoTools/dionaea/commit/890ae5e85f55130be928b03b751b5f7cd1032f21
Michal Ambroz aea04b
# Patch5:         dionaea-05_sitelib.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Fix warnings during the generation of documentation
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/170
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/179
Michal Ambroz aea04b
Patch6:         dionaea-06_docswarn.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Fix configure not finding the cython on RHEL7/Centos7
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/180
Michal Ambroz 3dbb02
# Merged to upstream with 0.7.0
Michal Ambroz 3dbb02
# Patch7:         dionaea-07_cython_el7.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Fix hardcoded lib dir
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/181
Michal Ambroz aea04b
Patch8:         dionaea-08_modules_libdir.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Call setgroups before setresuid
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/177
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/178
Michal Ambroz aea04b
Patch9:         dionaea-09_setgroups_before_setresuid.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Call chdir before chroot
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/176
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/175
Michal Ambroz 3dbb02
# Merged upstream in 0.7.0
Michal Ambroz 3dbb02
# Patch10:        dionaea-10_chdir_before_chroot.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
# Not use obsolete m4 macros
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/pull/182
Michal Ambroz 3dbb02
# Merged upstream in 0.7.0
Michal Ambroz 3dbb02
# Patch11:        dionaea-11_obsolete_m4.patch
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
BuildRequires:  autoconf
Michal Ambroz aea04b
BuildRequires:  automake
Michal Ambroz aea04b
BuildRequires:  libtool
Michal Ambroz aea04b
BuildRequires:  flex
Michal Ambroz aea04b
BuildRequires:  bison
Michal Ambroz aea04b
BuildRequires:  pkgconfig
Michal Ambroz aea04b
BuildRequires:  sqlite
Michal Ambroz aea04b
BuildRequires:  git
Michal Ambroz aea04b
Michal Ambroz aea04b
BuildRequires:  libev-devel
Michal Ambroz aea04b
BuildRequires:  libemu-devel
Michal Ambroz aea04b
BuildRequires:  udns-devel
Michal Ambroz aea04b
BuildRequires:  libnl3-devel
Michal Ambroz aea04b
BuildRequires:  glib-devel
Michal Ambroz aea04b
BuildRequires:  curl-devel
Michal Ambroz aea04b
BuildRequires:  readline-devel
Michal Ambroz aea04b
BuildRequires:  libpcap-devel
Michal Ambroz aea04b
BuildRequires:  libsq3-devel
Michal Ambroz aea04b
BuildRequires:  sqlite
Michal Ambroz 2db08f
BuildRequires:  openssl-devel
Michal Ambroz aea04b
Michal Ambroz aea04b
BuildRequires:  python%{python3_pkgversion}-devel
Michal Ambroz aea04b
BuildRequires:  python%{python3_pkgversion}-Cython
Michal Ambroz aea04b
Michal Ambroz aea04b
%if 0%{?_with_systemd}
Michal Ambroz aea04b
BuildRequires:  systemd-units
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Optional dependencies
Michal Ambroz aea04b
BuildRequires:  loudmouth-devel
Michal Ambroz aea04b
BuildRequires:  libnetfilter_queue-devel
Michal Ambroz aea04b
BuildRequires:  libnl3-devel
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Missing dependencies
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Documentation generation
cd9c93
%if 0%{?rhel} && 0%{?rhel} <= 7
Michal Ambroz aea04b
BuildRequires:  python-sphinx
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
BuildRequires:  python3-sphinx
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
Requires:       logrotate
Michal Ambroz aea04b
Michal Ambroz 2db08f
# Base package can't run without the python module
Michal Ambroz 2db08f
Requires:       python%{python3_pkgversion}-dionaea
Michal Ambroz 2db08f
Michal Ambroz aea04b
%if 0%{?_with_systemd}
Michal Ambroz aea04b
%{?systemd_requires}
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
Requires(post): chkconfig
Michal Ambroz aea04b
Requires(preun): chkconfig
Michal Ambroz aea04b
Requires(preun): initscripts
Michal Ambroz aea04b
Requires(postun): initscripts
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
Requires(pre): shadow-utils
Michal Ambroz aea04b
Michal Ambroz aea04b
%description
Michal Ambroz aea04b
Dionaea honeypot is meant to be a nepenthes successor, embedding python
Michal Ambroz 922795
as scripting language, using libemu to detect shell-codes, supporting
Michal Ambroz 922795
ipv6 and TLS.
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# ============= documentation package ==========================================
Michal Ambroz aea04b
%package doc
Michal Ambroz aea04b
Summary:        Documentation for the dionaea honeypot package
Michal Ambroz aea04b
BuildArch:      noarch
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
%description doc
Michal Ambroz aea04b
This is documentation for the dionaea honeypot package.
Michal Ambroz aea04b
Dionaea honeypot is meant to be a nepenthes successor, embedding python
Michal Ambroz 922795
as scripting language, using libemu to detect shell-codes, supporting
Michal Ambroz 922795
ipv6 and TLS.
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# ============= python3 package ================================================
Michal Ambroz aea04b
%package -n python%{python3_pkgversion}-%{gitname}
Michal Ambroz aea04b
Summary:        Python3 binding for the dionaea honeypot
Michal Ambroz aea04b
%{?python_provide:%python_provide python%{python3_pkgversion}-%{gitname}}
Michal Ambroz aea04b
Michal Ambroz aea04b
# Runtime dependencies
Michal Ambroz aea04b
Requires:       python%{python3_pkgversion}-pyev
Michal Ambroz aea04b
Requires:       python%{python3_pkgversion}-bson
Michal Ambroz a94045
Requires:       python%{python3_pkgversion}-PyYAML
Michal Ambroz a94045
Requires:       python%{python3_pkgversion}-scapy
Michal Ambroz 2db08f
Requires:       python%{python3_pkgversion}-sqlalchemy
Michal Ambroz aea04b
Michal Ambroz aea04b
%description -n python%{python3_pkgversion}-%{gitname}
Michal Ambroz aea04b
This is a Python3 library that gives access to dionaea honeypot functionality.
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# ============= preparation ====================================================
Michal Ambroz aea04b
%prep
Michal Ambroz aea04b
%if 0%{?build_release} > 0
Michal Ambroz aea04b
# Build from git release version
Michal Ambroz 3dbb02
%autosetup -p 1 -n %{gitname}-%{version} -N
Michal Ambroz aea04b
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
# Build from git commit
Michal Ambroz 3dbb02
%autosetup -p 1 -n %{gitname}-%{commit} -N
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz 3dbb02
# Re-initialize the git repo, to track changes even on files ignored by the upstream
Michal Ambroz 3dbb02
rm -rf .git
Michal Ambroz 3dbb02
# Remove the .gitignore to prevent ignoring changes in some files
Michal Ambroz 3dbb02
rm -f .gitignore
Michal Ambroz 3dbb02
git init -q
22b3c6
git config user.email "rpmbuild"
22b3c6
git config user.name "rpmbuild"
Michal Ambroz 3dbb02
git add .
Michal Ambroz 3dbb02
git commit -a -m "base"
Michal Ambroz 3dbb02
Michal Ambroz 3dbb02
%autopatch -p 1
Michal Ambroz 3dbb02
Michal Ambroz aea04b
# Unbundle the pyev library and use the system one
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/169
Michal Ambroz aea04b
rm -rf modules/python/pyev
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# Fix paths - remove the hardcoded prefix /opt/dionaea
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/168
Michal Ambroz aea04b
sed -i -e "s|/opt/dionaea[/]*|/|g;" \
Michal Ambroz aea04b
    modules/python/util/readlogsqltree.py \
Michal Ambroz aea04b
    modules/python/util/logsql2postgres.py \
Michal Ambroz aea04b
    modules/python/util/gnuplotsql.py \
Michal Ambroz aea04b
    modules/python/util/updateccs.py \
Michal Ambroz aea04b
    src/dionaea.c \
Michal Ambroz aea04b
    vagrant/build.sh
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# replace in documentation the prefix/destdir /opt/dionaea with variable ${DESTDIR}
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/168
Michal Ambroz aea04b
sed -i -e "s|/opt/dionaea/var/dionaea|${DESTDIR}/var/lib/dionaea|g;" \
Michal Ambroz aea04b
    doc/html/index.html \
Michal Ambroz aea04b
    doc/source/tips_and_tricks.rst \
Michal Ambroz aea04b
    doc/source/old/configuration.rst \
Michal Ambroz aea04b
    doc/source/old/utils.rst \
Michal Ambroz aea04b
    modules/python/util/readlogsqltree.py
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# move /var/dionaea to /var/lib/dionaea according to Linux FHS
Michal Ambroz aea04b
# Fedora specific - not reported upstream
Michal Ambroz aea04b
sed -i -e "s|/var/dionaea|/var/lib/dionaea|g;" \
Michal Ambroz aea04b
    modules/python/util/readlogsqltree.py \
Michal Ambroz aea04b
    modules/python/util/gnuplotsql.py
Michal Ambroz aea04b
Michal Ambroz a94045
# Change var/dionaea to var/lib/dionaea for the location of sip user database
Michal Ambroz a94045
sed -i -e "s|var/dionaea|var/lib/dionaea|g;" \
Michal Ambroz a94045
    modules/python/dionaea/sip/extras.py
Michal Ambroz a94045
Michal Ambroz a94045
Michal Ambroz aea04b
# move /var/dionaea to /var/lib/dionaea according to Linux FHS
Michal Ambroz aea04b
# Fedora specific - not reported upstream
Michal Ambroz aea04b
sed -i -e 's|\$(localstatedir)/dionaea/|\$(localstatedir)/lib/dionaea/|g;' \
Michal Ambroz aea04b
    Makefile.am
Michal Ambroz aea04b
Michal Ambroz aea04b
# move /var/dionaea to /var/lib/dionaea according to Linux FHS
Michal Ambroz aea04b
# Fedora specific - not reported upstream
Michal Ambroz aea04b
sed -i -e 's|@LOCALESTATEDIR@/dionaea/|@LOCALESTATEDIR@/lib/dionaea/|g;' \
Michal Ambroz aea04b
    conf/dionaea.cfg.in \
Michal Ambroz aea04b
    conf/ihandlers/fail2ban.yaml.in \
Michal Ambroz aea04b
    conf/ihandlers/log_db_sql.yaml.in \
Michal Ambroz aea04b
    conf/ihandlers/log_incident.yaml.in \
Michal Ambroz aea04b
    conf/ihandlers/log_json.yaml.in \
Michal Ambroz aea04b
    conf/ihandlers/log_sqlite.yaml.in \
Michal Ambroz aea04b
    conf/ihandlers/virustotal.yaml.in \
Michal Ambroz aea04b
    conf/services/sip.yaml.in \
Michal Ambroz aea04b
    conf/services/http.yaml.in \
Michal Ambroz aea04b
    conf/services/ftp.yaml.in \
Michal Ambroz aea04b
    conf/services/tftp.yaml.in \
Michal Ambroz aea04b
    conf/services/upnp.yaml.in
Michal Ambroz aea04b
Michal Ambroz aea04b
# move the logs from /var/lib/dionaea to /var/log/dionaea
Michal Ambroz aea04b
sed -i -e 's|@LOCALESTATEDIR@/lib/dionaea/dionaea.log|@LOCALESTATEDIR@/log/dionaea/dionaea.log|g;
Michal Ambroz aea04b
    s|@LOCALESTATEDIR@/lib/dionaea/dionaea-errors.log|@LOCALESTATEDIR@/log/dionaea/dionaea-errors.log|g;
Michal Ambroz aea04b
'   conf/dionaea.cfg.in
Michal Ambroz aea04b
Michal Ambroz aea04b
# Change the hardoced minor python3.2 version especially in shabang to python3
Michal Ambroz aea04b
# https://github.com/DinoTools/dionaea/issues/169
Michal Ambroz aea04b
sed -i -e 's|python3.2|python3|g;' \
Michal Ambroz aea04b
    m4/az_python.m4 \
Michal Ambroz aea04b
    doc/html/index.html \
Michal Ambroz aea04b
    modules/python/util/readlogsqltree.py
Michal Ambroz aea04b
Michal Ambroz aea04b
# Scripts should run with /usr/bin/python3 shabang and not /bin/python3
Michal Ambroz aea04b
sed -i -e 's|#!/bin/python3|#!/usr/bin/python3|;' \
Michal Ambroz aea04b
    modules/python/util/readlogsqltree.py \
Michal Ambroz aea04b
    modules/python/util/logsql2postgres.py \
Michal Ambroz aea04b
    modules/python/util/gnuplotsql.py \
Michal Ambroz aea04b
    modules/python/util/updateccs.py
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz 3dbb02
git commit -a -m "finished prep"
Michal Ambroz 3dbb02
Michal Ambroz aea04b
Michal Ambroz aea04b
# ============= Build ==========================================================
Michal Ambroz aea04b
%build
Michal Ambroz aea04b
autoreconf -vif
rpmbuild 3e7a0d
# --disable-werror because of https://github.com/DinoTools/dionaea/issues/225
rpmbuild 3e7a0d
%configure --enable-python --with-python=`which python3` --with-glib=glib --with-nl-include=/usr/include/libnl3 --disable-werror
Michal Ambroz aea04b
make %{?_smp_mflags} CFLAGS="%{optflags} -Wno-error -D_GNU_SOURCE -std=c99"
Michal Ambroz aea04b
cd doc
Michal Ambroz aea04b
make html
Michal Ambroz aea04b
make man
Michal Ambroz aea04b
rm -rf build/html/.{doctrees,buildinfo}
Michal Ambroz aea04b
cd ..
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# ============= Install ========================================================
Michal Ambroz aea04b
%install
Michal Ambroz aea04b
# Use only the sitearch directory, otherwise python will be confused
Michal Ambroz aea04b
# by not having native and python modules in the same directory
Michal Ambroz aea04b
%make_install PYTHON_SITELIB=%{python3_sitearch} PYTHON_SITEARCH=%{python3_sitearch}
Michal Ambroz aea04b
Michal Ambroz aea04b
# *.a *.la files not allowed for fedora
Michal Ambroz aea04b
find %{buildroot} '(' -name '*.a' -o -name '*.la' ')' -delete
Michal Ambroz aea04b
Michal Ambroz aea04b
# Fix permissions
Michal Ambroz aea04b
chmod -x \
Michal Ambroz aea04b
    %{buildroot}%{_sharedstatedir}/%{name}/share/python/http/template/nginx/autoindex.html.j2 \
Michal Ambroz aea04b
    %{buildroot}%{_sharedstatedir}/%{name}/share/python/http/template/nginx/error.html.j2
Michal Ambroz aea04b
Michal Ambroz aea04b
# Move dionaea to sbin dir
Michal Ambroz aea04b
# TODO - report upstream
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sbindir}
Michal Ambroz aea04b
mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_sbindir}/%{name}
Michal Ambroz aea04b
Michal Ambroz aea04b
# Install the manpage
Michal Ambroz aea04b
# TODO - report upstream
Michal Ambroz aea04b
install -d %{buildroot}%{_mandir}/man1/
Michal Ambroz aea04b
install -p -D -m 644 doc/build/man/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
Michal Ambroz aea04b
mv doc/build/html/ ./html
Michal Ambroz aea04b
Michal Ambroz aea04b
# install the service parameter configuration
Michal Ambroz aea04b
# TODO - report upstream
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
Michal Ambroz aea04b
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
Michal Ambroz aea04b
Michal Ambroz aea04b
# install the service init files
Michal Ambroz aea04b
%if 0%{?_with_systemd}
Michal Ambroz aea04b
  # install systemd service files
Michal Ambroz aea04b
  mkdir -p %{buildroot}%{_unitdir}
Michal Ambroz aea04b
  install -p -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
  # install legacy SysV init scripts
Michal Ambroz aea04b
  mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
Michal Ambroz aea04b
  install -p -D -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
# Install logrotate
Michal Ambroz aea04b
install -p -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
Michal Ambroz aea04b
Michal Ambroz aea04b
# Create the log directory
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_localstatedir}/log/%{name} || :
Michal Ambroz aea04b
Michal Ambroz aea04b
# Create directories to capture binaries and payloads
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/binaries || :
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/bistreams || :
Michal Ambroz aea04b
Michal Ambroz aea04b
# Create directory for the content templates
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/roots/ftp  || :
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/roots/tftp || :
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/roots/www  || :
Michal Ambroz aea04b
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/roots/upnp || :
Michal Ambroz aea04b
Michal Ambroz 6331df
touch %{buildroot}%{_sharedstatedir}/%{name}/dionaea.sqlite
Michal Ambroz 6331df
touch %{buildroot}%{_sharedstatedir}/%{name}/dionaea_incident.sqlite
Michal Ambroz 6331df
touch %{buildroot}%{_sharedstatedir}/%{name}/sipaccounts.sqlite
Michal Ambroz 6331df
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# ============= Scriptlets ==========================================================
Michal Ambroz aea04b
%post
Michal Ambroz aea04b
%if 0%{?_with_systemd}
Michal Ambroz aea04b
  %systemd_post %{name}.service
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
  /sbin/chkconfig --add %{name}
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
%preun
Michal Ambroz aea04b
%if 0%{?_with_systemd}
Michal Ambroz aea04b
  %systemd_preun %{name}.service
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
  if [ $1 -eq 0 ] ; then
Michal Ambroz aea04b
     /sbin/service %{name} stop >/dev/null 2>&1 || :
Michal Ambroz aea04b
     /sbin/chkconfig --del %{name}
Michal Ambroz aea04b
  fi
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
%postun
Michal Ambroz aea04b
%if 0%{?_with_systemd}
Michal Ambroz aea04b
  %systemd_postun %{name}.service
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
  if [ $1 -eq 1 ] ; then
Michal Ambroz aea04b
     /sbin/service %{name} condrestart >/dev/null 2>&1 || :
Michal Ambroz aea04b
  fi
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
%pre
Michal Ambroz aea04b
getent group dionaea >/dev/null || groupadd -r dionaea || :
Michal Ambroz aea04b
getent passwd dionaea >/dev/null || \
Michal Ambroz aea04b
    useradd -r -g dionaea -d /home/dionaea -s /sbin/nologin \
Michal Ambroz aea04b
    -c "Dionaea honeypot" dionaea || :
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
# ============= package files ==================================================
Michal Ambroz aea04b
%files
Michal Ambroz aea04b
%license LICENSE
Michal Ambroz aea04b
%doc README.md
Michal Ambroz aea04b
%dir %{_sysconfdir}/%{name}
Michal Ambroz aea04b
%config(noreplace) %{_sysconfdir}/%{name}/*
Michal Ambroz aea04b
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
Michal Ambroz aea04b
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
Michal Ambroz aea04b
%{_sbindir}/%{name}
Michal Ambroz aea04b
%{_bindir}/gnuplotsql
Michal Ambroz aea04b
%{_bindir}/readlogsqltree
Michal Ambroz aea04b
%{_libdir}/%{name}/
Michal Ambroz aea04b
%exclude %{_libdir}/%{name}/python.so
Michal Ambroz aea04b
%{_mandir}/man1/%{name}.1.*
Michal Ambroz aea04b
%attr(0750,dionaea,dionaea) %dir %{_localstatedir}/log/%{name}
Michal Ambroz aea04b
%attr(0750,dionaea,dionaea) %dir %{_sharedstatedir}/%{name}
Michal Ambroz aea04b
%attr(0750,dionaea,dionaea) %dir %{_sharedstatedir}/%{name}/binaries
Michal Ambroz aea04b
%attr(0750,dionaea,dionaea) %dir %{_sharedstatedir}/%{name}/bistreams
Michal Ambroz aea04b
%attr(-,dionaea,dionaea)        %{_sharedstatedir}/%{name}/roots/
Michal Ambroz aea04b
%attr(-,dionaea,dionaea)        %{_sharedstatedir}/%{name}/share/
Michal Ambroz 6331df
%attr(-,dionaea,dionaea)	%{_sharedstatedir}/%{name}/dionaea.sqlite
rpmbuild 3e7a0d
%attr(-,dionaea,dionaea)	%{_sharedstatedir}/%{name}/dionaea_incident.sqlite
Michal Ambroz 6331df
%attr(-,dionaea,dionaea)	%{_sharedstatedir}/%{name}/sipaccounts.sqlite
Michal Ambroz 6331df
Michal Ambroz 6331df
Michal Ambroz 6331df
Michal Ambroz aea04b
Michal Ambroz aea04b
%if 0%{?_with_systemd}
Michal Ambroz aea04b
%{_unitdir}/*.service
Michal Ambroz aea04b
%else
Michal Ambroz aea04b
%{_initrddir}/*
Michal Ambroz aea04b
%endif
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
%files doc
Michal Ambroz aea04b
%doc README.md
Michal Ambroz aea04b
%doc html
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
%files -n python%{python3_pkgversion}-%{gitname}
Michal Ambroz aea04b
%license LICENSE
Michal Ambroz aea04b
%doc README.md
Michal Ambroz aea04b
%dir %{python3_sitearch}/%{name}
Michal Ambroz aea04b
%{_libdir}/%{name}/python.so
Michal Ambroz aea04b
%{python3_sitearch}/%{name}/*
Michal Ambroz aea04b
%{python3_sitearch}/%{name}-*egg-info
Michal Ambroz aea04b
Michal Ambroz aea04b
Michal Ambroz aea04b
%changelog
5e9cd9
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-5.1
5e9cd9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
5e9cd9
rpmbuild 3e7a0d
* Mon Jul 30 2018 Adam Williamson <awilliam@redhat.com> - 0.7.0-5
rpmbuild 3e7a0d
- Disable -Werror to fix build (see upstream #225)
rpmbuild 3e7a0d
78a15f
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-4.2
78a15f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
78a15f
3211c1
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.7.0-4.1
3211c1
- Rebuilt for Python 3.7
3211c1
Michal Ambroz 6331df
* Mon Jun 18 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.7.0-4
Michal Ambroz 6331df
- anothe improvement of logrotate script
Michal Ambroz 6331df
- add the empty files for dionaea.sqlite dionaea_incident.sqlite sipaccounts.sqlite
Michal Ambroz 6331df
Michal Ambroz 2db08f
* Mon Jun 04 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.7.0-3
Michal Ambroz 2db08f
- fix logrotate script
Michal Ambroz 2db08f
- use the current version of openssl (needs to be same as curllib is using)
Michal Ambroz 2db08f
Michal Ambroz 3dbb02
* Thu May 10 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.7.0-1
Michal Ambroz 3dbb02
- bump to release 0.7.0
Michal Ambroz 3dbb02
Michal Ambroz 828877
* Mon May 07 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-10.20180326git1748f3b
Michal Ambroz 828877
- cosmetics, changing description in the systemd service
Michal Ambroz 828877
Michal Ambroz e298b3
* Mon Apr 30 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-9.20180326git1748f3b
Michal Ambroz a94045
- add runtime python dependencies
Michal Ambroz a94045
- fix location of sip user database
Michal Ambroz a94045
59c5ba
* Mon Apr 30 2018 Iryna Shcherbina <shcherbina.iryna@gmail.com> - 0.6.0-8.20180326git1748f3b
cd9c93
- Fix condition for python-sphinx on Fedora
cd9c93
Michal Ambroz f0b083
* Fri Apr 20 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-7.20180326git1748f3b
Michal Ambroz f0b083
- fix the link creation to python core library 
Michal Ambroz f0b083
Michal Ambroz aea04b
* Mon Apr 09 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-6.20180326git1748f3b
Michal Ambroz aea04b
- fix log rotation, move the logs to /var/log/dionaea
Michal Ambroz aea04b
- create user dionaea:dionaea
Michal Ambroz aea04b
- grant shared stare dir/files to the dionaea user account
Michal Ambroz aea04b
Michal Ambroz aea04b
* Mon Apr 09 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-5.20180326git1748f3b
Michal Ambroz aea04b
- clean-up based on review in #1564716
Michal Ambroz aea04b
Michal Ambroz aea04b
* Fri Apr 06 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-4.20180326git1748f3b
Michal Ambroz aea04b
- update to current git snapshot, add logrotate and service files
Michal Ambroz aea04b
Michal Ambroz aea04b
* Wed Mar 21 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-3.20180313gitd2efb76
Michal Ambroz aea04b
- fix openssl dependency for EPEL7 build
Michal Ambroz aea04b
Michal Ambroz aea04b
* Wed Mar 21 2018 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-2.20180313gitd2efb76
Michal Ambroz aea04b
- bump to commit d2efb768e753a7f1ddca6dbf402548d741f33574
Michal Ambroz aea04b
- unbundle pyev and refer to system-installed pyev
Michal Ambroz aea04b
- remove the hardcoded default prefix /opt/dionaea
Michal Ambroz aea04b
- move from /var/dionaea to /var/lib/dionaea
Michal Ambroz aea04b
- fix the doc generation warnings
Michal Ambroz aea04b
Michal Ambroz aea04b
* Thu Dec 28 2017 Michal Ambroz <rebus at,="" seznam.cz=""> 0.6.0-1
Michal Ambroz aea04b
- initial package
Michal Ambroz aea04b