1 (edited by wlaarhov 2022-05-01 21:46:38)

Topic: email ban on file extension (50-user amavis)

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): - 1.5.2 MARIADB edition
- Deployed with iRedMail Easy or the downloadable installer? - Downloadable Installer
- Linux/BSD distribution name and version: Ubuntu 20.04.4 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello, try to figure out what the difference is between:

  qr'.\.pub$',
and
  qr'^\.pub$',

in the section "$banned_filename_re = new_RE("

I found a post that suggested adding the 2nd option, but that did not work. Since most entries start with ./. I finally tested that one and that seems to work.

But cannot find some good examples and I am "fairly light" on regular expressions.

Thanks,

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team.

2 (edited by Cthulhu 2022-05-01 23:10:27)

Re: email ban on file extension (50-user amavis)

https://regex101.com/

first regex:
.\.pub$

second regex:
^\.pub$

Explanation:
^ = Start of String
$ = End of String
\ = Next char doesn't count as regex, only as a single char
. = Matches any kind of single char
.+ = Matches any kind of signle char(s) (any lenght)

If you use ^\.pub$

it matches .pub, but ONLY that, since the ^ markes it that it is the start of the string, but you check for filename.pub, so it will never match

If you use .\.pub$

it matches .pub ONLY if there is a filename like filename.pub

You can check the pattern matching yourself

For a full match (and not just a partial match):

^.+\.pub$

or if you want to use it in your case:

qr'^.+\.pub$'

I think this should work out for you

3

Re: email ban on file extension (50-user amavis)

WHOW, thank you so much. This is really helpful!!