Results 1 to 6 of 6

Thread: Postfix help

  1. #1
    Join Date
    21st October 2002 - 11:00
    Bike
    CharlesidealOB
    Location
    Auckland
    Posts
    1,950
    Blog Entries
    10

    Question Postfix help

    I need to configure postfix on my test server to only allow sending to one email address, mine. All other emails should be dropped. I want to stop the test server sending out notification emails while I do testing on KB.

  2. #2
    Join Date
    3rd September 2009 - 14:30
    Bike
    zx12
    Location
    Auckland
    Posts
    511
    If your email is registered to your own domain spankme@spankers.net (or whatever) you could always do something like firewall off all tcp/25 traffic except for that domain. You'd get heaps of rejection messages in the log for all other users but it'd allow you to do your testing.

    iptables -A OUTPUT -p tcp --dport 25 ! -d spankers.net -j REJECT

    I'm having a look through postfix's main.cf and I can't see anything obvious and easy like how you want. You could set the mail server up to accept mail for all domains (and fill it with the output of all KBer email addresses using a script to extract data) which would prevent emails going out on the wire. The relay_domains directive looks like it might do something similar but may only act on domains and not individual email addresses. There's also address rewriting and address redirection.

    I've gotta run now but will take another look after lunch if you'd like.

    Cheers

  3. #3
    Join Date
    30th October 2010 - 02:21
    Bike
    '03 DR650, '07 Scorpio
    Location
    Christchurch
    Posts
    234
    It's been quite some time since I've used Postfix, but there is an easy but inelegant (and possibly unworkable, given the likely size of the userdb) solution to your problem - in /etc/postfix/recipient, " REJECT" for each email address.. But I'd look into syntax and global settings if I was you - I would have thought it'd be possible to set it to reject on default, then add your testing addresses with ALLOW instead.

  4. #4
    Join Date
    3rd September 2009 - 14:30
    Bike
    zx12
    Location
    Auckland
    Posts
    511
    As it's your test system you could just go and set every users email to null except for your own. It'd be just some simple SQL.

  5. #5
    Join Date
    13th November 2006 - 22:22
    Bike
    Suzuki Marauder VZ800
    Location
    Auckland
    Posts
    616
    I'd try smtpd_sender_restrictions, with check_sender_access...

    Or just make it deliver to a local mail relay that filers on address (write a quick one in perl/python etc). I did this once for a tricky rewriting problem, would have been easier with postfix, but not available to me then.
    Redefining slow since 2006...

  6. #6
    Join Date
    5th April 2006 - 09:52
    Bike
    2001 GSX1200
    Location
    Wellington
    Posts
    1,090
    We have pretty much that set up on some of our dev boxes at work.

    /etc/postfix/recipient_canonical:

    Code:
    # everything that isn't to an address ending with foo.bar.nz
    # possibly with some exceptions
    /^real@example\.com$/   real@example.com
    /.*@(?!.*foo.bar.nz)/    catchall@my.isp
    /etc/postfix/main.cf:
    Code:
    ...
    recipient_canonical_maps = pcre:/etc/postfix/recipient_canonical
    ...
    Works pretty well - real@example.com gets through; everything to *@*foo.bar.nz gets through; everything else goes to the catchall.

    Copied (with mods) straight off the server; hopefully no typos.
    Obviously any map type can be used as long as you can match what you want.

    Richard
    Last edited by rwh; 21st February 2011 at 23:55. Reason: change real 'fake' address

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
  •