]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
9 years agoapp-layer-smtp: extract and store HELO and MAIL FROM
Eric Leblond [Fri, 17 Apr 2015 08:46:15 +0000 (10:46 +0200)] 
app-layer-smtp: extract and store HELO and MAIL FROM

This patch updates the SMTP transaction and SMTP state to be able
to contain the HELO and MAIL FROM fields.

9 years agoemail-json: move email fields to email section
Eric Leblond [Fri, 17 Apr 2015 14:13:23 +0000 (16:13 +0200)] 
email-json: move email fields to email section

This patch changes the way smtp message are written. It is using
the "email" key to store the email related fields. This will
allow to do the same search through SMTP and IMAP if we implement
this last one.

9 years agothreshold: remove debug message from info loglevel
Victor Julien [Tue, 29 Sep 2015 20:07:57 +0000 (22:07 +0200)] 
threshold: remove debug message from info loglevel

9 years agoflow: add missing storage size to checks, output 1652/head
Victor Julien [Mon, 21 Sep 2015 06:34:19 +0000 (08:34 +0200)] 
flow: add missing storage size to checks, output

9 years agohost: update host size logic
Victor Julien [Sun, 20 Sep 2015 20:54:32 +0000 (22:54 +0200)] 
host: update host size logic

Instead of using (sizeof(Host)+HostStorageSize()) in many places,
create a simple size variable that is set during setup.

9 years agoippair: update ippair size logic
Victor Julien [Sun, 20 Sep 2015 20:39:17 +0000 (22:39 +0200)] 
ippair: update ippair size logic

Instead of using (sizeof(IPPair)+IPPairStorageSize()) in many places,
create a simple size variable that is set during setup.

9 years agostream: improve retransmission detection
Victor Julien [Mon, 21 Sep 2015 13:01:56 +0000 (15:01 +0200)] 
stream: improve retransmission detection

Consider packets starting before last_ack and ending after it also
to be retransmissions. This way we can see if they are having
different data.

9 years agompm: SGH maxlen was actually minlen, so rename
Victor Julien [Sat, 19 Sep 2015 19:56:29 +0000 (21:56 +0200)] 
mpm: SGH maxlen was actually minlen, so rename

9 years agompm: improve SGH content len tracking
Victor Julien [Sat, 19 Sep 2015 19:46:34 +0000 (21:46 +0200)] 
mpm: improve SGH content len tracking

SGH's track content length for rule grouping.

This patch changes the logic to only consider the pattern that is
used in the mpm for a sig.

9 years agompm: redo uri maxlen logic
Victor Julien [Sat, 19 Sep 2015 18:53:26 +0000 (20:53 +0200)] 
mpm: redo uri maxlen logic

The mpm_uricontent_maxlen logic was meant to track the shortest
possible pattern in the MPM of a SGH. So a minlen more than a maxlen.

This patch replaces the complicated tracking logic by a simpler
scheme. When the SGH's are finalize, the minlen is calculated.

It also fixes a small corner case where the calculated "maxlen" could
be wrong. This would require a smaller pattern in a rule to be forced
as fast pattern.

9 years agodetect: improve comments on mpm
Victor Julien [Sat, 19 Sep 2015 17:33:14 +0000 (19:33 +0200)] 
detect: improve comments on mpm

9 years agompm: remove used counter
Victor Julien [Sat, 19 Sep 2015 17:28:52 +0000 (19:28 +0200)] 
mpm: remove used counter

9 years agompm: remove bloated counting logic
Victor Julien [Sat, 19 Sep 2015 16:56:43 +0000 (18:56 +0200)] 
mpm: remove bloated counting logic

Counters were only used to print debug info.

9 years agompm: improve debug output
Victor Julien [Sat, 19 Sep 2015 16:41:51 +0000 (18:41 +0200)] 
mpm: improve debug output

9 years agompm: use IPPROTO_TCP for readability
Victor Julien [Sat, 19 Sep 2015 16:41:36 +0000 (18:41 +0200)] 
mpm: use IPPROTO_TCP for readability

9 years agompm: optimize & debug validate
Victor Julien [Sat, 19 Sep 2015 11:58:03 +0000 (13:58 +0200)] 
mpm: optimize & debug validate

Wrappers are called only if a mpm_ctx is available. So remove the test
for a null ctx and replace it by a debug validation BUG_ON.

9 years agompm: assume we'll likely have a mpm_ctx
Victor Julien [Sat, 19 Sep 2015 11:57:57 +0000 (13:57 +0200)] 
mpm: assume we'll likely have a mpm_ctx

9 years agompm: indent fix, no functional change
Victor Julien [Sat, 19 Sep 2015 11:24:47 +0000 (13:24 +0200)] 
mpm: indent fix, no functional change

9 years agompm: change direction checking in mpm wrappers
Victor Julien [Sat, 19 Sep 2015 11:13:55 +0000 (13:13 +0200)] 
mpm: change direction checking in mpm wrappers

Instead of having reachable assertions, use DEBUG_VALIDATE_BUG_ON

9 years agodebug validation: introduce DEBUG_VALIDATE_BUG_ON
Victor Julien [Sat, 19 Sep 2015 11:11:56 +0000 (13:11 +0200)] 
debug validation: introduce DEBUG_VALIDATE_BUG_ON

DEBUG_VALIDATE_BUG_ON(exp) will call BUG_ON(exp) if debug validation
is compiled in. Otherwise it's a no-op.

9 years agompm: minor fixes and cleanups
Victor Julien [Sat, 19 Sep 2015 11:11:35 +0000 (13:11 +0200)] 
mpm: minor fixes and cleanups

9 years agostream: improve handling of GAPs at stream start
Victor Julien [Mon, 31 Aug 2015 17:00:35 +0000 (19:00 +0200)] 
stream: improve handling of GAPs at stream start

Detect and handle gaps at the start of the stream, when there may
be no segments in the list (yet).

9 years agostream: RST last_ack update fix
Victor Julien [Thu, 27 Aug 2015 21:49:15 +0000 (23:49 +0200)] 
stream: RST last_ack update fix

Only use ACK if ACK flag was set and ACK value is valid.

9 years agoproto detect: more bypass conditions
Victor Julien [Thu, 27 Aug 2015 20:58:32 +0000 (22:58 +0200)] 
proto detect: more bypass conditions

More exceptional cases for protocol detection. In very unbalanced flows,
where just a few bytes are sent toserver and many toclient, proto detect
might not complete in time on the toserver direction. This can lead to
queuing up many segments in the toclient direction.

Another case is that in come cases the stream is flagged as proto detect
done, but the flows proto detect flags are not set. This is now handled
by the ProtoDetectDone() check.

9 years agodebug validation: add segment list sanity check
Victor Julien [Wed, 26 Aug 2015 14:52:09 +0000 (16:52 +0200)] 
debug validation: add segment list sanity check

9 years agodetect: fix issue with smsg and seq wraps
Victor Julien [Thu, 27 Aug 2015 16:57:48 +0000 (18:57 +0200)] 
detect: fix issue with smsg and seq wraps

Due to a broken sequence number check, detect could fail to process
smsgs in case of a sequence wrap. This could lead to excessive use
of smsg's but also of segments, since these aren't cleared until the
smsg containing them is.

9 years agostream: allow next_seq catch up after pkt loss
Victor Julien [Tue, 1 Sep 2015 20:46:14 +0000 (22:46 +0200)] 
stream: allow next_seq catch up after pkt loss

If next_seq falls behind last_ack, force update it.

9 years agostream: use reassembly fast path after proto detect
Victor Julien [Mon, 31 Aug 2015 16:50:06 +0000 (18:50 +0200)] 
stream: use reassembly fast path after proto detect

Use the reassembly fast paths only after protocol detection has completed.
In some corner cases the sending of smaller segments lead to protocol
detection failing.

9 years agostream: fix protocol detection issue for GAPs
Victor Julien [Wed, 26 Aug 2015 14:15:07 +0000 (16:15 +0200)] 
stream: fix protocol detection issue for GAPs

If the protocol required TOSERVER data first, but the SSN started with
a GAP, then the TOCLIENT side would get stuck in an expensive path:

1. it would run detection on TOCLIENT
2. it would try to force reassembly for TOSERVER
3. it would reset the detected protocol as TOSERVER failed
4. it would not evict any segment

This had 2 consequences:
1. on long running sessions this could lead to using lots of memory
   on segments, denying other sessions resources
2. wasted cycles on protocol detection and segment list management

This patch introduces a fix. It checks in the (2) stage above, whether
the opposing stream (that we depend on) it is a NOREASSEMBLY state. If
so, it gives up on this side of the session as well.

9 years agostream: optimize proto detect segment handling
Victor Julien [Wed, 26 Aug 2015 12:25:16 +0000 (14:25 +0200)] 
stream: optimize proto detect segment handling

In case of protocol detection not yet being complete, the segment
list was walked unconditionally to unset the app layer processed
flag. Optimize this to bail on the first segment that doesn't have
the flag set.

9 years agoapp-layer setup scripts: fix header substitution.
Jason Ish [Wed, 16 Sep 2015 17:23:34 +0000 (11:23 -0600)] 
app-layer setup scripts: fix header substitution.

Fixes make distcheck.

9 years agohost-storage: document host storage API
Eric Leblond [Sun, 13 Sep 2015 21:34:16 +0000 (23:34 +0200)] 
host-storage: document host storage API

9 years agoconfigure: use pkg_config for libhtp 1638/head
Eric Leblond [Mon, 14 Sep 2015 08:55:04 +0000 (10:55 +0200)] 
configure: use pkg_config for libhtp

It was not possible to simply specify PKG_CONFIG_PATH to build
with an non bundled libhtp. With this patch we don't need anymore
the htp lib and include configure options.

9 years agoapp-layer: scripts to setup app-layer templates 1634/head
Jason Ish [Tue, 1 Sep 2015 21:20:13 +0000 (15:20 -0600)] 
app-layer: scripts to setup app-layer templates

setup-app-layer.sh sets up an application layer detector and
parser template.

setup-app-layer-logger.sh sets up a JSON application layer
transaction logger for an application parser that has
already been provisioned.

setup-app-layer-detect.sh sets up a keyword for performing
content inspections on buffers created by the application
layer.

9 years agoapp-layer: template for application layer content inspection
Jason Ish [Tue, 1 Sep 2015 18:36:00 +0000 (12:36 -0600)] 
app-layer: template for application layer content inspection

9 years agoapp-layer: template for application layer tx logger
Jason Ish [Tue, 1 Sep 2015 18:12:28 +0000 (12:12 -0600)] 
app-layer: template for application layer tx logger

9 years agoapp-layer: template for application layer parser
Jason Ish [Tue, 1 Sep 2015 18:04:34 +0000 (12:04 -0600)] 
app-layer: template for application layer parser

9 years agodocker: add ASAN to pcaps build 1631/head
Eric Leblond [Wed, 9 Sep 2015 20:40:37 +0000 (22:40 +0200)] 
docker: add ASAN to pcaps build

9 years agodevelopment tools: add script to setup detect module 1625/head
Victor Julien [Fri, 28 Aug 2015 13:03:07 +0000 (15:03 +0200)] 
development tools: add script to setup detect module

Simplify creation of a new detect module by creating a copy of the
detect template. It sets the name and registers it in the build
system. Finally it's registration function is called.

9 years agodetect plugin: add template
Victor Julien [Fri, 30 Nov 2012 15:57:53 +0000 (16:57 +0100)] 
detect plugin: add template

9 years agodevelopment tools: add script to setup new decoder
Victor Julien [Thu, 27 Aug 2015 15:37:52 +0000 (17:37 +0200)] 
development tools: add script to setup new decoder

Simplify creation of a new decoder.

9 years agodecoder: add template/example
Victor Julien [Tue, 25 Aug 2015 16:08:55 +0000 (18:08 +0200)] 
decoder: add template/example

Add fictional example / template for a packet decoder. It's not invoked
anywhere.

9 years agolua: TLS support
Victor Julien [Thu, 9 Jul 2015 19:45:15 +0000 (21:45 +0200)] 
lua: TLS support

Support TLS in Lua detection scripts.

function init (args)
    local needs = {}
    needs["tls"] = tostring(true)
    return needs
end

function match(args)
    version, subject, issuer, fingerprint = TlsGetCertInfo();
    if version == nil then
        return 0
    end
    str = string.format("Version %s\nIssuer %s\nSubject %s\nFingerprint %s",
                        version, issuer, subject, fingerprint)
    SCLogInfo(str);
    return 1
end

9 years agodetect-lua: set direction
Victor Julien [Thu, 9 Jul 2015 19:44:38 +0000 (21:44 +0200)] 
detect-lua: set direction

9 years agolua: add direction support
Victor Julien [Thu, 9 Jul 2015 19:42:38 +0000 (21:42 +0200)] 
lua: add direction support

9 years agoDNS: refactor tx completion logic 1623/head
Victor Julien [Wed, 2 Sep 2015 11:07:59 +0000 (13:07 +0200)] 
DNS: refactor tx completion logic

Use simple bool values to track the transaction state in both directions.

A tx is only created in two cases:
1. full request parsed
2. response parsed (request missing)

This is true even for multi-packet TCP requests.

This leads to the following tx completion logic for the request side:
the presence of a tx implies the request is complete

On the response side, we consider the tx complete when we have seen
the response. If the DNS parser thinks the response was lost, we also
flag the response side as complete.

9 years agoyaml: add missing ippair section 1619/head
Victor Julien [Mon, 31 Aug 2015 16:05:17 +0000 (18:05 +0200)] 
yaml: add missing ippair section

9 years agoaf-packet: don't activate rollover by default
Eric Leblond [Sat, 29 Aug 2015 08:49:26 +0000 (10:49 +0200)] 
af-packet: don't activate rollover by default

Rollover option is causing issue with TCP streaming code because
packets from the same flow to be treated out of order. As long as
the situation is not fixed in the streaming engine, it is a bad idea
to enable it by default.

9 years agoFix minor format string issues
Victor Julien [Fri, 21 Aug 2015 07:48:42 +0000 (09:48 +0200)] 
Fix minor format string issues

9 years agoautotools: cleanup
Victor Julien [Thu, 20 Aug 2015 11:37:09 +0000 (13:37 +0200)] 
autotools: cleanup

Remove most of the CFLAGS updates from configure. Flags are now (mostly)
set in AM_CLFLAGS.

Update all -DBLAH additions to CFLAGS to use AC_DEFINE([BLAH], ...)

Improve Lua vs LuaJIT checking.

Improve the configure output a bit.

Lots of smaller cleanups.

9 years agosource-pfring: don't set cluster mode when using ZC and VLAN tracking is disabled 1613/head
Antti Tönkyrä [Sat, 15 Aug 2015 20:58:56 +0000 (20:58 +0000)] 
source-pfring: don't set cluster mode when using ZC and VLAN tracking is disabled

9 years agonetmap: enable zero-copy mode only when copy-mode is specified.
gureedo [Tue, 28 Jul 2015 04:40:13 +0000 (09:40 +0500)] 
netmap: enable zero-copy mode only when copy-mode is specified.
Perform zero-copy checks only when copy-mode is specified.

9 years agonetmap: extended comments for options in configuration file.
gureedo [Tue, 28 Jul 2015 04:35:53 +0000 (09:35 +0500)] 
netmap: extended comments for options in configuration file.
Added extended description of the use of OS endpoint with copy mode.

9 years agotransaction inspection: fix limit enforcement
Victor Julien [Thu, 20 Aug 2015 17:31:23 +0000 (19:31 +0200)] 
transaction inspection: fix limit enforcement

Make sure we're never wrapping around the size value.

10 years agoAllow colon in SSH version, at least some trojaned PuTTY clients have version like... 1608/head
Antti Tönkyrä [Tue, 19 May 2015 20:07:21 +0000 (20:07 +0000)] 
Allow colon in SSH version, at least some trojaned PuTTY clients have version like Putty-Local: Timestamp HH:MM:SS

10 years agoxff: support ports and more ipv6 notations
Victor Julien [Tue, 21 Jul 2015 15:27:26 +0000 (17:27 +0200)] 
xff: support ports and more ipv6 notations

It's not uncommon to see an header like:
X-Forwarded-For: 1.2.3.4:56789

This patch recognizes this case and ignores the port. It also supports
this for IPv6 if the address has the following notation:
X-Forwarded-For: [12::34]:1234

This patch also adds unittests.

10 years agodetect loader: move to own file
Victor Julien [Mon, 20 Jul 2015 17:55:38 +0000 (19:55 +0200)] 
detect loader: move to own file

10 years agodetect-loaders: configurable amount of loaders
Victor Julien [Mon, 20 Jul 2015 16:08:37 +0000 (18:08 +0200)] 
detect-loaders: configurable amount of loaders

10 years agodebug: packet pool init/destroy validation
Victor Julien [Wed, 22 Apr 2015 10:41:57 +0000 (12:41 +0200)] 
debug: packet pool init/destroy validation

Validate packet pool handling:
- pools are initialized before use
- pools are not used after destroy
- pools are not double initialized/destroyed

10 years agounittests: use a global packetpool
Victor Julien [Wed, 8 Jul 2015 13:57:26 +0000 (15:57 +0200)] 
unittests: use a global packetpool

10 years agomulti-detect: improve memory handling of setup code
Victor Julien [Tue, 19 May 2015 13:14:49 +0000 (15:14 +0200)] 
multi-detect: improve memory handling of setup code

10 years agomulti-detect: detect loader for unix socket
Victor Julien [Wed, 13 May 2015 13:35:47 +0000 (15:35 +0200)] 
multi-detect: detect loader for unix socket

Move the tenant load and reload commands to be executed by the detect
loader thread(s).

Limitation: no yaml parsing in parallel. The Conf API is currently not
thread safe, so don't load the tenant config (yaml) in parallel.

10 years agodetect: create loader threads
Victor Julien [Tue, 12 May 2015 09:35:47 +0000 (11:35 +0200)] 
detect: create loader threads

To speed up startup with many tenants, tenant loading will be parallelized.
As no tempary threads should be used for these memory allocation heavy
tasks, this patch adds new type of 'command' thread that can be used to
load and reload tenants.

This patch hardcodes the number of loaders to 4. Future work will make it
dynamic.

The loader thread essentially sleeps constantly. When a tasks is sent to
it, it will wake up and execute it.

10 years agomulti-detect: set tenant id on pseudo packets
Victor Julien [Mon, 13 Apr 2015 08:33:11 +0000 (10:33 +0200)] 
multi-detect: set tenant id on pseudo packets

Store the tenant id in the flow and use the stored id when setting
up pesudo packets.

For tunnel and defrag packets, get tenant from parent. This will only
pass tenant_id's set at capture time.

For defrag packets, the tenant selector based on vlan id will still
work as the vlan id(s) are stored in the defrag tracker before being
passed on.

10 years agomulti-detect: hash lookup for tenants
Victor Julien [Thu, 9 Apr 2015 16:20:28 +0000 (18:20 +0200)] 
multi-detect: hash lookup for tenants

Use hash for storing and looking up det_ctxs.

10 years agodetect: clean up thread free code
Victor Julien [Fri, 10 Apr 2015 07:59:33 +0000 (09:59 +0200)] 
detect: clean up thread free code

Introduce DetectEngineThreadCtxFree that doesn't need a 'ThreadVars'
pointer.

10 years agomulti-detect: make threshold prefix aware
Victor Julien [Wed, 8 Apr 2015 13:59:46 +0000 (15:59 +0200)] 
multi-detect: make threshold prefix aware

Make threshold loading prefix aware, so it can be part of tenant
configuration.

If the setting is missing from the tenant, the global setting is tried
and if that too is missing, the global default is used.

Note: currently per host thresholds are tracked globally and NOT per
tenant.

10 years agomulti-detect: make reference prefix aware
Victor Julien [Wed, 8 Apr 2015 13:31:52 +0000 (15:31 +0200)] 
multi-detect: make reference prefix aware

Make reference loading prefix aware, so it can be part of tenant
configuration.

If the setting is missing from the tenant, the global setting is tried
and if that too is missing, the global default is used.

10 years agomulti-detect: make classification prefix aware
Victor Julien [Wed, 8 Apr 2015 12:55:16 +0000 (14:55 +0200)] 
multi-detect: make classification prefix aware

Make classification loading prefix aware, so it can be part of tenant
configuration.

If the setting is missing from the tenant, the global setting is tried
and if that too is missing, the global default is used.

10 years agomulti-detect: implement reload tenant in suricatasc
Victor Julien [Sat, 14 Mar 2015 19:27:30 +0000 (20:27 +0100)] 
multi-detect: implement reload tenant in suricatasc

10 years agomulti-detect: add reload-tenant command
Victor Julien [Sat, 14 Mar 2015 19:23:13 +0000 (20:23 +0100)] 
multi-detect: add reload-tenant command

Allow for a tenant to be reloaded. The command is the same as the
register-tenant command, so with a yaml and tenant-id as argument.
However this replaces an existing tenant.

10 years agomulti-detect: add tenant id to alert json output
Victor Julien [Sun, 1 Mar 2015 09:34:53 +0000 (10:34 +0100)] 
multi-detect: add tenant id to alert json output

Add a integer field "tenant_id" to the JSON alert output.

10 years agomulti-detect: store tenant id in packet
Victor Julien [Sun, 1 Mar 2015 09:09:21 +0000 (10:09 +0100)] 
multi-detect: store tenant id in packet

Store tenant id in the packet so that the output API's can log it.

10 years agomulti-detect: refuse to add duplicate tenant
Victor Julien [Fri, 20 Feb 2015 09:40:32 +0000 (10:40 +0100)] 
multi-detect: refuse to add duplicate tenant

Generate error if tentant to be added is already loaded.

10 years agomulti-detect: cleanup, reuse tenant loading code
Victor Julien [Fri, 20 Feb 2015 08:33:53 +0000 (09:33 +0100)] 
multi-detect: cleanup, reuse tenant loading code

Reuse tenant loading from YAML code for Unix Socket.

10 years agomulti-detect: load tenants from yaml file
Victor Julien [Thu, 19 Feb 2015 17:45:10 +0000 (18:45 +0100)] 
multi-detect: load tenants from yaml file

Load tenants and mappings from the suricata.yaml when available.

10 years agosuricatasc: add unregister-tenant-handler
Victor Julien [Thu, 12 Feb 2015 14:30:20 +0000 (15:30 +0100)] 
suricatasc: add unregister-tenant-handler

10 years agosuricatasc: add register-tenant-handler command
Victor Julien [Fri, 6 Feb 2015 14:08:44 +0000 (15:08 +0100)] 
suricatasc: add register-tenant-handler command

Arguments:
- tenant id (int)
- name of handler (string)
- traffic id related to handler (int, optional)

Examples:
- register-tenant-handler 1 vlan 1111
- register-tenant-handler 8 pcap

10 years agomulti-detect: implement unregister-tenant-handler
Victor Julien [Thu, 12 Feb 2015 14:56:38 +0000 (15:56 +0100)] 
multi-detect: implement unregister-tenant-handler

Remove a tenant handler from the list and apply it.

10 years agodetect: don't error out on no de_ctx
Victor Julien [Thu, 12 Feb 2015 13:13:46 +0000 (14:13 +0100)] 
detect: don't error out on no de_ctx

This can happen on a multi-detect setup with no registered
engines yet.

10 years agomulti-detect: set selector from yaml
Victor Julien [Thu, 12 Feb 2015 11:39:27 +0000 (12:39 +0100)] 
multi-detect: set selector from yaml

Yaml setting is: multi-detect.selector

Implement 'vlan' and 'direct'.

10 years agomulti-detect: error on start if no selector registered
Victor Julien [Thu, 12 Feb 2015 11:08:33 +0000 (12:08 +0100)] 
multi-detect: error on start if no selector registered

Force user to select the method at startup.

10 years agomulti-detect: register counters on 'master' det_ctx
Victor Julien [Thu, 12 Feb 2015 13:14:35 +0000 (14:14 +0100)] 
multi-detect: register counters on 'master' det_ctx

Otherwise counters are only registered after the stats api is
already fixed.

10 years agomulti-detect: allow start up with 0 tenants
Victor Julien [Thu, 12 Feb 2015 10:04:35 +0000 (11:04 +0100)] 
multi-detect: allow start up with 0 tenants

10 years agounix-socket: implement register-tenant-handler
Victor Julien [Fri, 6 Feb 2015 15:01:09 +0000 (16:01 +0100)] 
unix-socket: implement register-tenant-handler

Register tenant handlers/selectors based on what the unix command
"register-tenant-handler" tells.

Check traffic id before adding it. No duplicated registrations for
a traffic id are allowed.

10 years agomulti-detect: initial selectors for tenants
Victor Julien [Thu, 5 Feb 2015 17:58:26 +0000 (18:58 +0100)] 
multi-detect: initial selectors for tenants

The Detection Thread has the TenantGetId pointer which allows it
to select a tenant id based on the packet.

10 years agodetect: select detect engine at Detect entry
Victor Julien [Fri, 30 Jan 2015 14:04:38 +0000 (15:04 +0100)] 
detect: select detect engine at Detect entry

Limited to Pcap only currently.

10 years agounix-socket: allow tenant id with pcap-file
Victor Julien [Fri, 30 Jan 2015 13:27:05 +0000 (14:27 +0100)] 
unix-socket: allow tenant id with pcap-file

Register the tenant id that the pcap-file optionally got.

10 years agopcap-file: set tenant-id if available
Victor Julien [Fri, 30 Jan 2015 12:20:12 +0000 (13:20 +0100)] 
pcap-file: set tenant-id if available

Set the id to each packet's 'pcap_v' structure.

10 years agosuricatasc: allow for tenant id in pcap-file
Victor Julien [Fri, 30 Jan 2015 12:03:13 +0000 (13:03 +0100)] 
suricatasc: allow for tenant id in pcap-file

Allow for an optional 'tenant id' argument to pcap-file. This will
allow us to force the pcap to be inspected by this tenant.

If ommited it's 0, which means it's disabled.

10 years agodetect: use multi tenant thread init if MT enabled
Victor Julien [Thu, 29 Jan 2015 15:40:23 +0000 (16:40 +0100)] 
detect: use multi tenant thread init if MT enabled

10 years agodetect: make multi tenancy a global switch
Victor Julien [Thu, 29 Jan 2015 13:39:01 +0000 (14:39 +0100)] 
detect: make multi tenancy a global switch

At start up we will set this flag based on "multi-detect.enabled".

10 years agotenants: apply added/removed tenant
Victor Julien [Thu, 29 Jan 2015 10:33:11 +0000 (11:33 +0100)] 
tenants: apply added/removed tenant

Apply to the engine.

10 years agodetect: initial MT lookup logic
Victor Julien [Thu, 29 Jan 2015 10:20:09 +0000 (11:20 +0100)] 
detect: initial MT lookup logic

In the DetectEngineThreadCtx, store another DetectEngineThreadCtx per
tenant.

Currently it's just a simple array indexed by the tenant id.

10 years agomulti-detect: (un)register-tenant unix socket commands
Victor Julien [Mon, 12 Jan 2015 18:00:16 +0000 (19:00 +0100)] 
multi-detect: (un)register-tenant unix socket commands

Make available to live mode and unix socket mode.

register-tenant:
    Loads a new YAML, does basic validation.
    Loads a new detection engine
    Loads rules
    Add new de_ctx to master store and stores tenant id in the de_ctx so
        we can look it up by tenant id later.

unregister-tenant:
    Gets the de_ctx, moves it to the freelist
    Removes config

Introduce DetectEngineGetByTenantId, which gets a reference to the
detect engine by tenant id.

10 years agoeve alert: fix stream payload printing 1607/head
Victor Julien [Wed, 22 Jul 2015 14:33:56 +0000 (16:33 +0200)] 
eve alert: fix stream payload printing

10 years agodetect: fix pass transaction handling
Victor Julien [Fri, 17 Jul 2015 19:05:14 +0000 (21:05 +0200)] 
detect: fix pass transaction handling

If a flow was 'pass'd, it means that no packet of it will flow be handled
by the detection engine. A side effect of this was that the per flow
inspect_id would never be moved forward. This in turn lead to a situation
where transactions wouldn't be freed.

This patch addresses this case by incrementing the inspect_id anyway for
the pass case.

10 years agodetect: set flow noinspect on pass in applayer/stream
Victor Julien [Fri, 17 Jul 2015 15:49:01 +0000 (17:49 +0200)] 
detect: set flow noinspect on pass in applayer/stream

If a pass rule matches in the reassembled stream and/or in the
app-layer state, it means the rest of the flow should not be
inspected.

10 years agohttp: destroy htp_tx_t even if incomplete
Victor Julien [Fri, 17 Jul 2015 13:31:56 +0000 (15:31 +0200)] 
http: destroy htp_tx_t even if incomplete

10 years agodetect: make http prefilter use disrupt flags
Victor Julien [Fri, 17 Jul 2015 11:38:36 +0000 (13:38 +0200)] 
detect: make http prefilter use disrupt flags