Commit Graph

4919 Commits (fdb1bd96680c1921aaed93d54f198a4e71435e7f)
 

Author SHA1 Message Date
Victor Julien fdb1bd9668 pfring: call enable_ring after set_cluster
Move pfring_enable_ring to the start of ReceivePfringLoop() so that
it's guaranteed to be called after all threads have called
pfring_set_cluster first.

This is necessary because pfring will already make packets available
to thread N, while thread N+1 is still registering itself. This leads
to cases where the first packet(s) of a flow are processed by a
different thread in Suricata than the later ones.

This is a race condition only at start up. New flows after the pfring
initialization is complete will not be influenced by this.

Bug #1129.
11 years ago
Victor Julien 845cbcce90 Update ChangeLog for 2.0rc2 release 11 years ago
Victor Julien 4436526a05 yaml: comment out example config
Comment out htp settings that should only serve as an example.
11 years ago
Victor Julien 3fa4712ab6 yaml: increase default memcaps
Increase default flow and stream reassembly memcaps.
11 years ago
Victor Julien 60a79c8220 eve-log: enable in default config
In the default config, eve-log is now enabled by default. All loggers
except 'drop' are enabled.
11 years ago
Victor Julien a3020b5306 eve-log: output cleanup
Suppress debug messages and print in a nicer way which modules are
being enabled.
11 years ago
Victor Julien ed877c64d1 Bug 611: fix for iponly
Fix Bug 611 for ip-only rules as well. If 'alert ip' rule has ports,
don't match on protocols that don't have ports. Like ICMP.

Bug #611.
11 years ago
Eric Leblond 6c3c234ca5 output-json: update timestamp format
This patch updates the timestamp format used in eve loggin.
It uses a ISO 8601 comptatible string. This allow tools parsing
the output to easily detect adn/or use the timestamp.

In the EVE JSON output, the value of the timestamp key has been
changed to 'timestamp' (instead of 'time'). This allows tools
like Splunk to detect the timestamp and use it without configuration.

Logstash configuration is simple:

input {
   file {
      path => [ "/usr/local/var/log/suricata/eve.json" ]
      codec =>   json
      type => "suricata-log"
   }
}

filter {
   if [type] == "suricata-log" {
      date {
        match => [ "timestamp", "ISO8601" ]
      }
   }
}

In splunk, auto detection of the fle format is failling and it seems
you need to define a type to parse JSON in
$SPLUNK_DIR/etc/system/local/props.conf:

[suricata]
KV_MODE = json
NO_BINARY_CHECK = 1
TRUNCATE = 0

Then you can simply declare the log file in
$SPLUNK_DIR/etc/system/local/inputs.conf:

[monitor:///usr/local/var/log/suricata/eve.json]
sourcetype = suricata

In both cases the timestamp are correctly imported by
the tools.
11 years ago
Eric Leblond 1fa4233d67 pfring: get vlan id from header
PF_RING is delivering the packet with VLAN header stripped. This
patch updates the code to get the information from PF_RING extended
header information.

This patch uses the new function SCKernelVersionIsAtLeast to know
that we've got a old kernel that do not strip the VLAN header from
the message before sending it to userspace.
11 years ago
Victor Julien 0f70e8f225 OpenBSD: set correct magic path
For all 5.x OpenBSDs it seems the magic path is:
    /usr/local/share/misc/magic.mgc
11 years ago
Eric Leblond cf30adcedc ipfw: fix build
Buildbot reported:
 runmode-ipfw.c: In function 'RunModeIpsIPFWAuto':
 runmode-ipfw.c:85: error: implicit declaration of function 'LiveDeviceHasNoStats'
11 years ago
Eric Leblond 606e19124b http: add info message about memcap
Display a message about http memcap when it is set in config file.
11 years ago
Victor Julien f00703acc1 Fix False Positive of rules with ports on portless protocols
In case of 'alert ip' rules that have ports, the port checks would
be bypassed for non-port protocols, such as ICMP. This would lead to
a rule matching: a false positive.

This patch adds a check. If the rule has a port setting other than
'any' and the protocol is not TCP, UDP or SCTP, then we rule won't
match.

Rules with 'alert ip' and ports are rare, so the impact should be
minimal.

Bug #611.
11 years ago
Victor Julien 00d2f2d627 Fix BytesToString indexing array using wrong index
This would lead to reading past the end of the buffer and also writing
past the end of the newly allocated buffer.

Bug #1121
11 years ago
Victor Julien 88e9c85e36 json output: fix vlan byte order in output
VLAN functions/macros return vlan id in host byte order, so no need
to convert them in output functions.
11 years ago
Victor Julien 872bb5664e Fix null dereference in eve-log
Eve-log would call GET_VLAN_ID on the packets vlan header if p->vlan_idx
was bigger than 0. GET_VLAN_ID would then unconditionally dereference
p->vlanh[0] or [1]. However, there are a number of cases in which these
pointers are not set. Defrag pseudo packets, AF_PACKET and in the future
PF_RING, do set the id's, but not the header pointers.

This patch adds 2 new macro's which are wrappers around a function:

VLAN_GET_ID1 and VLAN_GET_ID2 get the id's by calling DecodeVLANGetId.

This function will return the correct id.

Bug #1120.
11 years ago
Victor Julien 684d787567 Coverity fix
Coverity 992695, fix potential array index with negative int. Very unlikely
case at rule keyword parsing stage.
11 years ago
Victor Julien ddf9b417d7 configure: simplify OpenBSD handling
Treat all OpenBSD versions in the same way. No more -fgnu89-inline.
11 years ago
Victor Julien 1e21b9f5a9 Disable emerging-icmp in default config
The file has no active rules by default.
11 years ago
Victor Julien a746095569 make install-full: get correct version of ET
Version 2.0.
11 years ago
Victor Julien f6bb867df8 ssh: fix scan-build warnings
app-layer-ssh.c:165:5: warning: Value stored to 'input_len' is never read
    input_len -= 1;
    ^            ~
1 warning generated.

app-layer-ssh.c:160:5: warning: Value stored to 'input_len' is never read
    input_len -= 4;
    ^            ~
1 warning generated.
11 years ago
Victor Julien 0967f0777c ssh: improve banner checking
Don't use input_len as banner length. Instead, look for banner end
to calculate banner length.

Add test for banner buffering corner case.
11 years ago
Victor Julien 669b351dad ssh: fixes for minor scan-build warnings
/usr/share/clang/scan-build/ccc-analyzer -DHAVE_CONFIG_H -I. -I..   -I./../libhtp/  -I/usr/include/nspr   -I/usr/include/nss -I/usr/include/nspr   -DLOCAL_STATE_DIR=\"/usr/local/var\" -g -O2 -Wall -Wno-unused-parameter -std=gnu99 -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DHAVE_LIBNET_ICMPV6_UNREACH  -I/usr/include -DLIBPCAP_VERSION_MAJOR=1 -DHAVE_PCAP_SET_BUFF -DHAVE_LIBCAP_NG -DREVISION="51e0dee" -MT app-layer-ssh.o -MD -MP -MF .deps/app-layer-ssh.Tpo -c -o app-layer-ssh.o app-layer-ssh.c
app-layer-ssh.c:164:5: warning: Value stored to 'input' is never read
    input += 1;
    ^        ~
app-layer-ssh.c:165:5: warning: Value stored to 'input_len' is never read
    input_len -= 1;
    ^            ~
app-layer-ssh.c:212:13: warning: Value stored to 'ret' is never read
            ret = 0;
            ^     ~
3 warnings generated.
11 years ago
Victor Julien b877cf6158 ssh: add json logger
Sub module of eve-log, but can also run separately as ssh-json-log. Only
one at a time though.
11 years ago
Victor Julien 65b228ccfd ssh: improve large and fragmented banner handling
Including tests.
11 years ago
Victor Julien b4aeb43af1 ssh: disable inspection in encrypted phase
When both sides of the session have completed the encryption setup,
flag the stream to disable detection.
11 years ago
Victor Julien 294ff49f6d ssh: allow for space characters in the software version
Previously the software version would only contain up to the first
space.

E.g. in SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu3

It would contain "OpenSSH_4.7p1".

This patch changes the behavior to:

"OpenSSH_4.7p1 Debian-8ubuntu3"
11 years ago
Victor Julien b792234dd0 ssh: clean up flags 11 years ago
Victor Julien b5afe2b51f ssh: reenable ssh.protoversion keyword 11 years ago
Victor Julien 6c0162bf26 ssh: reenable ssh.softwareversion keyword 11 years ago
Victor Julien 884cecd9af ssh: handle fragmented banner
Cleanups.
11 years ago
Victor Julien 32fcdfe6eb ssh: server support, cleanups 11 years ago
Victor Julien 3648adb533 ssh: record parser 11 years ago
Victor Julien a3c9832b90 ssh: reenable parser as stub
Reenable the SSH parser. It now compiles, however the actual parsing
code is still disabled (commented out).
11 years ago
Eric Leblond e00b5ca191 classification: add category to some stream rules
All stream events signatures deserve a category.
11 years ago
Eric Leblond 79de8c8f4b runmode: remove unused variable.
default_mode_auto is not used anymore and can be removed.
11 years ago
Eric Leblond a6bb86a9e0 Exit if BPF filter file is specified in IPS mode
This patch adds a check that was missing when specifying BPF filter
from a file. Suricata behavior should have been the same as when
BPF filter is specified on command line.
11 years ago
Eric Leblond 941cfe1641 ipfw: fix operator error in test
Fix warning spotted by clang on FreeBSD:

source-ipfw.c:241:49: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
        if (suricata_ctl_flags & (SURICATA_STOP || SURICATA_KILL)) {
                                                ^  ~~~~~~~~~~~~~
source-ipfw.c:241:49: note: use '|' for a bitwise operation
        if (suricata_ctl_flags & (SURICATA_STOP || SURICATA_KILL)) {
                                                ^~
                                                |

Use same logic as the one used in other capture mode.
11 years ago
Eric Leblond 9f6527dc16 ipfw: improve exit message
This patch synchronizes the exit message with what is done in
NFQ capture mode.
11 years ago
Eric Leblond 1c48a81f91 ipfw: update running modes to hide device stats
This patch adds call to the function used to disable the display
of live device stats at exit.
11 years ago
Eric Leblond d8a305356e nfq: update message displayed at exit
This patch updates the message displayed at exit to have something
more readable.
11 years ago
Eric Leblond 00c8408c55 nfq: update running modes to hide device stats
This patch adds call to the function used to disable the display
of live device stats at exit.
11 years ago
Eric Leblond 6b2ca63d9d util-device: add function to avoid stat display
In the case of running mode like NFQ there is no need possibility
to compute the statistics as it is done in LiveDevice (drop and
checksum count are meaningless).

This patch adds a function that allow running mode to disable the
display of the counters at exit.
11 years ago
Eric Leblond a12c46c700 util-device: fix debug message
Reference to Pcap was not correct.
11 years ago
Ken Steele 970f22c752 Move memcpy_lower() into new util-memcpy.h
Remove local copies from each MPM file and use include file instead.
Might be better to also add util-memcpy.c rather than inlining it each time,
to get smaller code, since only seems to be used at initialization.
11 years ago
Ken Steele cd1c18d981 Store case-insensitive patterns as lowercase.
This is required because SCMemcmpLowercase() expects it first argument
to be already lowercase for the comparison. This is done by using
memcpy_tolower() for NO_CASE patterns.

This addresses code review comments from Victor.
11 years ago
Ken Steele 6b1517c0b8 Remove case_state usage
The case_state in MPMs was just to track when a pid could have no-case and
case-sensitive matches for the same PID. Now that can't happen after fixing
bug 1110, so remove the code and storage for case_state.
11 years ago
Ken Steele c41041a9c7 When assigning Pattern IDs pids, check Case flags
This fixes bug 1110. When assigning PIDs, use the NO_CASE flag when comparing
for duplicates. The state of the flag must be the same, but also use the same
type of comparisons when checking for duplicates.

Previously, "foo":CS would match with "foo":CI when it should not.
and "foo":CI would not match "FoO":CI when it should. Both of those
cases are fixed with this change.

This then allows simplifying the use of pid in MPMs because now if they
pids match, then so do the flags, so checking the flags is not required.
11 years ago
Ken Steele b7baa561c0 Cleanup in ac-tile MPM
Remove return from void functions.
Add some commments
Remove inline on functions where it doesn't make sense.
Rewrote if statement to be more clear.
11 years ago
Victor Julien df927f7ea8 unittest: fix mutex unlock w/o a lock
Fixes an error in a test. SCMutexUnlock was called w/o a prior
SCMutexLock.
11 years ago