Em Andamento

Regex for Postfix rewrite IPv6 in header_checks

I posted this before I checked the default cost, which is why I deleted the last one. This should be a simple regex creation.

Background: My Postfix mail server rewrites the header using the following regular expression in /etc/postfix/header_checks:

/^Received: from (.* \([-._[:alnum:]]+ \[[.[:digit:]]{7,15}\]\)).*?([[:space:]]+).*\(Authenticated sender: ([^)]+)\).*by (example\.com) \(([^)]+)\) with (E?SMTPS?A?) id ([A-F[:digit:]]+).*/

REPLACE Received: from [127.0.0.1] (localhost [127.0.0.1])$2(Authenticated sender: $3)${2}with $6 id $7

What this does is replace the IP address and hostname of sender with something generic like localhost and 127.0.0.1 instead of the PC name and true client IP address, which would otherwise pose a security risk. I don't mind having the "authenticated sender" in there. I just don't want all recipients to know from where the clients are sending.

Problem description: while the above regex works fine for IPv4, it obviously does not work when clients are using IPv6. So, would like to modify or append that regex/replace statement so that it works for both IPv6 and IPv4. I believe this should be pretty straightforward. I have extremely verbose logging turned on in my Postfix instance so can see the re-writes as they happen with the postfix/cleanup daemon in the logs. This is not a lot of work, just some expertise in regex and Postfix.

Habilidades: Linux, Perl, Instalação de Script, Shell Script, Administrador do Sistema

Ver mais: using regular expression, statement problem example, simple problem statement example, regular expression using, regular expression linux example, regex is, regex example, regex c, problem statement example, example regular expression, regular expression example, regex, postfix, ipv4, c regex, problem sending mail, script sender, regular expression replace, linux cleanup script, linux regular expression, linux security script, replace linux, postfix mail server linux, postfix expression, linux replace

Acerca do Empregador:
( 1 comentário ) Honolulu, United States

ID do Projeto: #5138851

Premiar a:

ohadglaich

Like I suggested on your last post. send me both examples of IPv4 and IPv6 incomes, and your regex output for IPv4 (what regex extract from the income) and I'll rewrite the regex above to snatch both IPv4+6 Delivery Mais

$45 USD em 2 dias
(1 Comentário)
1.3

2 freelancers estão ofertando em média $38 para este trabalho

mikipeshevski

Linux system administrator with 10 years of experience. I have done this before with IPv4. I believe I can also do it with IPv6.

$30 USD in 0 dias
(0 Comentários)
0.0