On 11/2/2016 10:45 PM, vod vos wrote: > Hi everyone, > > /etc/postfix/header_checks.pcre <http://www.postfix.org/pcre_table.5.html>: > /^Content-(Disposition|Type).*name\s*=\s*"?([^;]*(\.|=2E)( > ade|adp|asp|bas|bat|chm|cmd|com|cpl|crt|dll|exe| > hlp|ht[at]| > inf|ins|isp|jse?|lnk|md[betw]|ms[cipt]|nws| > \{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\}| > ops|pcd|pif|prf|reg|sc[frt]|sh[bsm]|swf| > vb[esx]?|vxd|ws[cfh]))(\?=)?"?\s*(;|$)/x > REJECT Attachment name "$2" may not end with ".$4" > > the codes define what kind of attachment can not be received by > server, you have to add one by one. > > HOW can we just receive just such as .jpg .png .mp4 and reject all > other attachment in a short regexp to do the job? > > thanks. > > yours. >
Sure, modify the above list with your allowed attachments, and end it with DUNNO instead of REJECT. Then add a second check with something like /^Content-(Disposition|Type).*name\s*=/ REJECT to reject everything not explicitly allowed. I suspect you'll end up with a longer list of allowed attachment types than this list of banned types. Good luck. -- Noel Jones