GatekeeperIpTables class

The GatekeeperIpTables class is a concrete implementation of GatekeeperDriver that uses iptables or a similar utility to manage TCP ports on a system.

Example usage:

var gatekeeper = GatekeeperIpTables();
await gatekeeper.listBlockedTCPPorts();
await gatekeeper.blockTCPPort(8080);
Inheritance

Constructors

GatekeeperIpTables({bool verbose = false})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
verbose bool
final

Methods

acceptAddressOnTCPPort(String address, int port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Add rule to accept connections on a specified TCP port from the given address.
override
blockTCPPort(int port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Blocks a specific TCP port.
override
clearResolveBinaryPathCache() → void
Clears the cached binary path entries.
inherited
isAcceptedAddress(String address, {bool sudo = false, Set<int>? allowedPorts}) Future<bool>
Checks whether a specific address is accepted on ANY TCP port. See also: isAcceptedAddressOnPort, listAcceptedAddressesOnTCPPorts.
inherited
isAcceptedAddressOnPort(String address, int port, {bool sudo = false, Set<int>? allowedPorts}) Future<bool>
Checks whether a specific address is accepted on a TCP port. See also: listAcceptedAddressesOnTCPPorts.
inherited
isBlockedTCPPort(int port, {bool sudo = false, Set<int>? allowedPorts}) Future<bool>
Checks whether a specific TCP port is blocked. See listBlockedTCPPorts.
inherited
listAcceptedAddressesOnTCPPorts({bool sudo = false, Set<int>? allowedPorts}) Future<Set<(String, int)>>
Lists all the currently accepted addresses on TCP ports.
override
listBlockedTCPPorts({bool sudo = false, Set<int>? allowedPorts}) Future<Set<int>>
Lists all the currently blocked TCP ports.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve() Future<bool>
Resolves this GatekeeperDriver instance to ensure that it can be used in this system.
override
resolveBinaryPath(String binaryCommand) Future<String>
Resolves the binary path for a given command. See resolveBinaryPathCached.
override
resolveBinaryPathCached(String binaryCommand) Future<String>
Resolves the binary path for a given command, using a cached path if available.
inherited
runCommand(String binaryPath, List<String> args, {bool sudo = false, int? expectedExitCode}) Future<String?>
Runs a command using the specified binary path and arguments.
override
toString() String
A string representation of this object.
override
unacceptAddressOnTCPPort(String address, int? port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Reverses the acceptance ("unaccept") of an address on a specified TCP port.
override
unblockTCPPort(int port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Unblocks a specific TCP port.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited