pfsense:suricata:rules:breakdown_of_a_rule
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pfsense:suricata:rules:breakdown_of_a_rule [2021/01/21 10:54] – [Source and Destination IP and Port] peter | pfsense:suricata:rules:breakdown_of_a_rule [2021/01/22 10:07] (current) – [Rule Options] peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PFSense - Suricata - Rules - Breakdown of a rule ====== | ====== PFSense - Suricata - Rules - Breakdown of a rule ====== | ||
- | |||
===== Example Rule ===== | ===== Example Rule ===== | ||
Line 15: | Line 14: | ||
* **(msg:" | * **(msg:" | ||
+ | ---- | ||
<WRAP info> | <WRAP info> | ||
Line 34: | Line 34: | ||
---- | ---- | ||
- | ==== Actions ==== | + | ===== Actions |
Actions are performed in the following precedence order by default if multiple rules exist; but can be changed through Action Order. | Actions are performed in the following precedence order by default if multiple rules exist; but can be changed through Action Order. | ||
Line 45: | Line 45: | ||
---- | ---- | ||
- | ==== Protocol ==== | + | ===== Protocol ==== |
* **ip**: | * **ip**: | ||
Line 58: | Line 58: | ||
---- | ---- | ||
- | ==== Source and Destination IP and Port ==== | + | ===== Source |
- | From example there is: | + | < |
+ | any any -> any any | ||
+ | </ | ||
- | **any any → any any**. | + | Source and Destination IP can be configured as: |
- | In the example, | + | * **any**: |
+ | * **192.168.1.10**: | ||
+ | * **10.0.1.0/ | ||
+ | | ||
+ | | ||
+ | * **[192.168.1.10, !192.168.1.10]**: | ||
+ | * **[$EXTERNAL_NET, | ||
+ | * **![192.168.1.0/ | ||
- | * An exclamation mark specifies “not”, so “! 10.0.1.0/ | + | Ports act similarly: |
- | * < | + | |
- | * You can also mix-and-match with the ! as well. | + | |
- | * For example, if you wanted the rule to match IP 192.168.0.5 but not 192.168.1.0/ | + | |
- | * You can also throw in variables as well, like so: [$EXTERNAL_NET, | + | |
+ | * **any**: | ||
+ | * **80**: | ||
+ | * **[80: | ||
+ | * **[: | ||
+ | * **[1024: | ||
- | Ports act similarly but they have one additional sign that you can use: | ||
- | * < | + | Direction Specification: |
- | * If you want a non-specific range (i.e.: only a maximum or minimum port number), you can do this: [:1024] (matches everything from 0-1024) or [1024:] (matches from 1024 to the highest [typically 65535]). | + | |
+ | * **< | ||
+ | * **<> | ||
- | Direction Specification | + | <WRAP info> |
+ | **NOTE: | ||
+ | |||
+ | * **HOME_NET**: | ||
+ | * **EXTERNAL_NET**: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
- | * Between the IP and ports is the direction of packet flow, in our case ->. There’s two options for this: | + | ===== Rule Options ===== |
- | * -> - This is the most common and means only check if the source IP and port are coming in to the destination IP and port. | + | Options fall into different categories: |
- | * <> - This will match packet flow in either direction. | + | |
- | **NOTE: | + | |
+ | * **[[https:// | ||
+ | * **[[https:// | ||
+ | * **[[https:// | ||
+ | * **[[https:// | ||
---- | ---- | ||
- | Rule Options | + | < |
+ | msg:" | ||
+ | </ | ||
* The 3 most basic options are: | * The 3 most basic options are: | ||
Line 100: | Line 123: | ||
* **rev**: - Revision number/ID. | * **rev**: - Revision number/ID. | ||
* Incremented by 1 every time the rule is changed. | * Incremented by 1 every time the rule is changed. | ||
- | |||
- | |||
- | ---- | ||
---- | ---- | ||
+ | ==== Other Rule Examples ==== | ||
+ | < | ||
alert icmp any any -> \ | alert icmp any any -> \ | ||
any any (msg:" | any any (msg:" | ||
Line 133: | Line 155: | ||
alert tcp $EXTERNAL_NET any -> $HTTP_SERVERS $HTTP_PORTS (msg: | alert tcp $EXTERNAL_NET any -> $HTTP_SERVERS $HTTP_PORTS (msg: | ||
- | |||
</ | </ | ||
- | |||
- | where: | ||
- | |||
- | * **Action**: | ||
- | * **Header**: | ||
- | * **Options**: | ||
- | |||
- | ---- | ||
---- | ---- | ||
pfsense/suricata/rules/breakdown_of_a_rule.1611226468.txt.gz · Last modified: 2021/01/21 10:54 by peter