Luke Siemaszko

Q: Yosemite postfix aliases - problems

I have always used postfix aliases in earlier versions of OS X server with no problems

 

Having moved to Yoesmite seems problematic....

 

I have learned that by default they are not enabled. and so I have uncommented the following lines to main.cf in /Library/Server/Mail/Config/postfix

     local_recipient_maps = proxy:unix:passwd.byname $alias_maps

     alias_database = hash:/etc/aliases

     alias_maps = hash:/etc/aliases

 

And I have also learned that the install includes both the standard postfix and Apple-modified versions of executables (which came as a bit of a surprise!!)

So after editing main.cf and aliases I have done:

    newaliases

     postmap -c /Library/Server/Mail/Config/postfix /Library/Server/Mail/Config/postfix/access

     postfix -c /Library/Server/Mail/Config/postfix reload

 

,,,,but no joy.  The client is unable to send the message, so presumably the server is rejecting the (aliased) user.

 

Annoyingly I did have it working briefly but managed to break it again.

 

I'd be very grateful for any advice, thanks

Posted on Apr 5, 2016 1:29 PM

Close

Q: Yosemite postfix aliases - problems

  • All replies
  • Helpful answers

  • by pterobyte,

    pterobyte pterobyte Apr 6, 2016 7:19 AM in response to Luke Siemaszko
    Level 6 (11,101 points)
    Servers Enterprise
    Apr 6, 2016 7:19 AM in response to Luke Siemaszko

    Are you sure you meant:

    /Library/Server/Mail/Config/postfix/access

    and not

    /Library/Server/Mail/Config/postfix/aliases

     

    In any case, you need to use postalias and not postmap for the local aliases

    for example:

    sudo newaliases

    sudo postalias aliases

    sudo postfix reload

     

    postmap is used for the virtual aliases inside for example /Library/Server/Mail/Config/postfix/virtual_users

     

    To avoid having to indicate the path each time, you can add

    Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Con tents/ServerRoot/usr/sbin

    to your PATH variable.

    See here:

    https://topicdesk.com/faqs/why-do-postconf-n-and-postfix-reload-produce-unexpect ed-output-on-os-x-server-5/

     

    Also, make sure you put your aliases file into /Library/Server/Mail/Config/postfix and not /etc for consistency

     

    HTH,

    Alex

  • by Luke Siemaszko,

    Luke Siemaszko Luke Siemaszko Apr 6, 2016 10:56 AM in response to pterobyte
    Level 1 (49 points)
    Servers Enterprise
    Apr 6, 2016 10:56 AM in response to pterobyte

    Thanks Alex that was very helpful.  I was making stupid mistakes, staying too late at night and copying other peoples' work withiurt reading carefully enough!

     

    But I still don't have a working solution :-(

     

    To recap:

     

    My aliases and main.cf files are in /Library/Server/mail/Config/postfix

     

    I am running all commands from /Applications/Server.app/Contents/ServerRoot/usr/sbin

    or /Applications/Server.app/Contents/ServerRoot/usr/bin

     

    In  main.cf I have

         local_recipient_maps = proxy:unix:passwd.byname $alias_maps

        alias_database = hash:/Library/Server/Mail/Config/postfix/aliases

        alias_maps = hash:/Library/Server/Mail/Config/postfix/aliases

     

     

    and I have executed the following commands, I've left the long paths in for the sake of clarity:

       sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/newaliases

       sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/postalias /Library/Server/Mail/Config/postfix/aliases

       sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/postfix reload

     

    I can do a postmap -q on one of my aliases it it retuns a correct result, so I think that tells me that the aliases.db is correct, is that right?

     

    There are no relevant error messages in the smtp log

     

    I can't see what is wrong....but still I am unable to send an email to an address which is an alas

     

    I'd be very grateful for any advice

     

    also, how do I increase the logging from postfix?? hopefully if I can get it to tell me whyit is rejecting the mail that might help

     

    Many thanks

     

    Luke

  • by Luke Siemaszko,

    Luke Siemaszko Luke Siemaszko Apr 6, 2016 11:47 AM in response to Luke Siemaszko
    Level 1 (49 points)
    Servers Enterprise
    Apr 6, 2016 11:47 AM in response to Luke Siemaszko

    A bit more information.  I increased the log level, and the error in mail.log is:

     

         Recipient address rejected: User unknown in virtual alias table

     

    I think the clue is in the word "virtual" - I'm not interested in the virtual aliases, rather the non-virtual ones in aliases

     

    does this help direct anyopn to a solution please?

     

    many thanks

     

    Luke

  • by Linc Davis,Solvedanswer

    Linc Davis Linc Davis Apr 7, 2016 1:40 AM in response to Luke Siemaszko
    Level 10 (207,941 points)
    Applications
    Apr 7, 2016 1:40 AM in response to Luke Siemaszko

    You have to specify the path to the configuration directory in all those commands. Otherwise you're modifying the wrong files.

  • by Luke Siemaszko,

    Luke Siemaszko Luke Siemaszko Apr 7, 2016 1:47 AM in response to Linc Davis
    Level 1 (49 points)
    Servers Enterprise
    Apr 7, 2016 1:47 AM in response to Linc Davis

    Thanks but that that wasn't it - same result,

     

    I wonder if aliases simply aren't supported in 10.10?

     

    CAN ANYONE PLEASE TELL ME IF THEY ARE SUCCESSFULLY USING POSTFIX ALIASES ON 10.10 SERVER?

     

    I am beginning to suspect that maybe Apple have implemented virtual user maps in place of aliases - so I'd like to know if anyone out there is successfully using simple aliases

     

    Thanks

     

    Luke

  • by pterobyte,

    pterobyte pterobyte Apr 7, 2016 1:55 AM in response to Linc Davis
    Level 6 (11,101 points)
    Servers Enterprise
    Apr 7, 2016 1:55 AM in response to Linc Davis

    As long as the binaries inside  /Applications/Server.app/Contents/ServerRoot/usr/... are used (as shown by Luke), specifying the path is not necessary and not the solution.

  • by pterobyte,

    pterobyte pterobyte Apr 7, 2016 2:00 AM in response to Luke Siemaszko
    Level 6 (11,101 points)
    Servers Enterprise
    Apr 7, 2016 2:00 AM in response to Luke Siemaszko

    Luke,

     

    I am using local aliases without issues. That said, Apple's recent implementation of multiple domains is based on virtual domains. Thus, local aliases will only work for local domains (the ones listed in mydestination inside main.cf). You also need to make sure that none of the local aliases you intend to use, exist as a user or alias in WGM/Server.app as they take precedence.

     

    HTH,

    Alex

  • by Luke Siemaszko,

    Luke Siemaszko Luke Siemaszko Apr 7, 2016 2:23 AM in response to pterobyte
    Level 1 (49 points)
    Servers Enterprise
    Apr 7, 2016 2:23 AM in response to pterobyte

    Alex

     

    thanks for that.  So at least I know that they *should* work.

    I understand your comment about virtual users crated in the GUI, and that's not the problem.

    My next thought was, I wonder if you can have virtual users, or aliases, but not both.

    Are you able to answer that?  You have aliases working, do you also have virtual users?

     

    Thanks

     

    Luke

  • by pterobyte,

    pterobyte pterobyte Apr 7, 2016 2:27 AM in response to Luke Siemaszko
    Level 6 (11,101 points)
    Servers Enterprise
    Apr 7, 2016 2:27 AM in response to Luke Siemaszko

    Yes, I have one local domain and a dozen virtual domains. Check all config files related to virtual domains inside /Library/Server/Mail/Config/postfix to make sure your local domain has not ended up in there in one way or another.

  • by pterobyte,

    pterobyte pterobyte Apr 7, 2016 3:19 AM in response to Luke Siemaszko
    Level 6 (11,101 points)
    Servers Enterprise
    Apr 7, 2016 3:19 AM in response to Luke Siemaszko

    P.S. Any chance you are trying to alias "root"? This won't work as expected from the outside, but should work when sent locally.

  • by Linc Davis,

    Linc Davis Linc Davis Apr 7, 2016 10:01 AM in response to Luke Siemaszko
    Level 10 (207,941 points)
    Applications
    Apr 7, 2016 10:01 AM in response to Luke Siemaszko

    It works for me, and I don't remember having to make any changes to main.cf or otherwise twist myself into a pretzel to get it to work. The required alias_maps directive should already be present:

     

         alias_maps = hash:$config_directory/aliases

     

    where $config_directory refers to the Server postfix directory, not the one in /etc.


    All I had to do was edit the file aliases in that directory; e.g.


         root: me


    and then hash the file.