3proxy PCRE (Perl Compatible Regular Expressions) Filtering

Note: Since version 0.9.7, PCRE filtering is built into 3proxy and does not require a separate plugin. All pcre_* commands are available directly when 3proxy is compiled with PCRE2 support (WITH_PCRE). The plugin line is no longer needed.

This filtering functionality can be used to create matching and replacement rules with regular expressions for client requests, client and server headers, and client and server data. It adds 3 additional configuration commands:

pcre TYPE FILTER_ACTION REGEXP [ACE]
pcre_rewrite TYPE FILTER_ACTION REGEXP REWRITE_EXPRESSION [ACE]
pcre_extend FILTER_ACTION [ACE]
pcre_options OPTION1 [...]
pcre - allows applying a rule for matching
pcre_rewrite - in addition to 'pcre', allows substituting substrings
pcre_extend - extends the ACL of the last pcre or pcre_rewrite command by adding an additional ACE (like with allow/deny configuration commands).
pcre_options - allows setting matching options. Available options are: PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, PCRE_EXTENDED, PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, PCRE_EXTRA, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_UNGREEDY, PCRE_NOTEMPTY, PCRE_UTF8, PCRE_NO_AUTO_CAPTURE, PCRE_NO_UTF8_CHECK, PCRE_AUTO_CALLOUT, PCRE_PARTIAL, PCRE_DFA_SHORTEST, PCRE_DFA_RESTART, PCRE_FIRSTLINE, PCRE_DUPNAMES, PCRE_NEWLINE_CR, PCRE_NEWLINE_LF, PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANY, PCRE_NEWLINE_ANYCRLF, PCRE_BSR_ANYCRLF, PCRE_BSR_UNICODE

Example:

pcre request deny "porn|sex" user1,user2,user3 192.168.0.0/16
pcre srvheader deny "Content-type: application"
pcre_rewrite clidata,srvdata dunno "porn|sex|pussy" "***" baduser
pcre_extend deny * 192.168.0.1/16
© Vladimir Dubrovin, License: BSD style