Skip to main content

Help needed with Global Filters (body regex)

Comments

2 comments

  • Alain Gagnon
    I've had more time to play around with this, and I think I found a (manual) solution that works for now, but is not optimal in the long run. After searching around for posts, I've found a not supported way to edit the filters by doing this: 1- create 2 global filter rules, 1 that will be used, the second one a dummy that hopefully never matches (ex: to address random_user@abcdef.xyz) 2- delete the /home/user/.cpanel/filter.cache file 3- edit the /home/user/.cpanel/filter.yaml file with the syntax I want, ex: rules: - match: matches opt: or part: $message_body val: "Content-Disposition:.*attachment.*filename=\".*zip\"" - match: matches opt: or part: $message_body val: "Content-Disposition:.*attachment.*filename=\".*rar\"" 4- Once the yaml filter file seems correct, edit the 2nd rule, and just save it, which will recreate the filter.cache file and migrate the settings to /etc/vfilters/domain_name Once that's done, the yaml file is stripped of the " and the \" become simple " so it can't be reused without manual modifications, so I keep a backup of the syntax for further modifications if needed. I assume that it's an unintended effect, or that I'm not aware of a more proper way to escape characters to match what I want it to match, but it works for now. If any CPanel admins wanna chime in and tell me if it's worth opening a support ticket for this, or if I'm clearly not using the solution in a proper way, I'd be happy to proceed!
    0
  • cPanelMichael
    Hello, You may also find the following thread helpful when researching different methods of implementing filter rules for zip files: Reject emails with ZIP files containing EXE files It's different than the specific rule you are seeking, but offers some insight you may find helpful. Thank you.
    0

Please sign in to leave a comment.