0

I am trying to setup google as mail relay but running into some troubles.

I get an error that

550-5.1.1 The email account that you tried to reach does not exist

My custom main in pfsense looks like this:

relayhost = [smtp-relay.gmail.com]:587

#Defining domain and hostname- Test
myhostname = vpn.example.com
mydomain = example.com
myorigin = example.com

# Add TLS
#
# SMTPD
#
smtpd_tls_cert_file = /etc/postfix/cert.crt
smtpd_tls_key_file = /etc/postfix/cert.key
smtpd_tls_CAfile = /etc/ssl/cert.pem
smtpd_tls_security_level = may
# SMTP Client
smtp_tls_security_level = may
smtp_tls_CAfile = /etc/ssl/cert.pem
# SSL-Certificate - Generate logfile entries
#
smtpd_tls_received_header = yes
smtp_tls_loglevel = 1
smtpd_tls_loglevel = 1

When I try sendmail from pfsense server my log file says the following:

Aug 11 14:59:07 <host> postfix/smtp[49764]: > smtp-relay.gmail.com[173.194.220.28]:587: MAIL FROM:<> SIZE=3532
Aug 11 14:59:07 <host> postfix/smtp[49764]: > smtp-relay.gmail.com[173.194.220.28]:587: RCPT TO:<root@example.com>
Aug 11 14:59:07 <host> postfix/smtp[49764]: < smtp-relay.gmail.com[173.194.220.28]:587: 250 2.1.0 OK h7sm42095laf.0 - gsmtp
Aug 11 14:59:07 <host> postfix/smtp[49764]: smtp_stream_setup: maxtime=300 enable_deadline=0
Aug 11 14:59:07 <host> postfix/smtp[49764]: vstream_buf_get_ready: fd 14 got 274
Aug 11 14:59:07 <host> postfix/smtp[49764]: < smtp-relay.gmail.com[173.194.220.28]:587: 550-5.1.1 The email account that you tried to reach does not exist. Please try

I don't understand why the smtp header MAIL FROM: <> is empty and why RCPT says root@example.com instead of the one I tried sendmail to which was something like BM@example.com.

Here is my postconf -n when logged on the server:

access_map_defer_code = 451
access_map_reject_code = 554
config_directory = /usr/pbi/postfix-amd64/etc/postfix
debug_peer_level = 6
debug_peer_list = gmail.com
default_process_limit = 100
inet_interfaces = 10.1.2.254
inet_protocols = ipv4
local_recipient_maps =
message_size_limit = 10240000
mydestination =
mydomain = example.com
myhostname = vpn.example.com
mynetworks = /usr/pbi/postfix-amd64/etc/postfix/mynetwork_table
mynetworks_style = host
myorigin = example.com
relay_domains =
relayhost = [smtp-relay.gmail.com]:587
smtp_tls_CAfile = /etc/ssl/cert.pem
smtp_tls_loglevel = 1
smtp_tls_security_level = may
smtpd_client_restrictions = permit_mynetworks, reject_unauth_destination, check_sender_access hash:/usr/pbi/postfix-amd64/etc/postfix/sender_access, check_client_access pcre:/usr/pbi/postfix-amd64/etc/postfix/cal_pcre, check_client_access cidr:/usr/pbi/postfix-amd64/etc/postfix/cal_cidr permit
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_sender_access hash:/usr/pbi/postfix-amd64/etc/postfix/sender_access, check_client_access pcre:/usr/pbi/postfix-amd64/etc/postfix/cal_pcre, check_client_access cidr:/usr/pbi/postfix-amd64/etc/postfix/cal_cidr, , permit
smtpd_sender_restrictions = reject_unknown_sender_domain, permit
smtpd_tls_CAfile = /etc/ssl/cert.pem
smtpd_tls_cert_file = /etc/postfix/cert.crt
smtpd_tls_key_file = /etc/postfix/cert.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
transport_maps = hash:/usr/pbi/postfix-amd64/etc/postfix/transport
unknown_client_reject_code = 550
unknown_hostname_reject_code = 550
unverified_recipient_reject_code = 550

1 Answers1

1

You are overriding local_recipient_maps and unset it:

local_recipient_maps =

The default value is:

local_recipient_maps = proxy:unix:passwd.byname $alias_maps

The first part manages the local users, see:

$ sudo postmap -q root proxy:unix:passwd.byname
root:x:0:0:root:/root:/bin/bash

Remove the line cited above to allow root local users recipient or add root to the virtual users (including virtual domains etc.)

sebix
  • 4,175
  • 2
  • 25
  • 45