Proposal: include directories for rulesets
cover Proposal: include directories for rulesets
A nice-to-have feature in nft would be the ability to use include directories that contain rule files. The use case would be support for services dropping their custom configuration files into a directory, allowing a more modular firewall configuration.
This is a proof-of-concept patch -- I'm not very familiar with nftables code base and conventions.
Ismo Puustinen (1):
scanner: add support for include directories
src/main.c | 4 ++-- src/scanner.l | 73 +++++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 61 insertions(+), 16 deletions(-)
Signature · 1 line
2.5.0
PATCH 1/1 scanner: add support for include directories
If a string after "include" keyword points to a directory instead of a file, consider the directory to contain only nft rule files and try to load them all. This helps with a use case where services drop their own firewall configuration files into a directory and nft needs to include those without knowing the exact file names.
--- src/main.c | 4 ++-- src/scanner.l | 73 +++++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 61 insertions(+), 16 deletions(-)
src/main.c +2 -2
@@ -36,8 +36,8 @@ unsigned int handle_output;unsigned int debug_level;#endif -const char *include_paths[INCLUDE_PATHS_MAX ] = {DEFAULT_INCLUDE_PATH }; -static unsigned int num_include_paths =1 ; +const char *include_paths[INCLUDE_PATHS_MAX ] = {DEFAULT_INCLUDE_PATH ,"." }; +static unsigned int num_include_paths =2 ;enum opt_vals {OPT_HELP ='h' ,
src/scanner.l +59 -14
91 lines not on this page · raw message
Signature · 1 line
2.5.0
Quoted 8 lines · Ismo Puustinen
A nice-to-have feature in nft would be the ability to use include directories that contain rule files. The use case would be support for services dropping their custom configuration files into a directory, allowing a more modular firewall configuration.
This is a proof-of-concept patch -- I'm not very familiar with nftables code base and conventions.
Hi Ismo,
I like the idea. What I'm wondering is if it worth having another directive like 'includedir' to be more explicit.
Signature · 5 lines
Arturo Borrero González -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Arturo Borrero Gonzalez
Hi Ismo,
I like the idea. What I'm wondering is if it worth having another directive like 'includedir' to be more explicit.
Sure, I'm fine with that approach too. If the project leadership indicates that the include directory approach makes sense, I could do a patch using the 'includedir' syntax too.
Ismo