Open spirillen opened 5 years ago
Third use-case could be that you have your recurser set up to distribute the answer based on roundrobin or geoip etc. Now you figure out that one of those server is infected, or not responding, anyway it's misbehave and you should like to redirect any request to that server to another, disregard other rulesets, then you only had to do:
addAction(SpoofAction(ip[, ip[...]] rule='5')
Fast and easy place a rule to disengage the server running on that ip and route the traffic to another server.....
Short description
This feature was given birth on irc by lieter the other day as we was talking about adding a regex rule and the Rule order matters, he mentioned adding a bottomRule() vs the topRule(). The idea have been tumbling in my head since, coz why isn't actually that we can not add a rule to it's right location from either the script, api or command line..... we have the feature in newServer with pool, weight and order.
Usecase
definition: weight should be understood as groupRule|ruleGroup
First use case: You have your scripts distributed in diff. files based on function rather than a 10000 lines long conf.lua. Written rules could be used as subsets for other rules and you might control that a regexRule should be rule
#3
and not#0
and the be related to group2 and group4 (weight) independent from pool, so now this rules could look likeaddAction(RegexRule("(^|\\.)ads\\."), RCodeAction(dnsdist.NXDOMAIN) weight='{2,4}' order='3')
Since this action should apply to all pools the weight and order becomes handy here.Second use case: If we take the same example as usecase 1, but we need this rule to out rule everything else no matter what it is rule #=0 then we apply it either by cli, api or script as..
addAction(RegexRule("(^|\\.)ads\\."), RCodeAction(dnsdist.NXDOMAIN) order='0')
However this action would in ex. be equal:
Description
In this way you can save commands like mvRule and topRule and it should work on api level as well
Give it some thought, as lieter said... could be nice but maybe hard :)
My thought is (haven't read the code), but is it possible to simply adapt this from the newServer module/code part?