]>
Commit | Line | Data |
---|---|---|
3be96913 | 1 | %define template synflood-defender |
3be96913 ER |
2 | Summary: Template for Cacti - Synflood-Defender |
3 | Name: cacti-template-%{template} | |
4 | Version: 0.1.0 | |
5 | Release: 1 | |
6 | License: GPL v2 | |
7 | Group: Applications/WWW | |
8 | Source0: http://synflood-defender.net/_media/download/synflooddefender-%{version}-linux.tar.gz | |
9 | # Source0-md5: d744ae65a69edbf893c86e36498be85a | |
10 | Source1: http://synflood-defender.net/_media/download/synflooddefender_cacti_tpls.tar.gz | |
11 | # Source1-md5: f0002aa57955008dc5e51b11c1c3cdc6 | |
8f0159ad | 12 | Patch0: iproute.patch |
3be96913 ER |
13 | URL: http://synflood-defender.net/ |
14 | BuildRequires: rpm-php-pearprov >= 4.4.2-11 | |
15 | BuildRequires: rpmbuild(macros) >= 1.554 | |
16 | Requires: cacti >= 0.8.7e-8 | |
17 | BuildArch: noarch | |
18 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
19 | ||
20 | %define cactidir /usr/share/cacti | |
21 | %define resourcedir %{cactidir}/resource | |
22 | %define scriptsdir %{cactidir}/scripts | |
23 | %define _libdir %{_prefix}/lib | |
24 | %define snmpdconfdir /etc/snmp | |
25 | %define snmpdextend synflooddefender | |
26 | ||
27 | %description | |
28 | Synflood-Defender is an extension for SNMP protocol, which is used for | |
29 | monitoring SYN-queue and protection the host if SYN-flood attack | |
30 | happens. | |
31 | ||
32 | Features: | |
33 | - monitoring SYN-queue | |
34 | - changing TCP kernel parameters "on-the-fly" when threshold is | |
35 | reached | |
36 | - 2 protection modes: dynamic and force | |
37 | - the ability to specify kernel parameters you want to change | |
38 | - templates for Cacti are available for download | |
39 | - the ability to integrate with any monitoring system which supports | |
40 | SNMP | |
41 | ||
42 | %package -n net-snmp-agent-synflood-defender | |
43 | Summary: SNMPd agent to for Synflood Defender | |
44 | Group: Networking/Daemons | |
45 | Requires: net-snmp | |
8f0159ad ER |
46 | # for ss |
47 | Requires: iproute2 | |
3be96913 ER |
48 | |
49 | %description -n net-snmp-agent-synflood-defender | |
50 | SNMPd agent to for Synflood Defender. | |
51 | ||
52 | %prep | |
53 | %setup -qn synflooddefender-%{version}-linux -a1 | |
54 | mv synflooddefender_cacti_tpls/*.xml . | |
8f0159ad | 55 | %patch0 -p1 |
3be96913 ER |
56 | |
57 | %install | |
58 | rm -rf $RPM_BUILD_ROOT | |
59 | install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{_sysconfdir}/%{template},%{_libdir}} | |
60 | cp -p *.xml $RPM_BUILD_ROOT%{resourcedir} | |
61 | ||
62 | cp -p %{template}.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{template} | |
63 | cp -p state $RPM_BUILD_ROOT%{_sysconfdir}/%{template} | |
64 | cp -p %{template}.sh $RPM_BUILD_ROOT%{_libdir}/%{template} | |
65 | ||
66 | %post | |
67 | %cacti_import_template %{resourcedir}/cacti_data_template_%{template}.xml | |
68 | %cacti_import_template %{resourcedir}/cacti_graph_template_%{template}.xml | |
69 | ||
70 | %clean | |
71 | rm -rf $RPM_BUILD_ROOT | |
72 | ||
73 | %post -n net-snmp-agent-%{template} | |
74 | if ! grep -qF %{snmpdextend} %{snmpdconfdir}/snmpd.local.conf; then | |
75 | echo "extend %{snmpdextend} %{_libdir}/%{template}" >> %{snmpdconfdir}/snmpd.local.conf | |
76 | ||
77 | %service -q snmpd reload | |
78 | fi | |
79 | ||
80 | %preun -n net-snmp-agent-%{template} | |
81 | if [ "$1" = 0 ]; then | |
82 | if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then | |
83 | %{__sed} -i -e "/extend %{snmpdextend}/d" %{snmpdconfdir}/snmpd.local.conf | |
84 | %service -q snmpd reload | |
85 | fi | |
86 | fi | |
87 | ||
88 | %files | |
89 | %defattr(644,root,root,755) | |
90 | %{resourcedir}/cacti_data_template_%{template}.xml | |
91 | %{resourcedir}/cacti_graph_template_%{template}.xml | |
92 | ||
93 | %files -n net-snmp-agent-%{template} | |
94 | %defattr(644,root,root,755) | |
95 | %dir %{_sysconfdir}/%{template} | |
96 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{template}/%{template}.conf | |
97 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{template}/state | |
98 | %attr(755,root,root) %{_libdir}/%{template} |