Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to reload a new version of a custom rulesets? #306

Open
sandromodarelli opened this issue May 23, 2018 · 3 comments
Open

how to reload a new version of a custom rulesets? #306

sandromodarelli opened this issue May 23, 2018 · 3 comments

Comments

@sandromodarelli
Copy link

I have added a 50000_custom_rulesets.json in libpath/rules/ and a waf:set_option("add_ruleset", "50000_custom_rulesets")
I need to reload rules when the custom rulesets' file has changed.

A partial solution can be to have access to:

-- ruleset table cache
local _ruleset_defs = {}
local _ruleset_def_cnt = 0

If the ruleset_defs table was public, i would make at init_worker phase a timer loop that check the custom rulesets' file changes. If the file has changed, process will set ruleset_defs["50000_custom_rulesets"] = nil and during the waf:exec new rules would be reloaded from file.

@p0pr0ck5
Copy link
Owner

Hi,

The current design requires that worker processes be reloaded, since we consider rules to be like any other on-disk config file. Does this approach not work for your use case?

@sandromodarelli
Copy link
Author

It would be great to load rules dinamically, without a reload. With limit conditions, Nginx workers detach from master and becomes zombie workers; so the dinamic rules configuration can be a good plus

@p0pr0ck5
Copy link
Owner

If you have a case where you're seeing zombie processes as a result of a reload, then I suspect there is something problematic with your setup. If you suspect zombie processes are related to lua-resty-waf, pleaded provide some debug logs or a minimal test case to reproduce :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants