Commit Graph

3870 Commits (7d706563ef87a3f99cd8598263ac8e5f77b16754)
 

Author SHA1 Message Date
Eric Leblond ac56b1bf24 af-packet: detect MTU mismatch and warn user
If the MTU on the reception interface and the one on the transmission
interface are different, this will result in an error at transmission
when sending packet to the wire.
12 years ago
Eric Leblond 27b5136bf2 af-packet: add optional emergency mode
Flush all waiting packets to be in sync with kernel when drop
occurs. This mode can be activated by setting use-emergency-flush
to yes in the interface configuration.
12 years ago
Eric Leblond ec76742caa af-packet: reorder socket operation.
This patch moves raw socket binding at the end of init code to
avoid to have a flow of packets reaching the socket before we
start to read them.

The socket creation is now made in the loop function to avoid
any timing issue between init function and the call of the loop.
12 years ago
Eric Leblond 1ea809520a af-packet: fix runmode name in logging function 12 years ago
Eric Leblond a645726262 af-packet: add doxygen comments
This patch adds doxygen comments to newly introduced function and adds
module AF_PACKET doxygen module with a dedicated AFP peers module.
12 years ago
Eric Leblond 662dccd8a5 af-packet: IPS and TAP feature
This patch adds a new feature to AF_PACKET capture mode. It is now
possible to use AF_PACKET in IPS and TAP mode: all traffic received
on a interface will be forwarded (at the Ethernet level) to an other
interface. To do so, Suricata create a raw socket and sends the receive
packets to a interface designed in the configuration file.

This patch adds two variables to the configuration of af-packet
interface:
 copy-mode: ips or tap
 copy-iface: eth1 #the interface where packet are copied
If copy-mode is set to ips then the packet wth action DROP are not
copied to the destination interface. If copy-mode is set to tap,
all packets are copied to the destination interface.
Any other value of copy-mode results in the feature to be unused.
There is no default interface for copy-iface and the variable has
to be set for the ids or tap mode to work.

For now, this feature depends of the release data system. This
implies you need to activate the ring mode and zero copy. Basically
use-mmap has to be set to yes.

This patch adds a peering of AF_PACKET sockets from the thread on
one interface to the threads on another interface. Peering is
necessary as if we use an other socket the capture socket receives
all emitted packets. This is made using a new AFPPeer structure to
avoid direct interaction between AFPTreadVars.

There is currently a bug in Linux kernel (prior to 3.6) and it is
not possible to use multiple threads.

You need to setup two interfaces with equality on the threads
variable. copy-mode variable must be set on the two interfaces
and use-mmap must be set to activated.

A valid configuration for an IPS using eth0 and vboxnet1 interfaces
will look like:

af-packet:
  - interface: eth0
    threads: 1
    defrag: yes
    cluster-type: cluster_flow
    cluster-id: 98
    copy-mode: ips
    copy-iface: vboxnet1
    buffer-size: 64535
    use-mmap: yes
  - interface: vboxnet1
    threads: 1
    cluster-id: 97
    defrag: yes
    cluster-type: cluster_flow
    copy-mode: ips
    copy-iface: eth0
    buffer-size: 64535
    use-mmap: yes
12 years ago
Eric Leblond 2011a3f87e capture: add data release mechanism
This patch adds a data release mechanism. If the capture module
has a call to indicate that userland has finished with the data,
it is possible to use this system. The data will then be released
when the treatment of the packet is finished.

To do so the Packet structure has been modified:
+    TmEcode (*ReleaseData)(ThreadVars *, struct Packet_ *);
If ReleaseData is null, the function is called when the treatment
of the Packet is finished.
Thus it is sufficient for the capture module to code a function
wrapping the data release mechanism and to assign it to ReleaseData
field.

This patch also includes an implementation of this mechanism for
AF_PACKET.
12 years ago
Eric Leblond 8879df8004 af-packet: improve mmaped running mode.
The mmaped mode was using a too small ring buffer size which was
not able to handle burst of packets coming from the network. This
may explain the important packet loss rate observed by Edward
Fjellskål.
This patch increases the default value and adds a ring-size
variable which can be used to manually tune the value.
12 years ago
Eric Leblond 9622704c8c af-packet: delete design comments 12 years ago
Victor Julien 5d27518bbd Make sure we never underflow len in DetectLoadSigFile 12 years ago
Eric Leblond e6e339aacf Add counters for IPv4 in IPv6 and IPv6 in IPv6 12 years ago
Victor Julien 250c4e9310 file: convert filesize to new FileMatch api. 12 years ago
Victor Julien f93c54136c stream/app layer: call new Truncate callback for data gap case as well. 12 years ago
Victor Julien 869109a6a0 stream/app layer: add Truncate app layer callback that is called if stream depth is reached. Use it to trunc open files in HTTP. 12 years ago
Victor Julien 8f71333e12 file: implement filesize keyword. #489. 12 years ago
Anoop Saldanha 970fdee204 detection engine port api unittests cleanup 12 years ago
Victor Julien 3849588c61 Create separate detect API call (FileMatch) for file detection keywords. #531. 12 years ago
Eric Leblond 12743ca5d7 tls-log: add protocol version to log message. 12 years ago
pi-rho af20eaf2e5 fix regression (clobbered register; redmine #534) 12 years ago
pi-rho 0df4c5838d spelling corrections documented in redmine bug#533 12 years ago
Victor Julien 408548c2c4 rule reloads: don't lock up main thread so clean shutdown is impossible 12 years ago
Victor Julien cbeb8a86b7 pcap: fix compilation on old libpcap 12 years ago
Eric Leblond 16bdcbeb0e tm-thread: suppress rarely used variable. 12 years ago
Eric Leblond 92679442ca Convert to atomic and disable check on HTP config change.
This patch converts the series of variable to an atomic.

Furthermore, as the callbacks are now always run, it is not
necessary anymore to refuse a ruleswap if HTP parameters are
changing.
12 years ago
Eric Leblond 66a083dafa Get rid of AppLayerHtpRegisterExtraCallbacks
This patch add a early exit condition to the body handling callback.
This permits to avoid to avoid a complex system to handle htp
object change.
12 years ago
Eric Leblond 7e09cdc265 Delay Detect threads initialization
This patch modifies the init of Detect threads. They are now started
with a dummy function and their initialisation is done after the
signatures are loaded. Just after this, the dummy function is switched
to normal one.

In IPS mode, this permit to route packets without waiting for the
signature to start and should fix #488.

Offline mode such as pcap file don't use this mode to be sure to
analyse all packets in the file.

The patch introduces a "delayed-detect" configuration variable
under detect-engine. It can be used to activate the feature
(set to "yes" to have signature loaded after capture is started).
12 years ago
Eric Leblond eaea832a4e pcap: handle failure of packet treatment
If the loop is breaked, this means we've got a treatment error. We
don't need to reconnect but we must exit with correct status.
12 years ago
Eric Leblond f82573be12 tls: suppress always true condition. 12 years ago
Eric Leblond a3b2cee0d5 detect-tls: various indent fixes.
And delete a useless FIXME.
12 years ago
Eric Leblond b253d1a499 tls: store all the certificates chain in the written PEM file.
When using the tls.store command, a dump of all certificates in
the chain is now done on the disk.
12 years ago
Eric Leblond 152b4eaf56 tls: keep pointers to all certificates in chain
When multiple certificates forming a chain are sent. A pointer to
the start of each certificate is kept. This will allow treatment
on certificates chains.
12 years ago
Jean-Paul Roliers c4df7a45ae tls: adding store option for TLS
This patch adds a TLS store option to save certificate in PEM format.
Each time the store action is met, a file and a metafile are created.

Reworked-by: Eric Leblond <eric@regit.org>
12 years ago
Jean-Paul Roliers 00d4357362 tls: adding support for fingerprint rule matching.
Add the support for tls.fingerprint keyword in rules.
12 years ago
Jean-Paul Roliers bf386a396d tls: adding fingerprint to TLS Log information.
Improve TLS logging by adding the certificate fingerprint to TLS Log file.
Add the extending option to the tls-log entry in suricata.yaml.
12 years ago
Jean-Paul Roliers 644c1b3cad tls: adding fingerprint calculation.
Adding a pointer in ssl_state struct and compute fingerprint during
certificate decoding.
12 years ago
Eric Leblond 3df20d0544 tls: add NSS version for SHA1 computing function. 12 years ago
Jean-Paul Roliers 9071bcf983 tls: adding cryptographic functions.
Adding util-crypt containing cryptographic functions as SHA1 and Base64.
12 years ago
Jean-Paul Roliers efdf96ccba tls: adding TLS Log support
Creation of the log-tlslog file in order to log tls message.
Need to add some information into suricata.yaml to work.

  - tls-log:
      enabled: yes	# Log TLS connections.
      filename: tls.log # File to store TLS logs.
12 years ago
Anoop Saldanha 3eb0fd878d Don't wait for packetpool to be back to full state before continuing with the shutdown process, on received shutdown signal 12 years ago
Anoop Saldanha 5f198e3a1d Suricata shutdown updates + minor cleanup 12 years ago
Anoop Saldanha 34581ce902 rx TMs shouldn't return TM_ECODE_FAILED if engine is in shutdown mode + minor cleanup 12 years ago
Ignacio Sanchez b057a20f10 Custom logging feature for log-httplog 12 years ago
Eric Leblond def0270de7 decode: decode IPv6-in-IPv6
This patch adds decoding of IPv6-in-IPv6. It also adds some events
for invalid packets.

This patch should fix #514.
12 years ago
Victor Julien 438dd61948 Update version number to reflect we're working towards 1.4 now. 12 years ago
Eric Leblond f9046d8284 Add teredo counter. 12 years ago
Eric Leblond 09d893127e defrag: prealloc more frags. 12 years ago
Eric Leblond 6475f99bea defrag: Fix description of params
The max-frags params is not what it is.
12 years ago
Eric Leblond fd32159464 defrag: add some events relative to defragmentation 12 years ago
Eric Leblond d2aa0407c4 defrag: Fix unittest logic.
We've linked the size of hash with trackers. Thus calling DefragInit()
after setting the configuration variable is more logic.
12 years ago
Eric Leblond 0fd2c93c96 defrag: link hash size with number of frags.
We set defrag_hash_size by using the number of trackers. This is
effective to avoid collision.
12 years ago