Overview
A filter is a named set of rules bound to a destination port on a protected IP. When a packet arrives for that IP and port, ALOS WALL walks the rule list in order. Each rule is evaluated independently; the first rule whose conditions all match determines the outcome for that packet.
Rules give you a programmable layer on top of the rate limiter and SYN-cookie engine. Where rate limiting responds to volume, filters respond to content. They can identify and drop a specific attack tool's signature while passing every other connection on the same port.
Filters operate on the L4 payload: the bytes that follow the TCP or UDP header. Offset 0 is the first byte of application data, not the IP or transport header.
The AND Model
A single rule can hold up to 4 conditions. The rule fires only when all conditions match, a logical AND across every condition in the rule. If any condition fails, the rule is skipped and evaluation moves to the next rule.
This lets you express precise, multi-field signatures without false positives. A rule that says "byte 0 is 0x47 AND byte 1 is 0x45 AND byte 2 is 0x54" matches the ASCII string GET at the start of the payload and nothing else.
To express an OR ("block if signature A or signature B"), add two separate rules, each with its own conditions and action.
Condition Types
Each condition has a key that selects the check type, plus an offset or position and a value to match against.
- 1byte: match a single byte at payload offset
pos[0]againstvalue[0]. - 2byte: match two bytes: byte at
pos[0]againstvalue[0]and byte atpos[1]againstvalue[1]. - 3byte: match three bytes at
pos[0..2]againstvalue[0..2]. - 4byte: match four bytes at
pos[0..3]againstvalue[0..3]. The four offsets do not need to be consecutive. - bitmask: check that
(payload[pos[0]] & mask) == value. Useful for matching flag fields where only certain bits matter. - length eq: match when the total packet or payload length equals
value. - length gt: match when the length is greater than
value. - length ls: match when the length is less than
value. - length-between: match when the length falls within the inclusive range
[value[0], value[1]]. - ttl: match when the IP TTL field equals
value. Useful for fingerprinting tool-generated floods that use a fixed TTL. - srcport: match when the UDP or TCP source port equals
value. Useful for reflection attacks that arrive on a predictable port. - openport: a special marker condition: it flags the port as open so that traffic which does not match any blocking rule is allowed through rather than dropped. Add this as the last rule on any port you intend to serve.
Byte-Match Example
The rule below drops an HTTP GET flood on port 80 by matching the three ASCII bytes G (0x47), E (0x45), T (0x54) at the very start of the L4 payload. Offsets are zero-based from the first byte of application data.
{
"port": 80,
"filters": [
{
"action": "block",
"count": 1,
"resistance": 0,
"conditions": [
{ "key": "1byte", "pos": [0], "value": ["0x47"] },
{ "key": "1byte", "pos": [1], "value": ["0x45"] },
{ "key": "1byte", "pos": [2], "value": ["0x54"] }
]
}
]
}
All three conditions must match for the rule to fire. A packet whose first payload bytes are not GET passes through to subsequent rules. You can tighten this signature further by adding a length gt condition inside the same rule, for example requiring the payload to exceed 200 bytes, which is typical of a real HTTP request flood but not a simple probe.
All byte values are written as hex strings ("0x47"). Decimal integers and plain hex without the 0x prefix are not accepted.
Actions
Every rule ends with one of three actions that execute when all conditions match:
- allow: whitelist the flow. The packet is passed immediately and no further rules are evaluated. Use this to carve out an exception above a broader block rule. For example, allow traffic from a known-good source port before a blanket
blockbeneath it. - block: drop the packet silently. The sender receives no response. This is the right choice for volumetric floods where you want to consume as little CPU as possible and give the attacker no signal.
- reset: drop the packet and send a TCP RST back to the source. This tears down the connection on the sender's side immediately, which can be useful against slow-rate application attacks where you want the client to reconnect rather than hold state open indefinitely.
Do not use reset on UDP flows. RSTs are meaningless for connectionless traffic. Use block instead.
Count & Resistance
Two fields on every rule control how sensitive it is to noise before it commits to the action:
- count: the number of consecutive matching packets required before the action actually triggers. A value of
1fires on the first match. Higher values let you ignore a single stray packet that happens to satisfy the signature before committing to a block. - resistance: how many non-matching packets the rule tolerates before it resets its match counter back to zero. A value of
0means the counter resets the moment any non-matching packet arrives. Higher values let the rule absorb interleaved legitimate traffic and still fire if the attack ratio stays high.
For a sharp, high-confidence signature like an exact byte string, count: 1 and resistance: 0 is usually correct. For a broader heuristic like a length range, raising both values reduces false positives at the cost of slightly slower response.
Attaching to a Port
Rules live in the per-port filter set, stored in the filters BPF map keyed by protected IP and destination port. You can seed the config directly as JSON and load it at startup, or add rules live through the admin panel.
The example below defines two rules on port 443: the first drops TLS ClientHello floods whose payload starts with 0x16 0x03 (the TLS record-layer magic bytes) and exceeds 512 bytes; the second opens the port so everything else passes through.
{
"port": 443,
"filters": [
{
"action": "block",
"count": 2,
"resistance": 1,
"conditions": [
{ "key": "1byte", "pos": [0], "value": ["0x16"] },
{ "key": "1byte", "pos": [1], "value": ["0x03"] },
{ "key": "length gt", "pos": [], "value": ["512"] }
]
},
{
"action": "allow",
"count": 1,
"resistance": 0,
"conditions": [
{ "key": "openport", "pos": [], "value": [] }
]
}
]
}
Always place your openport rule last. Rules are evaluated in order and the first match wins, so putting openport first would allow everything and skip your block rules entirely.
In the Admin Panel
The admin panel provides a visual rule builder so you can add and remove filter rules without editing JSON by hand. Navigate to the Filters section for your protected port, then:
- Select a condition type from the dropdown (
1byte,length gt,ttl, etc.). - Enter the offset(s) and value(s) for that condition.
- Add up to 4 conditions to a single rule using the Add Condition button.
- Choose the action: allow, block, or reset.
- Set the count and resistance thresholds.
- Click Save. The rule is written directly into the live
filtersBPF map with no restart required.
Changes take effect immediately. The panel also shows per-rule match counters so you can confirm a new rule is hitting the traffic you intended before you commit to a permanent block action. See Monitoring for how to read those counters over time.