Commit Graph

71 Commits (fffdc6e3fdbf9e3912ec5e5faf731554f1dcc90f)

Author SHA1 Message Date
Victor Julien 85db260eed threads: remove EngineKill & SURICATA_KILL
EngineStop and EngineKill were effectively doing the same, so
removed the kill variant.
10 years ago
Victor Julien 54503ef310 Open Suricata 3.2 development branch 10 years ago
Victor Julien d39e5754e6 instance: use enum for runmode 10 years ago
Victor Julien 36535cbc61 yaml: remove conf_filename global
conf_filename was a global pointer to the filename of the yaml.

Move into SCInstance. This reduces it's scope and cleans up the code.
10 years ago
Victor Julien 7ac7f9cd55 instance: add progname as ptr to argv[0] 10 years ago
Victor Julien 3781b00dbc Open Suricata 3.1 development branch 10 years ago
Victor Julien dd98bc353e signals: cleanup signal handling
Simplify handling of USR2 signal. The SCLogInfo usage could lead to
dead locks as the SCLog API can do many complicated things including
memory allocations, syslog calls, libjansson message construction.

If an existing malloc call was interupted, it could lead to the
following dead lock:

 0  __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97
 1  0x0000003140c7d2df in _L_lock_10176 () from /lib64/libc.so.6
 2  0x0000003140c7ab83 in __libc_malloc (bytes=211543457408) at malloc.c:3655
 3  0x0000003140c80ec2 in __strdup (s=0x259ca40 "[%i] %t - (%f:%l) <%d> (%n) -- ") at strdup.c:43
 4  0x000000000059dd4a in SCLogMessageGetBuffer (tval=0x7fff52b47360, color=1, type=SC_LOG_OP_TYPE_REGULAR, buffer=0x7fff52b47370 "", buffer_size=2048,
    log_format=0x259ca40 "[%i] %t - (%f:%l) <%d> (%n) -- ", log_level=SC_LOG_INFO, file=0x63dd00 "suricata.c", line=287, function=0x640f50 "SignalHandlerSigusr2StartingUp", error_code=SC_OK,
    message=0x7fff52b47bb0 "Live rule reload only possible after engine completely started.") at util-debug.c:307
 5  0x000000000059e940 in SCLogMessage (log_level=SC_LOG_INFO, file=0x63dd00 "suricata.c", line=287, function=0x640f50 "SignalHandlerSigusr2StartingUp", error_code=SC_OK,
    message=0x7fff52b47bb0 "Live rule reload only possible after engine completely started.") at util-debug.c:549
 6  0x000000000057e374 in SignalHandlerSigusr2StartingUp (sig=12) at suricata.c:287
 7  <signal handler called>
 8  _int_malloc (av=0x3140f8fe80, bytes=<value optimized out>) at malloc.c:4751
 9  0x0000003140c7ab1c in __libc_malloc (bytes=296) at malloc.c:3657
 10 0x0000000000504d55 in FlowAlloc () at flow-util.c:60
 11 0x00000000004fd909 in FlowInitConfig (quiet=0 '\000') at flow.c:454
 12 0x0000000000584c8e in main (argc=6, argv=0x7fff52b4a3b8) at suricata.c:2300

This patch simply sets a variable and lets the main loop act on that.
10 years ago
Victor Julien 84c4566a14 Update dev version to reflect we're doing 3.0 now 11 years ago
Victor Julien 0704ece4d7 detect-reload: enable unconditionally
Reloading is available unconditionally now.
12 years ago
Ken Steele a781fc5c2e Make suricata_ctl_flags be volatile
The global variable suricata_ctl_flags needs to volatile, otherwise the
compiler might not cause the variable to be read every time because it
doesn't know other threads might write the variable.

This was causing Suricata to not exit under some conditions.
12 years ago
Victor Julien ed84c8795d Update version number to 2.1dev 12 years ago
Victor Julien 96adcf6829 refactor IDS/IPS engine mode logic
Instead of error phrone externs with macro's, use functions with a local
static enum var instead.

- EngineModeIsIPS(): in IPS mode
- EngineModeIsIDS(): in IDS mode

To set the modes:

- EngineModeSetIDS(): IDS mode (default)
- EngineModeSetIPS(): IPS mode

Bug #1177.
12 years ago
Victor Julien b44ec80590 Add --disable-detection commandline option
Flags the SuriInstance that the detection engine should be disabled.
Actual disabling is not yet implemented.
13 years ago
Eric Leblond 1bdc39fe9b cmdline: add -k to specify checksum validation
This patch adds a '-k' option to suricata to be able to specify
the checksum validation to use. If '-k all' is used, checksum
validation is forced. If '-k none' is used, no checksum validation
is made.

Message output in case of detection of a pcap file with a probable
cheksum issue has been updated to indicate that '-k' is a solution.
13 years ago
Eric Leblond 2be194d03f suricata: add -v[v] option to increase verbosity
This patch adds a -v option to suricata. It increases the log level
defined in the YAML.
13 years ago
Eric Leblond 6cf7da30e2 Introduce host-mode.
This variable can be used to indicate to suricata that the host
running is running as a router or is in sniffing only mode.
This will used at least to determine which interfaces are used to
send reject message.
13 years ago
Eric Leblond 2a46f0dae4 suricata: rename SuriInstance to SCInstance. 13 years ago
Eric Leblond 18ced653c3 Use a typedef for SuriInstance. 13 years ago
Eric Leblond 325462d396 Export IsRuleReloadSet and use it. 13 years ago
Victor Julien eeb439c1a3 Open 2.0 dev branch 14 years ago
Eric Leblond 74a9fc4b66 Add function to display current capture mode
This patch adds a function to display the capture mode.
14 years ago
Eric Leblond 20a8b9dbe5 unix-manager: add unix command socket and associated script
This patch introduces a unix command socket. JSON formatted messages
can be exchanged between suricata and a program connecting to a
dedicated socket.
The protocol is the following:
 * Client connects to the socket
 * It sends a version message: { "version": "$VERSION_ID" }
 * Server answers with { "return": "OK|NOK" }
If server returns OK, the client is now allowed to send command.

The format of command is the following:
 {
   "command": "pcap-file",
   "arguments": { "filename": "smtp-clean.pcap", "output-dir": "/tmp/out" }
 }
The server will try to execute the "command" specified with the
(optional) provided "arguments".
The answer by server is the following:
 {
   "return": "OK|NOK",
   "message": JSON_OBJECT or information string
 }

A simple script is provided and is available under scripts/suricatasc. It
is not intended to be enterprise-grade tool but it is more a proof of
concept/example code.  The first command line argument of suricatasc is
used to specify the socket to connect to.

Configuration of the feature is made in the YAML under the 'unix-command'
section:
  unix-command:
    enabled: yes
    filename: custom.socket
The path specified in 'filename' is not absolute and is relative to the
state directory.

A new running mode called 'unix-socket' is also added.
When starting in this mode, only a unix socket manager
is started. When it receives a 'pcap-file' command, the manager
start a 'pcap-file' running mode which does not really leave at
the end of file but simply exit. The manager is then able to start
a new running mode with a new file.

To start this mode, Suricata must be started with the --unix-socket
 option which has an optional argument which fix the file name of the
socket. The path is not absolute and is relative to the state directory.

THe 'pcap-file' command adds a file to the list of files to treat.
For each pcap file, a pcap file running mode is started and the output
directory is changed to what specified in the command. The running
mode specified in the 'runmode' YAML setting is used to select which
running mode must be use for the pcap file treatment.

This requires modification in suricata.c file where initialisation code
is now conditional to the fact 'unix-socket' mode is not used.

Two other commands exists to get info on the remaining tasks:
 * pcap-file-number: return the number of files in the waiting queue
 * pcap-file-list: return the list of waiting files
'pcap-file-list' returns a structured object as message. The
structure is the following:
 {
  'count': 2,
  'files': ['file1.pcap', 'file2.pcap']
 }
14 years ago
Eric Leblond 3061452c5e suricata: avoid concurrent run in daemon mode
This patch creates a pid file per default and use it to avoid to be
able to run two Suricata. Separate pid file have to be provided to
be able to do it.
14 years ago
Anoop Saldanha bca1b7c52a change default mpm to ac. Also default sgh-mpm-context is full. 14 years ago
Victor Julien 438dd61948 Update version number to reflect we're working towards 1.4 now. 14 years ago
Anoop Saldanha 31eb5fa2f6 Introduce util-signal.[ch]. Move our signal setup functions here 14 years ago
Anoop Saldanha ecad4a24fa live rule support added
To reload ruleset during engine runtime, send the USR2 signal to the engine, and the ruleset would be reloaded from the same yaml file supplied at engine startup
14 years ago
Eric Leblond 2d22f667c2 config: use config file in sysconfdir by default. 14 years ago
Victor Julien 18d458870f 1.3 branch has opened 15 years ago
Victor Julien fb76561b09 Set version to 1.2dev to reflect we're in the 1.2 branch. 15 years ago
Victor Julien c484b7a59e Bump version to 1.1 (final) 15 years ago
Victor Julien 9f0e3f7c85 Bump version to 1.1rc1. 15 years ago
Eric Leblond acf10525f6 doc: add decode group and related documentation. 15 years ago
Eric Leblond 6220134a48 doc: describe some features and structures. 15 years ago
Eric Leblond eefdbfb55b doc: add mainpage. 15 years ago
Victor Julien c0bc83458c Bump version to 1.1beta3. 15 years ago
pilcrow ed69eeab14 Safer macro parenthesization and do/while use 15 years ago
Anoop Saldanha ff7284e7b7 Fix code that allows the engine to restart threads that have exited on failure 15 years ago
Victor Julien 38a7d1777f Bump version to 1.1beta2 16 years ago
Anoop Saldanha a165d45da9 naming changes for runmodes 16 years ago
Victor Julien 96ec2a76c6 Update version to 1.1beta1 16 years ago
Anoop Saldanha 42c1287028 renintroduce g_u8_lowercase_table for b2g cuda 16 years ago
Victor Julien 3971bcc83a Switch to faster tolower function for u8_tolower. 16 years ago
Victor Julien 99ad338e91 Bump version to 1.0.2 16 years ago
Pablo Rincon 5c43db85ce Drop streams on inline mode when a drop rule match from a reassembled stream and/or app layer inspection 16 years ago
Pablo Rincon 76af1b049b Make malloc errors on initialization stage a fatal error, resulting on a exit() call 16 years ago
Victor Julien 610b7702ba Bump version to 1.0.1 16 years ago
Victor Julien a4951286e9 Bump version to 1.0.0 16 years ago
Anoop Saldanha 33f4beb0bc batching of packets support for cuda b2g mpm. Supported for both 32 and 64 bit platforms 16 years ago
Victor Julien 6519a86ec7 Move packet pool to ringbuffer, update packet pool api and ringbuffer api. Remove memset usage from PACKET_RECYCLE, add proper cleanup macros. 16 years ago