forked from CERN-CERT/pDNSSOC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdnssoc.spec
121 lines (100 loc) · 3.29 KB
/
pdnssoc.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
%global gem_name pdnssoc
Name: rubygem-%{gem_name}
Version: 0.1.4
Release: 1%{?dist}
Summary: pDNS correlation with MISP
License: MIT
URL: https://github.com/CERN-CERT/pDNSSOC/
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 2.5.0
BuildRequires: td-agent
BuildRequires: systemd-rpm-macros
BuildArch: noarch
%description
pDNS correlation with MISP.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
# Install fluentd gems
td-agent-gem install parseconfig
td-agent-gem install misp
td-agent-gem install fluent-plugin-filter-list --force
# Installing files in /etc/pdnssoc
install -d %{buildroot}%{_sysconfdir}
install -d %{buildroot}%{_sysconfdir}/pdnssoc
touch %{buildroot}%{_sysconfdir}/pdnssoc/misp_ips.txt
touch %{buildroot}%{_sysconfdir}/pdnssoc/misp_domains.txt
install -p -m0644 config/pdnssoc.conf %{buildroot}%{_sysconfdir}/pdnssoc/pdnssoc.conf
install -p -m0644 config/td-agent.conf.template %{buildroot}%{_sysconfdir}/pdnssoc/td-agent.conf.template
install -p -m0644 config/notification_email.html %{buildroot}%{_sysconfdir}/pdnssoc/notification_email.html
# Install pdnssoc code
mkdir -p %{buildroot}/usr/local/bin/pdnssoc
cp -a lib/* %{buildroot}/usr/local/bin/pdnssoc
# Installing timers
install -d %{buildroot}%{_unitdir}
install -p -m0644 timers/* %{buildroot}%{_unitdir}/
%check
pushd .%{gem_instdir}
# Run the test suite.
popd
%files
%dir %{gem_instdir}
%{gem_libdir}
%{gem_instdir}/config
%{gem_instdir}/timers
%exclude %{gem_cache}
%{gem_spec}
# Timers
%{_unitdir}/pdnssoc.timer
%{_unitdir}/pdnssoc.service
%{_unitdir}/lookingback.timer
%{_unitdir}/lookingback.service
%{_unitdir}/misp_refresh.service
%{_unitdir}/misp_refresh.timer
# Main pdnssoc directory
%dir %{_sysconfdir}/pdnssoc
%config(noreplace) %{_sysconfdir}/pdnssoc/misp_ips.txt
%config(noreplace) %{_sysconfdir}/pdnssoc/misp_domains.txt
%config(noreplace) %{_sysconfdir}/pdnssoc/pdnssoc.conf
%config(noreplace) %{_sysconfdir}/pdnssoc/td-agent.conf.template
%{_sysconfdir}/pdnssoc/notification_email.html
# Code of pdnssoc
%dir /usr/local/bin/pdnssoc
/usr/local/bin/pdnssoc/*
%files doc
%doc %{gem_docdir}
%post
# Enable Timers
%systemd_post pdnssoc.service
%systemd_post lookingback.service
%systemd_post misp_refresh.service
%preun
%systemd_preun pdnssoc.service
%systemd_preun lookingback.service
%systemd_preun misp_refresh.service
%postun
%systemd_postun_with_restart pdnssoc.service
%systemd_postun_with_restart lookingback.service
%systemd_postun_with_restart misp_refresh.service
%changelog
* Mon Aug 10 2023 Pau Cutrina, Romain Wartel, Christos Arvanitis <[email protected]> - 1.0-1
- Changes to make it more GEM standard
* Mon Aug 07 2023 Pau Cutrina, Romain Wartel, Christos Arvanitis <[email protected]> - 1.0-1
- Initial RPM package