custom postfix configuration for local email

    • OMV 1.0

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • custom postfix configuration for local email

      Hi folks, I recently upgraded to 1.0 and have a question about the right way to change the postfix configuration in /etc/postfix/main.conf.

      I've configured Notifications correctly, and I have no problem getting emails from scheduled jobs in OpenMediaVault.

      My original problem was that after I installed denyhosts, I would get bounced emails like this one:

      Source Code

      1. Mail Delivery Subsystem <mailer-daemon@googlemail.com>2:45 PM (19 minutes ago)
      2. Reply
      3. to me
      4. Delivery to the following recipient failed permanently:
      5. root@localhost.localdomain
      6. Technical details of permanent failure:
      7. DNS Error: Address resolution of localhost.localdomain. failed: Domain name not found
      8. ----- Original message -----
      9. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
      10. d=gmail.com; s=20120113;
      11. h=from:to:subject:date:message-id;
      12. bh=wQDgfjf9T3qNXUSx1bxttRrml6SHdDUJU9w+lkSnYE0=;
      13. b=vmAjofieyuBnv8JTWhoKkkUKMATyRGW3MeBgHidN55moWOmZKZyN7snDPXLdSQjN46
      14. temlnnphLlQsscY5ReaxHO/1A7ommq2fAIftNSzKUedpzzcOoa5Ohip0EMVO45lA14yg
      15. AeH5y15Nsijd1OpyMgeWmu2ZMvXWSFfzEDRvVtIGx+yUIVN5kqvk0eVpVlc7Bw5dIBd5
      16. OVoLA9Rk0Vkk9f3bTVytVPT8wPfd+EqTdZYHmpdHatbH5ThSOEr63nYPwRIaEmAPx7Y9
      17. Gj+JBYDnovBLmuZTJSMk8L54pJ8RudLXXwGpIaiJ2L/xpzJr0t5RcEkspPcLIT2LFhpV
      18. RmeA==
      19. X-Received: by 10.70.41.231 with SMTP id i7mr9199559pdl.102.1423262724507;
      20. Fri, 06 Feb 2015 14:45:24 -0800 (PST)
      21. Return-Path: <firstname.lastname@gmail.com>
      22. Received: from omv.localdomain (<myIP>)
      23. by mx.google.com with ESMTPSA id iv1sm9023207pbc.87.2015.02.06.14.45.23
      24. for <root@localhost.localdomain>
      25. (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
      26. Fri, 06 Feb 2015 14:45:23 -0800 (PST)
      27. From: DenyHosts <firstname.lastname@gmail.com>
      28. X-Google-Original-From: DenyHosts <nobody@localhost.localdomain>
      29. Received: from omv.lan (localhost [127.0.0.1])
      30. by omv.localdomain (Postfix) with ESMTP id 67B7040085F
      31. for <root@localhost>; Fri, 6 Feb 2015 14:45:21 -0800 (PST)
      32. To: root@localhost.localdomain
      33. Subject: DenyHosts Report [omv.lan]
      34. Date: Fri, 06 Feb 2015 14:45:21 -0800
      35. Message-Id: <20150206224521.67B7040085F@omv.localdomain>
      36. Added the following hosts to /etc/hosts.deny:
      37. 72.46.157.64 (unknown)
      Display All


      I was able to solve the problem by adding the following line to /etc/postfix/main.cf:
      recipient_canonical_maps = regexp:/etc/postfix/recipient_canonical

      And creating /etc/postfix/recipient_canonical with:
      /.+/ firstname.lastname@gmail.com

      However, /etc/postfix/main.cf is overwritten any time I make configuration changes through the OMV user interface.

      The question is: Is there a way I can persist my change to /etc/postfix/main.cf so that it's not overwritten?

      The other solution is to configure denyhosts to send emails directly to a specific account instead of to "root@localhost", but I'd like to solve for the general case if I can.

      Any ideas?
    • I was looking for an answer to this question as well.
      I have made some tweaks to main.cf - and it's a little frustrating to have to remember to back those changes up, before making changes to parts of the webui-config.
      Atom 330 @ 1.6GHz, 4GB RAM
      2x3TB Data, 1x3TB Parity, SnapRAID + AUFS pool
      Latest OMV running on custom Debain Wheezy, 3.14 Backports kernel
    • I have the same problem with my main.cf
      here's what I do for this (not a fix but it's working)

      first make a copy of your main.cf

      cp /etc/postfix/main.cf /etc/postfix/main.cf.safe

      then edit your .bashrc file to add a new alias

      nano /root/.bashrc

      add the following line :

      alias fixmail='cp /etc/postfix/main.cf.safe /etc/postfix/main.cf;service postfix restart'

      now when you make changes in your OMV interface and it breaks your email just ssh your server as root and type : fixmail

      your mails are working again :)
    • The answer to your issue lies in /usr/share/openmediavault/mkconf/postfix.d/10main
      There are a lot of variables pulled from /etc/default/openmediavault there.
      The one you are interested in is OMV_POSTFIX_MAIN_SENDER_CANONICAL_MAPS

      Just add the following line to your /etc/default/openmediavault:

      OMV_POSTFIX_MAIN_SENDER_CANONICAL_MAPS="regexp:/etc/postfix/recipient_canonical"

      and regenerate OMV configs.