+ Post New Thread
Results 1 to 12 of 12
Scripts Thread, Regular Expression help in Coding and Web Development; Just trying to setup a reg ex to modify headers in Zimbra - can anybody see anything wrong with this? ...
  1. #1

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351

    Regular Expression help

    Just trying to setup a reg ex to modify headers in Zimbra - can anybody see anything wrong with this?

    thanks in advance!

    Code:
    /^Received: from zimbra\-mail1\.domain\.co\.uk .+(by zimbra\-mail1\.domain\.co\.uk .+) / REPLACE Received: $1

  2. #2

    Join Date
    Apr 2009
    Location
    London
    Posts
    60
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Quote Originally Posted by glennda View Post
    Just trying to setup a reg ex to modify headers in Zimbra - can anybody see anything wrong with this?

    thanks in advance!

    Code:
    /^Received: from zimbra\-mail1\.domain\.co\.uk .+(by zimbra\-mail1\.domain\.co\.uk .+) / REPLACE Received: $1
    I'll bite, though I don't use Zimbra and I'm not even sure if this RE usage is within Zimbra.

    There is a space after the final ".uk" in the bracketed part of the match (i.e. what you re-use as $1.) Maybe this isn't always there in your input. Also, the final ".+)" in the bracketed match means "match at least one further character, or more." It may well be that you don't know how may characters follow ".uk", or even ".uk[SPACE]" and that sometimes, or always, there are none at all. If you replace ".+" with ".*", then, if this is like the RE systems I have experienced, this will work and mean "zero or more characters."

    I hope this helped.

  3. #3

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351
    Hiya,

    Thanks for your response - the .+ was to replace further stuff after (the IP below) - I beleive its possible to use Regex with zimbra (I found it on there help site).

    Basicly I will post what I am trying to replace and it might make more sense - Current zimbra Header
    Received: from zimbra-mail1.domain.co.uk (zimbra-mail1.domain.co.uk
    [192.168.222.23]) by zimbra-mail1.domain.co.uk (Postfix) with ESMTP id
    which shows the internal IP address which i don't want! I would rather it removes this or simply just posts

    Received: zimbra-mail1.domain.co.uk (Postfix) with ESMTP id

    Make sense?

  4. #4

    Join Date
    Apr 2009
    Location
    London
    Posts
    60
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0
    TBH I wouldn't worry about your internal IP address - it won't be of any interest to anybody outside your own network. If you would still like to remove it, you could try something like this:

    match on: /(.*)[1-9]+\.[1-9]+\.[1-9]+\.[1-9]+(.*)/
    replace with: /$1$2/

    Obviously the "/" characters are simply to delineate my regexps: they may not be needed in your application.

  5. #5

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351
    its not me that whats to remove it!! At first we thought it was that we had configured it wrong but later can see its a Zimbra "Feature"!!

  6. #6

    Join Date
    Apr 2009
    Location
    London
    Posts
    60
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0
    It's not really a "Zimbra feature." All Mail Transfer Agents (MTA) add lines like these. The intention is that email should be traceable, and to help troubleshooting. Each hop will normally add another line looking somewhat like the one that you want to edit. This collection of "Received:" lines ("timestamps," or "trace fields" in the standards literature (rfc2821)) is invaluable when trouble hits, though it is important to understand that they can be forged along the way. One important use of them is to stop email forwarding loops: every MTA scans incoming messages for its own timestamp - if it finds it, then there is a forwarding loop.

  7. #7

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351
    I know each MTA does that - a full header from a Zimbra server has muntiple mentions of itself passing to itself as it goes through various stages before passing externally - one of them being the one which publishes the internal IP rather then an External one - it does later on pass the external IP when it routes to the final destination.

    For example this is the Zimbra Header parts

    Received: from zimbra-mail1.mydomain.com ([88.96.72.45]) by
    inbound9.messagestream.com with MessageStream Intelligent Transport Agent ;
    Thu, 3 May 2012 19:03:36 +0100
    Received: from localhost (localhost [127.0.0.1]) by
    zimbra-mail1.mydomain.com (Postfix) with ESMTP id 2FA781A3E45 for
    <glennda@domain.com>; Thu, 3 May 2012 19:03:50 +0100 (BST)
    X-Virus-Scanned: amavisd-new at zimbra-mail1.mydomain.com
    Received: from zimbra-mail1.mydomain.com ([127.0.0.1]) by localhost
    (zimbra-mail1.mydomain.com [127.0.0.1]) (amavisd-new, port 10024) with
    ESMTP id pqpY1guLNHsQ for <glennda@domain.com>; Thu, 3 May 2012 19:03:49
    +0100 (BST)
    Received: from zimbra-mail1.mydomain.com (zimbra-mail1.mydomain.com
    [192.168.222.23]) by zimbra-mail1.mydomain.com (Postfix) with ESMTP id
    8FC571A3E34 for <glennda@domain.com>; Thu, 3 May 2012 19:03:48 +0100 (BST)
    Date: Thu, 3 May 2012 19:03:47 +0100
    From: user glennda <zimbra@domain.com>

  8. #8

    sonofsanta's Avatar
    Join Date
    Dec 2009
    Location
    Lincolnshire, UK
    Posts
    5,375
    Thank Post
    957
    Thanked 1,630 Times in 1,103 Posts
    Blog Entries
    47
    Rep Power
    711
    Useful link: Regex Tester Online

  9. #9

    Join Date
    Apr 2009
    Location
    London
    Posts
    60
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Surely it's inevitable that you will get the internal IP there, because that's the address the other internal server received it from, inside your own network? The external IP only appears once the message leaves your immediate network.

    Frankly, there is absolutely no problem revealing the internal IP address of one of your servers. It's meaningless to anyone else.

  10. #10

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351
    But its a single server and doesn't forward to any other hosts (direct out) its when it passes it from process to process internally within itself but uses dns to lookup its internally valid FQDN and then routes it to itself (going out and in so putting a duff dns doesn't work) - whereas exchange doesn't it just processes it and sends
    Last edited by glennda; 4th May 2012 at 05:15 PM.

  11. #11

    Join Date
    Apr 2009
    Location
    London
    Posts
    60
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0
    That's simply a question of how Zimbra has been put together. The processing steps are done by separate processes, instead of threads, which is probably what Exchange does. Exchange is monolithic and sometimes suffers as a result. Linux programs are usually more loosely-coupled than Windows programs, which can often be beneficial, especially when it comes to understanding what is going on. It really doesn't matter how many Received: lines Zimbra adds: messages crossing the internet can often acquire thirty or more these days.

  12. #12

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,821
    Thank Post
    272
    Thanked 1,140 Times in 1,036 Posts
    Rep Power
    351
    Quote Originally Posted by Eric View Post
    That's simply a question of how Zimbra has been put together. The processing steps are done by separate processes, instead of threads, which is probably what Exchange does. Exchange is monolithic and sometimes suffers as a result. Linux programs are usually more loosely-coupled than Windows programs, which can often be beneficial, especially when it comes to understanding what is going on. It really doesn't matter how many Received: lines Zimbra adds: messages crossing the internet can often acquire thirty or more these days.
    Yeah i know - its why i said it was a zimbra "feature" (sarcastically) im not worried by the number of headers just would look neater without an internal IP.



SHARE:
+ Post New Thread

Similar Threads

  1. outlook express - help needed
    By sue47 in forum Office Software
    Replies: 0
    Last Post: 12th July 2010, 12:27 PM
  2. Outlook Express - Help!
    By TechSupp in forum Windows
    Replies: 2
    Last Post: 17th September 2009, 12:25 AM
  3. SmoothWall regular expression problem
    By sjatkn in forum Internet Related/Filtering/Firewall
    Replies: 1
    Last Post: 24th June 2009, 10:30 PM
  4. Regular Expression (I think)
    By danIT in forum Coding
    Replies: 4
    Last Post: 15th April 2009, 01:40 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •