Peter's Blog

Redefining the Impossible

Items filed under postfix


For a while now I have had many dependancy errors when trying to install packages on my ubuntu server at work. These all boiled down to the postfix package failing to configure. I decided to look into it.

Explicitly trying to configure the postfix package didn't work:

   1  pcw@rd-pcw2:~ $ sudo dpkg --configure postfix
   2  Password:
   3  Setting up postfix (2.1.5-9ubuntu3) ...
   4  
   5  Postfix configuration was untouched.  If you need to make changes, edit
   6  /etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
   7  values, see postconf(1).
   8  
   9  After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
  10  
  11  Running newaliases
  12   * Starting Postfix Mail Transport Agent...
  13   *stfix/postfix-script: fatal: the Postfix mail system is already running[fail]
  14  invoke-rc.d: initscript postfix, action "start" failed.
  15  dpkg: error processing postfix (--configure):
  16   subprocess post-installation script returned error exit status 1
  17  Errors were encountered while processing:
  18   postfix

The problem looks like it tried to start the postfix server but it was already running. Stupid thing. I stopped the postfix server explicitly:

sudo /etc/init.d/postfix stop

and tried again and this time it was successful.

Back into dselect, configure all pending packages and everything is happy.


Filed under: dselect linux postfix ubuntu


I put postfix on my linode for mail handling. The installation went smoothly enough, loading the ubuntu package and editing /etc/postfix/main.cf to set up the domain names to be accepted. However, I had trouble receiving mail from outside. Trying to telnet in on port 25 told me that the smtp daemon was not listening.

The solution to this was to edit the /etc/postfix/master.cf file and change the lines:

127.0.0.1:smtp inet n   -       -       -       -       smtpd
::1:smtp       inet n   -       -       -       -       smtpd

to

smtp      inet  n       -       -       -       -       smtpd

which tells it to listen to any connection to the smtp port, not just local connections.

According to this site I haven't put up another open relay. (note to self: publish open relay test, lie about results and build nice list of open relays to sell to spammers).


Filed under: email linode postfix ubuntu


Latest MTA to use under linux is postfix as this appears to be a ubuntu standard. I fancy trying something a bit lighter than exim and there doesn't appear to be a debian package for qmail and I can't be bothered to build it.

As this mail server is running on my little intranet box at work I need it to forward internal email to the company internal email server. If I email pcw@mycompany.com from the box the email gets bounced with "Name or service not known" because the DNS server configuration is screwed up and mycompany.com resolves to the internal file server, not the mail server.

Anyway, I worked out the postfix incantation to do this and it's not a pretty thing, it doesn't bode well for postfix ease of use:

  • Create/edit a file called /etc/postfix/transport
  • Add relay instruction along the lines of:
    mycompany.com        smtp:192.168.0.5
    
    or wherever you want to relay to.
  • execute the command
    sudo postmap /etc/postfix/transport
    
  • edit /etc/postfix/main.cf and add the following:
    relay_domains = $mydestination, mycompany.com
    transport_maps = hash:/etc/postfix/transport
    
  • execute the command
    sudo postfix reload
    
    to reload the configurations (or /etc/init.d/postfix restart).

This worked for me, from my server box I can email myself on internal email allowing me to get messages from servers etc.


Filed under: email linux postfix ubuntu

1 Comment