1

Topic: Pop-before-smtp

Hi again,
I'm stuck with pop-before-smtp configuration. I have found threads in this forum where this topic was discussed but with no final solution.
I really need popbeforesmtp because of historic reasons. I have working pop-before-smtp.pl, it's creating records in a hash database and I'm getting records from the hash db with pop-before-smtp --list command. I hope so far everything's alright.
Problem arose when I tried to send an email. I'm still getting "relay denied".
I tweaked postfix/main.cf and I have set it like this:
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, check_client_access hash:/var/lib/pop-before-smtp/hosts, reject_unauth_destination

Could you please give me a hint?
Thanks a lot in advance.


==== Required information ====
- iRedMail version: 0.8.1
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): Mysql
- Linux/BSD distribution name and version: Debian 6.0.5
- Related log if you're reporting an issue:
Aug 22 22:34:24 smtp postfix/smtpd[334]: NOQUEUE: reject: RCPT from unknown[1xx.2xx.2xx.9x]: 554 5.7.1 <another@computer.com>: Relay access denied; from=<user@myserver.com> to=<another@computer.net> proto=ESMTP helo=<[127.0.0.1]>
====

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Pop-before-smtp

Did you try to place "permit_sasl_authenticated" after check_client_access like below?

smtpd_sender_restrictions =
    permit_mynetworks,
    check_client_access hash:/var/lib/pop-before-smtp/hosts,
    permit_sasl_authenticated,
    reject_unauth_destination

3

Re: Pop-before-smtp

Yes, I tried this but it did not work either.
Furthermore, I switched on verbose logging in Postfix. This is the result:

Aug 23 10:31:27 smtp postfix/smtpd[2984]: check_table_result: inet:127.0.0.1:7777 DUNNO policy query
Aug 23 10:31:27 smtp postfix/smtpd[2984]: generic_checks: name=check_policy_service status=0
Aug 23 10:31:27 smtp postfix/smtpd[2984]: generic_checks: name=permit_mynetworks
Aug 23 10:31:27 smtp postfix/smtpd[2984]: permit_mynetworks: unknown 1xx.2xx.2xx.9x
Aug 23 10:31:27 smtp postfix/smtpd[2984]: match_hostname: unknown ~? 127.0.0.0/8
Aug 23 10:31:27 smtp postfix/smtpd[2984]: match_hostaddr: 1xx.2xx.2xx.9x ~? 127.0.0.0/8
Aug 23 10:31:27 smtp postfix/smtpd[2984]: match_list_match: unknown: no match
Aug 23 10:31:27 smtp postfix/smtpd[2984]: match_list_match: 1xx.2xx.2xx.9x: no match
Aug 23 10:31:27 smtp postfix/smtpd[2984]: generic_checks: name=permit_mynetworks status=0
Aug 23 10:31:27 smtp postfix/smtpd[2984]: generic_checks: name=permit_sasl_authenticated
Aug 23 10:31:27 smtp postfix/smtpd[2984]: generic_checks: name=permit_sasl_authenticated status=0
Aug 23 10:31:27 smtp postfix/smtpd[2984]: generic_checks: name=reject_unauth_destination
Aug 23 10:31:27 smtp postfix/smtpd[2984]: reject_unauth_destination: other@server.net
Aug 23 10:31:27 smtp postfix/smtpd[2984]: permit_auth_destination: other@server.net
Aug 23 10:31:27 smtp postfix/smtpd[2984]: ctable_locate: leave existing entry key other@server.net
Aug 23 10:31:27 smtp postfix/smtpd[2984]: NOQUEUE: reject: RCPT from unknown[1xx.2xx.2xx.9x]: 554 5.7.1 <jan@vondrak.net>: Relay access denied; from=<my@server.com> to=<other@server.net> proto=ESMTP helo=<[127.0.0.1]>

But I could not see access to the check_client_access hash:/var/lib/pop-before-smtp/hosts.
I am not usre if everything is allright with my configuration.
Is it necessary to configure some other file then just main.cf and smtpd_sender_restrictions in it?

Thanks again.

4

Re: Pop-before-smtp

Show your "postconf -n" here please.

5

Re: Pop-before-smtp

Here it is:

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
append_dot_mydomain = no
biff = no
bounce_queue_lifetime = 1d
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
delay_warning_time = 0h
disable_vrfy_command = yes
enable_original_recipient = no
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 0
maximal_backoff_time = 4000s
maximal_queue_lifetime = 1d
message_size_limit = 15728640
minimal_backoff_time = 300s
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
mydomain = server.com
myhostname = smtp.server.com
mynetworks = 127.0.0.0/8
mynetworks_style = subnet
myorigin = smtp.server.com
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions
queue_run_delay = 300s
readme_directory = no
recipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
recipient_delimiter = +
relay_domains = $mydestination, proxy:mysql:/etc/postfix/mysql/relay_domains.cf
relayhost =
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
smtp_data_init_timeout = 240s
smtp_data_xfer_timeout = 600s
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_enforce_tls = no
smtpd_helo_required = no
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_policy_service inet:127.0.0.1:10031
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_path = ./dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf
smtpd_sender_restrictions = permit_mynetworks, check_client_access hash:/var/lib/pop-before-smtp/hosts, permit_sasl_authenticated, reject_unauth_destination
smtpd_tls_CAfile = /etc/ssl/certs/iRedMail_CA.pem
smtpd_tls_cert_file = /etc/ssl/certs/iRedMail_CA.pem
smtpd_tls_key_file = /etc/ssl/private/iRedMail.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
transport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf, proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/catchall_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf
virtual_gid_maps = static:1002
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
virtual_minimum_uid = 1002
virtual_transport = dovecot
virtual_uid_maps = static:1002

====END====

Thank you.

6

Re: Pop-before-smtp

No idea. sad

What's in /var/lib/pop-before-smtp/hosts?

7

Re: Pop-before-smtp

Here's another reference, maybe it's helpful:
http://wiki.dovecot.org/HowTo/PopBSMTPAndDovecot

8

Re: Pop-before-smtp

I solved it.
There was missing entry in the section smtpd_recipient_restrictions.
I just added check_client_access hash:/var/lib/pop-before-smtp/hosts before permit_sasl_authenticated as it is in the smtpd_sender_restrictions and that's probably it.

9

Re: Pop-before-smtp

Could you share your working "postconf -n" here? It helps others smile

10

Re: Pop-before-smtp

postconf -n (working pop-before-smtp):

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
append_dot_mydomain = no
biff = no
bounce_queue_lifetime = 1d
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
delay_warning_time = 0h
disable_vrfy_command = yes
enable_original_recipient = no
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 0
maximal_backoff_time = 4000s
maximal_queue_lifetime = 1d
message_size_limit = 15728640
minimal_backoff_time = 300s
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
mydomain = server.net
myhostname = smtp.server.net
mynetworks = 127.0.0.0/8
mynetworks_style = subnet
myorigin = smtp.server.net
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions
queue_run_delay = 300s
readme_directory = no
recipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
recipient_delimiter = +
relay_domains = $mydestination, proxy:mysql:/etc/postfix/mysql/relay_domains.cf
relayhost =
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
smtp_data_init_timeout = 240s
smtp_data_xfer_timeout = 600s
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_enforce_tls = no
smtpd_helo_required = no
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, permit_mynetworks, check_client_access hash:/var/lib/pop-before-smtp/hosts, permit_sasl_authenticated, reject_unauth_destination, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_policy_service inet:127.0.0.1:10031
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_path = ./dovecot-auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf
smtpd_sender_restrictions = permit_mynetworks, check_client_access hash:/var/lib/pop-before-smtp/hosts, permit_sasl_authenticated, reject_unauth_destination
smtpd_tls_CAfile = /etc/ssl/certs/iRedMail_CA.pem
smtpd_tls_cert_file = /etc/ssl/certs/iRedMail_CA.pem
smtpd_tls_key_file = /etc/ssl/private/iRedMail.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
transport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf, proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/catchall_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf
virtual_gid_maps = static:1002
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
virtual_minimum_uid = 1002
virtual_transport = dovecot
virtual_uid_maps = static:1002

11

Re: Pop-before-smtp

Thanks for your sharing. smile