base/frameworks/netcontrol/catch-and-release.bro
- 
NetControl
Implementation of catch-and-release functionality for NetControl.
Detailed Interface
Runtime Options
- 
NetControl::catch_release_warn_blocked_ip_encountered
- 
If true, catch and release warns if packets of an IP address are still seen after it
should have been blocked. 
 
Redefinable Options
- 
NetControl::catch_release_intervals
- 
[10.0 mins, 1.0 hr, 1.0 day, 7.0 days]
 
Time intervals for which subsequent drops of the same IP take
effect. 
- 
NetControl::watch_connections
- 
If true, catch_release_seen is called on the connection originator in new_connection,
connection_established, partial_connection, connection_attempt, connection_rejected,
connection_reset and connection_pending 
 
Types
- 
NetControl::BlockInfo
- 
| Type: | record
 
block_until: time&optionalAbsolute time indicating until when a block is inserted using NetControl.watch_until: timeAbsolute time indicating until when an IP address is watched to reblock it.num_reblocked: count&default=0&optionalNumber of times an IP address was reblocked.current_interval: countNumber indicating at which catch and release interval we currently are.current_block_id: stringID of the inserted block, if any.location: string&optionalUser specified string. | 
|---|
 
 - This record is used for storing information about current blocks that are
part of catch and release. 
- 
NetControl::CatchReleaseActions
- 
| Type: | enum
 
NetControl::INFOLog lines marked with info are purely informational; no action was taken. 
NetControl::ADDEDA rule for the specified IP address already existed in NetControl (outside
of catch-and-release). Catch and release did not add a new rule, but is now
watching the IP address and will add a new rule after the current rule expires. 
NetControl::DROP(present if base/frameworks/netcontrol/types.bro is loaded) Stop forwarding all packets matching the entity. No additional arguments. 
NetControl::DROPPEDA drop was requested by catch and release.
An address was successfully blocked by catch and release. 
NetControl::UNBLOCKAn address was unblocked after the timeout expired. 
NetControl::FORGOTTENAn address was forgotten because it did not reappear within the watch_until interval. 
NetControl::SEEN_AGAINA watched IP address was seen again; catch and release will re-block it. | 
|---|
 
 - The enum that contains the different kinds of messages that are logged by
catch and release. 
- 
NetControl::CatchReleaseInfo
- 
The record type that is used for representing and logging 
 
Events
- 
NetControl::catch_release_add
- 
- 
NetControl::catch_release_block_delete
- 
- 
NetControl::catch_release_block_new
- 
- 
NetControl::catch_release_delete
- 
- 
NetControl::catch_release_encountered
- 
- 
NetControl::catch_release_forgotten
- 
Event is raised when catch and release cases management of an IP address because no
activity was seen within the watch_until period. 
| A: | The address that is no longer being managed. | 
|---|
 | Bi: | The NetControl::BlockInforecord containing information about the block. | 
|---|
 
 
- 
NetControl::log_netcontrol_catch_release
- 
Event that can be handled to access the NetControl::CatchReleaseInforecord as it is sent on to the logging framework.
 
 
Functions
- 
NetControl::catch_release_seen
- 
This function can be called to notify the catch and release script that activity by
an IP address was seen. If the respective IP address is currently monitored by catch and
release and not blocked, the block will be reinstated. See the documentation of watch_new_connection
which events the catch and release functionality usually monitors for activity. 
| A: | The address that was seen and should be re-dropped if it is being watched. | 
|---|
 
 
- 
NetControl::drop_address_catch_release
- 
Stops all packets involving an IP address from being forwarded. This function
uses catch-and-release functionality, where the IP address is only dropped for
a short amount of time that is incremented steadily when the IP is encountered
again. In cluster mode, this function works on workers as well as the manager. On managers,
the returned NetControl::BlockInforecord will not contain the block ID,
which will be assigned on the manager.
 
| A: | The address to be dropped. | 
|---|
 | T: | How long to drop it, with 0 being indefinitely. | 
|---|
 | Location: | An optional string describing where the drop was triggered. | 
|---|
 | Returns: | The NetControl::BlockInforecord containing information about
the inserted block. | 
|---|
 
 
- 
NetControl::get_catch_release_info
- 
Get the NetControl::BlockInforecord for an address currently blocked by catch and release.
If the address is unknown to catch and release, the watch_until time will be set to 0.
 In cluster mode, this function works on the manager and workers. On workers, the data will
lag slightly behind the manager; if you add a block, it will not be instantly available via
this function. 
| A: | The address to get information about. | 
|---|
 | Returns: | The NetControl::BlockInforecord containing information about
the inserted block. | 
|---|
 
 
- 
NetControl::unblock_address_catch_release
- 
Removes an address from being watched with catch and release. Returns true if the
address was found and removed; returns false if it was unknown to catch and release. If the address is currently blocked, and the block was inserted by catch and release,
the block is removed. 
| A: | The address to be unblocked. | 
|---|
 | Reason: | A reason for the unblock. | 
|---|
 | Returns: | True if the address was unblocked. | 
|---|