Help language development. Donate to The Perl Foundation
Linux::NFTables - An interface to libnftables, a library to interact with Linux NFTables
use Linux::NFTables; my Linux::NFTables $nft .= new; $nft.exec('list ruleset');
Linux::NFTables is an interface to libnftables, a library to interact with Linux NFTables
Many methods return a Bool value to indicate whether the action has been successfully performed.
The constructor takes no arguments.
The first method sets the operations for a dry run, the second returns the state of the dry-run flag.
List commands produce output, but no real action will be performed on the firewall rules.
The first method allows to add bit-mapped flags to modify the library's behavior, the second returns the value of the flags.
The available flags are:
The first method sets, the second reads the debug level.
The available levels are:
These methods redirect the command output to a file or to stdout.
These methods redirect the command errors to a file or to stderr.
These methods ask to send the command outout or error to a buffer. They take one Bool parameter; when invoked without parameter they default to False.
These methods return the output or error buffer content (if the the system was asked to buffer its output)
The first method adds a search path for the include command in nftables, the second one removes all the include paths.
The first method defines a variable, the second removes all variables.
This method executes a nftables command.
This method reads and executes nftables comands from a file.
For more details on libnftables see
man 3 libnftables.
For more details on nftables see https://wiki.nftables.org/wiki-nftables/index.php/Main_Page.
This module requires the libnftables library to be installed. On Debian-like systems install both libnftables1 and libnftables-dev.
To install it using zef (a module management tool):
$ zef install Linux::NFTables
Fernando Santagata [email protected]
Copyright 2023 Fernando Santagata
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.