4 %define psadlogdir /var/log/psad
5 %define psadrundir /var/run/psad
6 %define psadvarlibdir /var/lib/psad
8 Summary: psad analyzes iptables log messages for suspect traffic
13 Group: Applications/Internet
14 Url: http://www.cipherdyne.org/psad/
15 Source: %name-%version.tar.gz
16 BuildRoot: %_tmppath/%{name}-buildroot
21 Port Scan Attack Detector (psad) is a collection of three lightweight
22 system daemons written in Perl and in C that are designed to work with Linux
23 iptables firewalling code to detect port scans and other suspect traffic. It
24 features a set of highly configurable danger thresholds (with sensible
25 defaults provided), verbose alert messages that include the source,
26 destination, scanned port range, begin and end times, tcp flags and
27 corresponding nmap options, reverse DNS info, email and syslog alerting,
28 automatic blocking of offending ip addresses via dynamic configuration of
29 iptables rulesets, and passive operating system fingerprinting. In addition,
30 psad incorporates many of the tcp, udp, and icmp signatures included in the
31 snort intrusion detection system (http://www.snort.org) to detect highly
32 suspect scans for various backdoor programs (e.g. EvilFTP, GirlFriend,
33 SubSeven), DDoS tools (mstream, shaft), and advanced port scans (syn, fin,
34 xmas) which are easily leveraged against a machine via nmap. psad can also
35 alert on snort signatures that are logged via fwsnort
36 (http://www.cipherdyne.org/fwsnort/), which makes use of the
37 iptables string match module to detect application layer signatures.
41 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
46 ### build psad binaries (kmsgsd and psadwatchd)
47 make OPTS="$RPM_OPT_FLAGS"
51 #mkdir -p $RPM_BUILD_ROOT%psadetcdir
53 mkdir -p $RPM_BUILD_ROOT%psadlogdir
55 mkdir -p $RPM_BUILD_ROOT%psadvarlibdir
57 mkdir -p $RPM_BUILD_ROOT%psadrundir
59 mkdir -p $RPM_BUILD_ROOT%_bindir
60 mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
61 mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
62 mkdir -p $RPM_BUILD_ROOT%_sbindir
64 mkdir -p $RPM_BUILD_ROOT%_sysconfdir/%name
66 mkdir -p $RPM_BUILD_ROOT%_initrddir
68 ### the 700 permissions mode is fixed in the
70 install -m 700 psad $RPM_BUILD_ROOT%_sbindir/
71 install -m 700 kmsgsd $RPM_BUILD_ROOT%_sbindir/
72 install -m 700 psadwatchd $RPM_BUILD_ROOT%_sbindir/
73 install -m 500 fwcheck_psad.pl $RPM_BUILD_ROOT%_sbindir/fwcheck_psad
74 install -m 755 nf2csv $RPM_BUILD_ROOT/usr/bin/nf2csv
75 install -m 755 init-scripts/psad-init.redhat $RPM_BUILD_ROOT%_initrddir/psad
76 install -m 644 psad.conf $RPM_BUILD_ROOT%_sysconfdir/%name/
77 install -m 644 signatures $RPM_BUILD_ROOT%_sysconfdir/%name/
78 install -m 644 icmp_types $RPM_BUILD_ROOT%_sysconfdir/%name/
79 install -m 644 icmp6_types $RPM_BUILD_ROOT%_sysconfdir/%name/
80 install -m 644 ip_options $RPM_BUILD_ROOT%_sysconfdir/%name/
81 install -m 644 auto_dl $RPM_BUILD_ROOT%_sysconfdir/%name/
82 install -m 644 snort_rule_dl $RPM_BUILD_ROOT%_sysconfdir/%name/
83 install -m 644 pf.os $RPM_BUILD_ROOT%_sysconfdir/%name/
84 install -m 644 posf $RPM_BUILD_ROOT%_sysconfdir/%name/
85 install -m 644 *.8 $RPM_BUILD_ROOT%{_mandir}/man8/
86 install -m 644 nf2csv.1 $RPM_BUILD_ROOT%{_mandir}/man1/
89 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
92 #if [ ! -p /var/lib/psad/psadfifo ];
93 #then [ -e /var/lib/psad/psadfifo ] && /bin/rm -f /var/lib/psad/psadfifo
95 #/bin/mknod -m 600 /var/lib/psad/psadfifo p
96 #chown root.root /var/lib/psad/psadfifo
97 #chmod 0600 /var/lib/psad/psadfifo
100 ### put the current hostname into the psad C binaries
101 ### (kmsgsd and psadwatchd).
102 perl -p -i -e 'use Sys::Hostname; my $hostname = hostname(); s/HOSTNAME(\s+)_?CHANGE.?ME_?/HOSTNAME${1}$hostname/' %_sysconfdir/%name/psad.conf
104 /bin/touch %psadlogdir/fwdata
105 chown root.root %psadlogdir/fwdata
106 chmod 0500 %_sbindir/psad
107 chmod 0500 %_sbindir/kmsgsd
108 chmod 0500 %_sbindir/psadwatchd
109 chmod 0600 %psadlogdir/fwdata
110 if [ ! -p %psadvarlibdir/psadfifo ];
111 then [ -e %psadvarlibdir/psadfifo ] && /bin/rm -f %psadvarlibdir/psadfifo
112 /bin/mknod -m 600 %psadvarlibdir/psadfifo p
114 chown root.root %psadvarlibdir/psadfifo
115 chmod 0600 %psadvarlibdir/psadfifo
116 ### make psad start at boot
117 /sbin/chkconfig --add psad
118 if grep -q "EMAIL.*root.*localhost" /etc/psad/psad.conf;
120 echo "[+] You can edit the EMAIL_ADDRESSES variable in /etc/psad/psad.conf"
121 echo " to have email alerts sent to an address other than root\@localhost"
124 if grep -q "HOME_NET.*CHANGEME" /etc/psad/psad.conf;
126 echo "[+] Be sure to edit the HOME_NET variable in /etc/psad/psad.conf"
127 echo " to define the internal network(s) attached to your machine."
131 #%_preun_service psad
134 %defattr(-,root,root)
144 %dir %_sysconfdir/%name
145 %config(noreplace) %_sysconfdir/%name/*.conf
146 %config(noreplace) %_sysconfdir/%name/signatures
147 %config(noreplace) %_sysconfdir/%name/auto_dl
148 %config(noreplace) %_sysconfdir/%name/ip_options
149 %config(noreplace) %_sysconfdir/%name/snort_rule_dl
150 %config(noreplace) %_sysconfdir/%name/posf
151 %config(noreplace) %_sysconfdir/%name/pf.os
152 %config(noreplace) %_sysconfdir/%name/icmp_types
153 %config(noreplace) %_sysconfdir/%name/icmp6_types
156 * Wed Apr 18 2012 Michael Rash <mbr@cipherdyne.org>
157 - Update to use the NetAddr::IP module for all IP/subnet calculations
160 * Wed Jul 14 2010 Michael Rash <mbr@cipherdyne.org>
163 * Fri Jul 09 2010 Michael Rash <mbr@cipherdyne.org>
166 * Fri Feb 20 2009 Michael Rash <mbr@cipherdyne.org>
169 * Sun Aug 21 2008 Michael Rash <mbr@cipherdyne.org>
170 - This spec file omits installing any perl modules that psad depends upon.
173 * Sat Jun 07 2008 Michael Rash <mbr@cipherdyne.org>
176 * Thu Apr 03 2008 Michael Rash <mbr@cipherdyne.org>
179 * Fri Jan 25 2008 Michael Rash <mbr@cipherdyne.org>
182 * Fri Oct 19 2007 Michael Rash <mbr@cipherdyne.org>
185 * Mon Jul 27 2007 Michael Rash <mbr@cipherdyne.org>
188 * Mon May 28 2007 Michael Rash <mbr@cipherdyne.org>
191 * Fri Mar 24 2007 Michael Rash <mbr@cipherdyne.org>
194 * Thu Mar 01 2007 Michael Rash <mbr@cipherdyne.org>
196 - Removed all config files except for psad.conf since the psad daemons now all
197 reference the same config file (psad.conf).
199 * Sat Jan 27 2007 Michael Rash <mbr@cipherdyne.org>
202 * Sun Dec 31 2006 Michael Rash <mbr@cipherdyne.org>
204 - Removed Psad.pm perl module and kmsgsd.pl and psadwatchd.pl scripts. This
205 is a major change that allows psad to be more flexible and completely derive
206 its config from the psad.conf file and from the command line. In the
207 previous scheme, psad imported its config with a function within Psad.pm,
208 and this required that psad imported the Psad perl module before reading its
209 config. A consequence is that the PSAD_LIBS_DIR var could not be specified
210 usefully within the config file.
212 * Sat Dec 23 2006 Michael Rash <mbr@cipherdyne.org>
215 * Mon Dec 12 2006 Michael Rash <mbr@cipherdyne.org>
218 * Sun Dec 10 2006 Michael Rash <mbr@cipherdyne.org>
220 - Added ip_options file for the Snort ipopts rule keyword.
221 - Added nf2csv so that normal users can get CSV output from
222 iptables log messages.
224 * Sun Oct 15 2006 Michael Rash <mbr@cipherdyne.org>
225 - psad-1.4.8 release.
227 * Sun Sep 10 2006 Michael Rash <mbr@cipherdyne.org>
228 - psad-1.4.7 release.
230 * Sat Sep 02 2006 Michael Rash <mbr@cipherdyne.org>
231 - Added updates from Mate Wierdl to get psad RPM building on x86_64
234 * Tue Jun 13 2006 Michael Rash <mbr@cipherdyne.org>
235 - Added installation of snort_rule_dl file.
236 - psad-1.4.6 release.
238 * Fri Jan 13 2006 Michael Rash <mbr@cipherdyne.org>
239 - psad-1.4.5 release.
241 * Sun Nov 27 2005 Michael Rash <mbr@cipherdyne.org>
242 - psad-1.4.4 release.
244 * Tue Nov 22 2005 Michael Rash <mbr@cipherdyne.org>
245 - Removed smtpdaemon dependency since psad can be run without sending
246 email alerts by configuring /etc/psad/alert.conf appropriately.
248 * Tue Jul 12 2005 Michael Rash <mbr@cipherdyne.org>
249 - Updated to only update syslog.conf if it actually exists. psad
250 is now comptable with other syslog daemons, and also with ulogd.
252 * Thu Mar 10 2005 Michael Rash <mbr@cipherdyne.org>
253 - Updated to new IPTables-Parse and IPTables-ChainMgr modules.
254 - psad-1.4.1 release.
256 * Fri Nov 26 2004 Michael Rash <mbr@cipherdyne.org>
258 - psad-1.4.0 release.
260 * Sun Oct 17 2004 Michael Rash <mbr@cipherdyne.org>
261 - psad-1.3.4 release.
263 * Sat Sep 25 2004 Michael Rash <mbr@cipherdyne.org>
264 - Added Bit::Vector back since not having it causes dependency
265 problems with Date::Calc even though psad does not require any
266 Date::Calc functions that require Bit::Vector functions.
268 * Mon Sep 06 2004 Michael Rash <mbr@cipherdyne.org>
269 - Updated to psad-1.3.3.
270 - Fixed path to psad-init.redhat (Mate Wierdl)
272 * Thu Jun 24 2004 Michael Rash <mbr@cipherdyne.org>
273 - Updated to psad-1.3.2 (added fwcheck_psad.pl and fw_search.conf
276 * Mon Oct 14 2003 Michael Rash <mbr@cipherdyne.org>
277 - Removed ipchains text from description.
278 - Added test and config warning message for HOME_NET variable.
279 - Updated to version 1.3
281 * Mon Oct 14 2003 Michael Rash <mbr@cipherdyne.org>
282 - Removed diskmond since psad handles disk space thresholds
285 * Sat Oct 11 2003 Michael Rash <mbr@cipherdyne.org>
286 - Updated spec file to build properly on both Red Hat 7.2 and
289 * Tue Sep 23 2003 Lenny Cartier <lenny@mandrakesoft.com> 1.2.3-1mdk
290 - mandrakized specfile
292 * Fri Sep 12 2003 Michael Rash <mbr@cipherdyne.org>
293 - Added interface tracking for scans.
294 - Bugfix for not opening /etc/hosts.deny the right way in
296 - Bugfix for psadfifo path in syslog-ng config.
297 - Better format for summary stats section in email alerts.
298 - Bugfix for INIT_DIR path on non-RedHat systems.
299 - Bugfix for gzip path.
300 - Make Psad.pm installed last of all perl modules installed
302 - Added additional call to incr_syscall_ctr() in psadwatchd.c
304 * Mon Jul 28 2003 Michael Rash <mbr@cipherdyne.org>