Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Postfix address rewriting

  • 22-02-2010 11:36AM
    #1
    Technology & Internet Moderators Posts: 28,842 Mod ✭✭✭✭


    This one has me scratching my head.

    We have a corporate network that uses RFC1918 addresses (10.x.x.x) for internal networking, and we have a DNS zone set up to map to those addresses. We also have a block of public addresses, and a separate DNS zone mapping those. For the sake of discussion, assume the public addresses have *.example.com DNS names and the private addresses have *.example.wan.

    I have a server running inside my corporate network, called owl.example.wan. It runs cronjobs from which I want to receive the output by email to my normal address, paul@example.com. So I'm trying to configure Postfix to send mail (a) to this addresses, and (b) from an address that's acceptable to my mail server.

    I thought (a) would be simple: just an entry in the /etc/aliases file:
    root:    paul@example.com
    
    - but that doesn't seem to work. It keeps trying to send mail to root@owl.example.wan.

    (b) is problematic also. Our smtp server - smtp.example.com - expects From: addresses to be well-formed, so mail with a source address of root@owl.example.wan, it gets bounced because example.wan isn't a real domain name outside our network.

    Can someone give me a clue where to start? Do I even need Postfix? Is there a simple way of having a cron job send mail to a real email address instead of root?

    Thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 3,721 ✭✭✭E39MSport


    Probably a combination of a few things.



    I would say there is no need for postfix. If this server is not acting as an MTA then there is no need to have it running the full blown MTA. For this purpose, a localised version of sendmail would do the job (i.e. one where it is only bound to its loopback address and not accessible from any outside system. Also, are you sure that the mail that you're seeing (to root@owl.example.wan) isn't the NDR from failing to send to paul@example.com ? By default NDRs will send to [EMAIL="root@localdomain"]root@localdomain[/EMAIL].



    1) Run "newaliases" (if you've not already) to update the /etc/aliases database.

    2) edit /etc/sendmail/submit.mc

    Add/uncomment the following features.

    FEATURE(`masquerade_envelope')

    FEATURE(`allmasquerade')
    MASQUERADE_AS(`example.com')




    The MASQUERADE stuff is where your problem is. You need to tell the mail client (in this case sendmail) that you want the domain to be re-written to something that is compliant.



    Also, if you have a "SMART" host that you want to send all email to (I guess this is smtp.example.com), add that in here too. Don't forget the square [] as they provide internal routing.



    define(`SMART_HOST',`[smtp.example.com]')dnl
    define(`LOCAL_RELAY', `[smtp.example.com]')dnl


    Save the file.



    Then



    3) edit /etc/mail/sendmail.mc

    Add this line: define(`SMART_HOST', `smtp.example.com')dnl

    Ensure this line is uncommented (remove the "dnl" if there is one): DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl



    4) Depending on version remake the .cf files. - "make -C /etc/mail" should do the trick.

    5) Restart sendmail "/etc/init.d/sendmail restart" (or service sendmail restart if it exists, etc).



Advertisement