Options

IP::addr and regex

KragsterKragster Member
is it possible to check against client IP using regex? basically trying to do an aflex ACL to limit IP's for SMTP connections

something similar to this (this isn't working of course)

when CLIENT_ACCEPTED {
if { not [IP::addr [IP::client_addr] matches regex "^192\.168\.2\.(10[5-7])$"] } {
drop
}
}
Tagged:

Comments

  • Options
    siddharthaasiddharthaa Member, Administrator admin
    edited February 2017
    Hi

    You can find examples to match based on IP address over here:
    https://www.a10networks.com/blog/aflex-optimization

    There is also a matches_regex operator that tests whether one string matches a regular expression or another string. The aFleX Scripting Language Reference guide documents the following example:

    when HTTP_REQUEST {
    if { [HTTP::uri] matches_regex "^/(static|images)/.*" } {
    pool static_service_group
    } else {
    pool dynamic_service_group
    }
    }


    Regards.
Sign In or Register to comment.