Victor Julien [Fri, 19 Apr 2013 09:04:00 +0000 (11:04 +0200)]
file: make fileext, filename and filemagic use the same rule parsing function as others. This has as a side effect that we enforce doubly qouted values now.
Victor Julien [Sat, 6 Apr 2013 18:54:25 +0000 (20:54 +0200)]
stream: handle extra different SYN/ACK
Until now, when processing the TCP 3 way handshake (3whs), retransmissions
of SYN/ACKs are silently accepted, unless they are different somehow. If
the SEQ or ACK values are different they are considered wrong and events
are set. The stream events rules will match on this.
In some cases, this is wrong. If the client missed the SYN/ACK, the server
may send a different one with a different SEQ. This commit deals with this.
As it is impossible to predict which one the client will accept, each is
added to a list. Then on receiving the final ACK from the 3whs, the list
is checked and the state is updated according to the queued SYN/ACK.
Victor Julien [Tue, 16 Apr 2013 19:47:42 +0000 (21:47 +0200)]
flowvar: fix deadlock with http buffers
Bug #802
Flowvars are set from pcre, and lock the flow when being set. However
when HTTP buffers were inspected, flow was already locked: deadlock.
This patch introduces a post-match list in the detection engine thread
ctx, where store candidates are kept. Then a post-match function is used
to finalize the storing if the rule matches.
Solves the deadlock and brings the handling of flowvars more in line
with flowbits and flowints.
Anoop Saldanha [Wed, 27 Mar 2013 09:25:05 +0000 (14:55 +0530)]
Update the way we handle http_host keywords.
Previously we would have forced all users to use nocase with http_host
keywords(since the hostname buffer is lowercase).
We now error out on sigs that has nocase set with http_host set. Also if
the http_host pattern or http_host pcre has an uppercase character set, we
invalidate such sigs. Unittests also updated to reflect the above change.
Victor Julien [Wed, 10 Apr 2013 08:22:32 +0000 (10:22 +0200)]
detection engine: consolidate thread setup
DetectEngineThreadCtxInit and DetectEngineThreadCtxInitForLiveRuleSwap did
pretty much the same thing, except for a counters registration. As can be
predicted with code duplication like this, things got out of sync. To make
sure this doesn't happen again, I created a helper function that does the
heavy lifting in this function.
Eric Leblond [Mon, 8 Apr 2013 17:16:31 +0000 (19:16 +0200)]
coccinelle: add tcp flag check
The different TCP related structures have all a flags field and its
value must match the type of structure. This patch adds a check
alerting on invalid value usage.
Victor Julien [Sat, 6 Apr 2013 15:26:33 +0000 (17:26 +0200)]
stream: zero ts is a per stream flag
Ssn flag STREAMTCP_FLAG_ZERO_TIMESTAMP was used in stream only. Due to
it's value it did not conflict with a real stream flag. Renamed it to
STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP.
Victor Julien [Sat, 6 Apr 2013 15:17:15 +0000 (17:17 +0200)]
stream: don't use ssn timestamp flag in stream
The STREAMTCP_FLAG_TIMESTAMP flag is a ssn flag, however it was used in
the stream flag field. As it has the same value as
STREAMTCP_STREAM_FLAG_DEPTH_REACHED it's possible that stream reassembly
got confused by the timestamp.
Anoop Saldanha [Wed, 27 Mar 2013 12:27:55 +0000 (17:57 +0530)]
Handle the case of pcre combined with a relative content, where pcre has the
set to match from start of line and we discontinue matching on not finding
match.
Eric Leblond [Tue, 26 Mar 2013 17:24:46 +0000 (18:24 +0100)]
Don't try to sniff 'default' interface
Whan running suricata via 'suricata --af-packet', the list of interfaces
was containing the 'default' interface and sniffing it was attempted.
This was not wanted.
Victor Julien [Wed, 20 Mar 2013 16:18:38 +0000 (17:18 +0100)]
After some discussion we decided that var declarations inside a for statement are not in line with our coding style. So removing a bunch. Decision was not unanimous ^^.
Anoop Saldanha [Wed, 20 Mar 2013 12:47:42 +0000 (18:17 +0530)]
Minor fixes against the last set of patches for #564, 565, 581 + fp automation.
Rename struct DetectFigureFPAndId_t_ to DetectFPAndItsId_ and move it's
definition from inside the function where it's used to the global namespace,
as requested on #suricata.
Rename DetectEngineContentModifiedBufferSetup to DetectEngineContentModifierBufferSetup.
Also rename DetectFigureFPAndId() to DetectSetFastPatternAndItsId().
Updated DetectSetFastPatternAndItsId() to not exit on failure and return error.
Anoop Saldanha [Fri, 1 Mar 2013 11:12:08 +0000 (16:42 +0530)]
Update content id assignment.
All fp id assignment now happens in one go.
Also noticing a slight perf increase, probably emanating from improved cache
perf.
Removed irrelevant unittests as well.
Eric Leblond [Thu, 28 Feb 2013 15:52:43 +0000 (16:52 +0100)]
pcap-file: treat the case of unsupported pcap link
In unix socket mode, Suricata was stopping processing pcap files
when a pcap file with an unsupported datalink was treated. This
patch updates error handling to allow Suricata to treat other
pcap files.
Eric Leblond [Tue, 22 Jan 2013 09:47:29 +0000 (10:47 +0100)]
suricatasc: update python packaging
'make install' install now suricatasc script and Python module to
the system. The suricatasc client module can now be used in other
Python projects by using 'import suricatasc'.
A transformation was needed for distribution of a module and a script.
Module in src directory is now containing most of the code and the
script only handle argument parsing and the creation of a unix socket
client through 'suricatasc' module.
Eric Leblond [Thu, 6 Dec 2012 10:21:57 +0000 (11:21 +0100)]
suricatasc: refactor as a class
The goal of this commit is to be able to use suricatasc has a library
and and program. This is done by putting all active code in class and
adding a Python magic to detect when file is used as a program.
Eric Leblond [Fri, 30 Nov 2012 19:47:47 +0000 (20:47 +0100)]
suricatasc: real cmd line parsing and verbose mode
This patch adds commandline parsing and help to suricatasc. It also
adds a verbose mode (-v) where the send and received JSON object are
shown. This should ease development of unix socket client.
Eric Leblond [Fri, 30 Nov 2012 19:11:44 +0000 (20:11 +0100)]
unix socket: add 'conf-get' command
This patch adds a 'conf-get' command which get the configuration
value from suricata. Argument of the command is the name of the
variable to fetch.
The command syntax is the following:
{
"command": "conf-get",
"arguments": { "variable":value}
}
Eric Leblond [Fri, 30 Nov 2012 17:13:11 +0000 (18:13 +0100)]
suricatasc: factorize code and use dynamic commands
This patch factorize the recv code and uses the new 'command-list'
to get the list of existing commands from suricata. This allows
suricatasc to be able to call any new command if this command does
not require an argument.
Eric Leblond [Fri, 22 Feb 2013 14:54:09 +0000 (15:54 +0100)]
Fix build with old pcap library.
Pcap snaplen related modification broke compilation of Suricata for
system having old pcap library. This patch fixes the issue and allow
old pcap library to honour the snaplen value.
Eric Leblond [Mon, 18 Feb 2013 10:00:20 +0000 (11:00 +0100)]
Workaround function missing in libhtp include
As reported in bug #688, htp_config_set_path_decode_u_encoding
function is not included in libhtp header before 0.3.0. Result
is that suricata compilation fail with an external htp library.
The following patch detect the issue and adds the missing
declaration.