Loading ...
Sorry, an error occurred while loading the content.
 

relay_recipient_maps not working

Expand Messages
  • Matthew Ceroni
    I am trying to setup the relay_recipient_maps option. I created my LDAP file (/etc/postfix/ldap-relay_recipients.cf) and tested it using postmap -q. When a
    Message 1 of 7 , Feb 12, 2013
      I am trying to setup the relay_recipient_maps option.

      I created my LDAP file (/etc/postfix/ldap-relay_recipients.cf) and tested it using postmap -q. When a valid user is supplied it returns 0 and when not it returns 1.

      However when I send an email (testing using the local command tool mail) it doesn't seem to matter and the message is sent to the relay anyways.

      To further troubleshoot I tried just using a hash map instead with one line in it. Same issue.

      I then tried to limit local users (local_recipient_maps) using the same LDAP file or set it explicitly to $alias_maps and then tried sending email (again using mail) to a user not in the aliases DB yet it still got sent to the local mailbox for that user.

      [root@mai01-smtp-01v mail]# postconf -n
      alias_database = hash:/etc/aliases
      alias_maps = hash:/etc/aliases
      canonical_maps = hash:/etc/postfix/canonical
      command_directory = /usr/sbin
      config_directory = /etc/postfix
      daemon_directory = /usr/libexec/postfix
      data_directory = /var/lib/postfix
      debug_peer_level = 2
      html_directory = no
      inet_interfaces = all
      inet_protocols = all
      mail_owner = postfix
      mailq_path = /usr/bin/mailq.postfix
      manpage_directory = /usr/share/man
      mydestination = $myhostname, localhost.$mydomain, localhost
      mydomain = mydomain.com
      myhostname = smtp03.mydomain.com
      myorigin = $mydomain
      newaliases_path = /usr/bin/newaliases.postfix
      notify_classes = bounce, delay, policy, protocol, resource, software
      proxy_interfaces = 173.228.xx.xx
      queue_directory = /var/spool/postfix
      readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
      relay_recipient_maps = ldap:/etc/postfix/ldap-relay_recipients.cf
      relayhost = [192.168.12.213]
      sample_directory = /usr/share/doc/postfix-2.6.6/samples
      sendmail_path = /usr/sbin/sendmail.postfix
      setgid_group = postdrop
      soft_bounce = yes
      unknown_local_recipient_reject_code = 550
      virtual_alias_domains = domain2.org

      And the maillog

      Feb 13 08:32:05 mai01-smtp-01v postfix/qmgr[2728]: 20486809: from=<root@...>, size=443, nrcpt=1 (queue active)
      Feb 13 08:32:05 mai01-smtp-01v postfix/smtp[2735]: 20486809: to=<matthew2.ceroni@...>, relay=192.168.12.213[192.168.12.213]:25, delay=0.25, delays=0.03/0.01/0.03/0.18, dsn=2.6.0, status=sent (250 2.6.0 <20130213083205.20486809@...> [InternalId=361531] Queued mail for delivery)
      Feb 13 08:32:05 mai01-smtp-01v postfix/qmgr[2728]: 20486809: removed

      The user matthew2.ceroni@... does not exist, yet it still got sent to the relay.

      Thanks
    • Wietse Venema
      ... As documented this is used in the SMTP daemon to reject mail for non-existent recipients. ... Local submission does not arrive via the SMTP daemon. Also, I
      Message 2 of 7 , Feb 12, 2013
        Matthew Ceroni:
        > I am trying to setup the relay_recipient_maps option.
        >
        > I created my LDAP file (/etc/postfix/ldap-relay_recipients.cf) and tested
        > it using postmap -q. When a valid user is supplied it returns 0 and when
        > not it returns 1.

        As documented this is used in the SMTP daemon to reject mail for
        non-existent recipients.

        > However when I send an email (testing using the local command tool mail) it
        > doesn't seem to matter and the message is sent to the relay anyways.

        Local submission does not arrive via the SMTP daemon. Also, I wonder
        what you want, Postfix returning an error status when you use the
        "mail" command? How should such mail be returned to sender if it
        never makes it into the mail system in the first place?

        Wietse
      • Matthew Ceroni
        I thought that was the issue, but when I try submitting via SMTP (using telnet as my test) it still doesn t work. I supply an invalid email and it still relays
        Message 3 of 7 , Feb 12, 2013
          I thought that was the issue, but when I try submitting via SMTP (using telnet as my test) it still doesn't work. I supply an invalid email and it still relays it to the relay server. 

          When I run postmap -q to test (with debug turned on) it logs everything in /var/log/maillog. But I don't see that same debug output when testing through telnet to the SMTP port. 




          On Tue, Feb 12, 2013 at 5:17 PM, Wietse Venema <wietse@...> wrote:
          Matthew Ceroni:
          > I am trying to setup the relay_recipient_maps option.
          >
          > I created my LDAP file (/etc/postfix/ldap-relay_recipients.cf) and tested
          > it using postmap -q. When a valid user is supplied it returns 0 and when
          > not it returns 1.

          As documented this is used in the SMTP daemon to reject mail for
          non-existent recipients.

          > However when I send an email (testing using the local command tool mail) it
          > doesn't seem to matter and the message is sent to the relay anyways.

          Local submission does not arrive via the SMTP daemon. Also, I wonder
          what you want, Postfix returning an error status when you use the
          "mail" command? How should such mail be returned to sender if it
          never makes it into the mail system in the first place?

                  Wietse

        • Matthew Ceroni
          Well now I am even more confused. So I was doing some further testing and was getting a 454 relay access denied when trying to send mail through postfix to
          Message 4 of 7 , Feb 12, 2013
            Well now I am even more confused.

            So I was doing some further testing and was getting a 454 relay access denied when trying to send mail through postfix to user@.... In my postfix config mydomain was set to mydomain and mydestination was set to $myhostname, localhost.$mydomain and localhost.

            The default setting for relay_domains is mydestination and subdomains thereof. So since mydestination contains $myhostname which is set to hostname.$mydomain  mydomain should be in that list for relay_domains. But I had to explicitly add mydomain to relay_domains. Once I did that it honored the relay_recipient_maps. 

            I guess my understanding of the default value relay_domains takes is incorrect.

            Thanks


            On Tue, Feb 12, 2013 at 9:41 PM, Matthew Ceroni <matthewceroni@...> wrote:
            I thought that was the issue, but when I try submitting via SMTP (using telnet as my test) it still doesn't work. I supply an invalid email and it still relays it to the relay server. 

            When I run postmap -q to test (with debug turned on) it logs everything in /var/log/maillog. But I don't see that same debug output when testing through telnet to the SMTP port. 




            On Tue, Feb 12, 2013 at 5:17 PM, Wietse Venema <wietse@...> wrote:
            Matthew Ceroni:
            > I am trying to setup the relay_recipient_maps option.
            >
            > I created my LDAP file (/etc/postfix/ldap-relay_recipients.cf) and tested
            > it using postmap -q. When a valid user is supplied it returns 0 and when
            > not it returns 1.

            As documented this is used in the SMTP daemon to reject mail for
            non-existent recipients.

            > However when I send an email (testing using the local command tool mail) it
            > doesn't seem to matter and the message is sent to the relay anyways.

            Local submission does not arrive via the SMTP daemon. Also, I wonder
            what you want, Postfix returning an error status when you use the
            "mail" command? How should such mail be returned to sender if it
            never makes it into the mail system in the first place?

                    Wietse


          Your message has been successfully submitted and would be delivered to recipients shortly.