-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ndpi: ndpi as a plugin - v6 #12476
base: master
Are you sure you want to change the base?
ndpi: ndpi as a plugin - v6 #12476
Changes from all commits
c5d032a
2b16f3a
0f6a936
120f082
9954e18
3258704
26611f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,8 @@ Suricata Rules | |
smtp-keywords | ||
websocket-keywords | ||
app-layer | ||
ndpi-protocol | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should have only one ndpi entry here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. |
||
ndpi-risk | ||
xbits | ||
noalert | ||
thresholding | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
nDPI Protocol Keyword | ||
===================== | ||
|
||
ndpi-protocol | ||
------------- | ||
|
||
Match on the Layer-7 protocol detected by nDPI. | ||
|
||
Suricata should be compiled with the nDPI support and the ``ndpi`` | ||
jasonish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
plugin must be loaded before it can be used. | ||
|
||
Example of configuring Suricata to be compiled with nDPI support: | ||
|
||
.. code-block:: console | ||
./configure --enable-ndpi --with-ndpi=/home/user/nDPI | ||
Note that rules using the ``ndpi-protocol`` should check if the | ||
``ndpi-protocol`` keyword exists with ``requires``, for example:: | ||
|
||
requires: keyword ndpi-protocol | ||
|
||
Example of suricata.yaml configuration file to load the ``ndpi`` plugin:: | ||
|
||
plugins: | ||
- /usr/lib/suricata/ndpi.so | ||
|
||
Comment on lines
+12
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion to move the portions of both sections that are related to configuration to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main configuration chapter? As a plugin, I think the documentation should be self contained, and our main configuration should not contain anything that is provided by a plugin, bundled with Suricata or not. Just to provide a clear separation. |
||
Syntax:: | ||
|
||
ndpi-protocol:[!]<protocol>; | ||
|
||
Where protocol is one of the application protocols detected by nDPI. | ||
jasonish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Plase check ndpiReader -H for the full list. | ||
It is possible to specify the transport protocol, the application | ||
protocol, or both (dot-separated). | ||
|
||
Examples:: | ||
|
||
ndpi-protocol:HTTP; | ||
ndpi-protocol:!TLS; | ||
ndpi-protocol:TLS.YouTube; | ||
|
||
Here is an example of a rule matching TLS traffic on port 53: | ||
|
||
.. container:: example-rule | ||
|
||
alert tcp any any -> any 53 (msg:"TLS traffic over DNS standard port"; requires: keyword ndpi-protocol; ndpi-protocol:TLS; sid:1;) | ||
jasonish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
nDPI Risk Keyword | ||
================= | ||
|
||
ndpi-risk | ||
--------- | ||
|
||
Match on the flow risks detected by nDPI. Risks are potential issues detected | ||
by nDPI during the packet dissection and include: | ||
|
||
- Known Proto on Non Std Port | ||
- Binary App Transfer | ||
- Self-signed Certificate | ||
- Susp DGA Domain name | ||
- Malware host contacted | ||
- and many other... | ||
|
||
Suricata should be compiled with nDPI support and the ``ndpi`` plugin | ||
must be loaded before it can be used. | ||
|
||
Additionally, rules using the ``ndpi-risk`` keyword should check if | ||
the keyword exists using the ``requires`` keyword, for example:: | ||
|
||
``requires: keyword ndpi-risk`` | ||
|
||
Example of configuring Suricata to be compiled with nDPI support: | ||
|
||
.. code-block:: console | ||
|
||
./configure --enable-ndpi --with-ndpi=/home/user/nDPI | ||
|
||
Example of suricata.yaml configuration file to load the ``ndpi`` plugin:: | ||
|
||
plugins: | ||
- /usr/lib/suricata/ndpi.so | ||
|
||
Syntax:: | ||
|
||
ndpi-risk:[!]<risk>; | ||
|
||
Where risk is one (or multiple comma-separated) of the risk codes supported by | ||
nDPI (e.g. NDPI_BINARY_APPLICATION_TRANSFER). Please check ndpiReader -H for the | ||
full list. | ||
|
||
Examples:: | ||
|
||
ndpi-risk:NDPI_BINARY_APPLICATION_TRANSFER; | ||
ndpi-risk:NDPI_TLS_OBSOLETE_VERSION,NDPI_TLS_WEAK_CIPHER; | ||
|
||
Here is an example of a rule matching HTTP traffic transferring a binary application: | ||
|
||
.. container:: example-rule | ||
|
||
alert tcp any any -> any any (msg:"Binary application transfer over HTTP"; requires: keyword ndpi-protocol, keyword ndpi-risk; ndpi-protocol:HTTP; ndpi-risk:NDPI_BINARY_APPLICATION_TRANSFER; sid:1;) | ||
jasonish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ endif | |
if BUILD_NAPATECH | ||
SUBDIRS += napatech | ||
endif | ||
|
||
if BUILD_NDPI | ||
SUBDIRS += ndpi | ||
endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pkglib_LTLIBRARIES = ndpi.la | ||
|
||
ndpi_la_LDFLAGS = -module -avoid-version -shared | ||
ndpi_la_LIBADD = @NDPI_LIB@ | ||
|
||
# Only required to find these headers when building plugins from the | ||
# source directory. | ||
ndpi_la_CFLAGS = -I../../rust/gen -I../../rust/dist | ||
|
||
ndpi_la_SOURCES = ndpi.c | ||
|
||
install-exec-hook: | ||
cd $(DESTDIR)$(pkglibdir) && $(RM) $(pkglib_LTLIBRARIES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should run some pcap with it like https://github.com/OISF/suricata/pull/12471/files#diff-a76cf7978f0a981f911e8d68d2351a72a268977304612226433df4fb8203b06fR194 (this is done for other plugins of yours if I am correct)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every S-V test that doesn't specify a custom
suricata.yaml
is run with this plugin enabled. Which is why we needed the entry in the schema.