LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-19-2014, 07:51 PM   #1
Pinkdog
LQ Newbie
 
Registered: Oct 2003
Posts: 25

Rep: Reputation: 15
Configuration help - Open relay ,Postfix,dovecot virtual mail server


Hello all,

I have postfix configured and running, but its running as an open relay.

I believe i have narrowed it down to what it is but i need help to fix it.
Let me give you a gist of my setup.

ISP - > Netscreen firewall -> mapped public IP to internal IP mail server. The netscreen firewall acts as the gateway for LAN PC's and also the mail server.

When looking at logs i see this
Code:
Jul 18 15:14:50 mailsrvr amavis[17516]: (17516-13) Passed CLEAN, [192.168.1.90] [192.168.1.90] <user@example.com> -> <user@example2.com>, Message-ID: <CAO1B_7RrswzKDQ5cVhsZm-cbYR9vLZa0w-O5LWaUOP+_7yt6ww@example.com>, mail_id: LxfwSp87DHwG, Hits: -, size: 488350, queued_as: C7FAB1063AF9, 887 ms
Jul 18 15:14:50 mailsrvr postfix/smtp[18296]: 0D15A1062297: to=<user@example2.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=4.1, delays=3.2/0.02/0.01/0.89, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=17516-13, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as C7FAB1063AF9)
In my postfix main.cf i have
mynetworks = 127.0.0.0/8,192.168.1.0/24
I have permit_mynetworks in my config.

So the gateway of 192.168.1.90 falls into the mynetworks , so its allowed to pass thru, so i believe thats whats causing it to be an open relay mailserver.
When i take away 192.168.1.0/24 its no longer an open relay, but i can no longer receive any incoming emails. I get 554 5.7.1 Client host rejected: cannot find your hostname, [192.168.1.90]

I attached my main.cf below
Code:
smtpd_banner = $myhostname ESMTP
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings

# TLS parameters
#smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#smtpd_use_tls=yes
#smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
smtpd_tls_key_file=/etc/ssl/private/dovecot.pem
smtpd_tls_security_level = may
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
#smtp_tls_per_site = /etc/postfix/tls_per_site
smtpd_tls_CAfile = /etc/postfix/CAcert.pem

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = mailsrvr.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname
mydomain = example.com
#myorigin = $mydomain
mynetworks = 127.0.0.0/8,192.168.1.0/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
message_size_limit = 31457280
virtual_mailbox_limit = 31457280
recipient_delimiter = +
inet_interfaces = all
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes 
broken_sasl_auth_clients = yes
smtp_tls_per_site = hash:/etc/postfix/tls_per_site
show_user_unknown_table_name = no

sender_bcc_maps = hash:/etc/postfix/bcc_maps
recipient_bcc_maps = hash:/etc/postfix/bcc_maps

smtpd_helo_required = yes
strict_rfc821_envelopes = yes
smtpd_delay_reject = no
disable_vrfy_command = yes
unknown_address_reject_code  = 554
unknown_hostname_reject_code = 554
unknown_client_reject_code   = 554

header_checks = regexp:/etc/postfix/header_checks
body_checks = regexp:/etc/postfix/body_checks

smtpd_relay_restrictions = permit_mynetworks,
                           permit_sasl_authenticated,
                           reject_unauth_destination

smtpd_client_restrictions = permit_mynetworks,
                                reject_invalid_hostname,
                                reject_rbl_client b.barracudacentral.org,
                                reject_unknown_client,
                                permit

smtpd_helo_restrictions = permit_mynetworks,
                                check_helo_access hash:/etc/postfix/helo_client_exceptions,
                                permit_sasl_authenticated,
                                reject_unauth_pipelining,
                                reject_non_fqdn_helo_hostname,
                                reject_invalid_helo_hostname,
                                reject_non_fqdn_hostname,
                                reject_invalid_hostname,
                                warn_if_reject reject_unknown_hostname,
                                permit

smtpd_recipient_restrictions =  check_sender_access hash:/etc/postfix/access,
                                check_client_access hash:/etc/postfix/access,
                                check_client_access cidr:/etc/postfix/access2.cidr,
                                permit_sasl_authenticated,
                                reject_non_fqdn_recipient,
#                                reject_non_fqdn_hostname,
                                reject_invalid_hostname,
                                permit_mynetworks,
                                reject_unauth_pipelining,
                                reject_unknown_sender_domain,
                                reject_unknown_recipient_domain,
                                reject_unauth_destination,
                                reject_unknown_client,
                                permit

smtpd_sender_restrictions =  permit_mynetworks,
                                reject_non_fqdn_sender,
                                reject_unknown_sender_domain,
                                reject_unknown_address

smtpd_etrn_restrictions = permit_mynetworks,
                                reject

smtpd_data_restrictions = reject_unauth_pipelining,
                                reject_multi_recipient_bounce,
                                permit

content_filter = smtp-amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
Thank you!.

Last edited by Pinkdog; 07-19-2014 at 07:52 PM.
 
Old 07-23-2014, 08:56 PM   #2
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
Not sure you have your IP mapped right then or the firewall rules setup right. When the mail server gets an email to relay incoming emails should not appear to be originating from the netscreen, they should appear to originate from the original public IP. Is the netscreen acting as a relay itself in some way? What services are you running on the netscreen device?
 
Old 07-30-2014, 12:10 PM   #3
Pinkdog
LQ Newbie
 
Registered: Oct 2003
Posts: 25

Original Poster
Rep: Reputation: 15
I took a closer look at the netscreen config and i did map the IP wrong. There was a NAT option, i had it selected. I took it off and it works the way its supposed to now!.

Thank you!


Quote:
Originally Posted by scheidel21 View Post
Not sure you have your IP mapped right then or the firewall rules setup right. When the mail server gets an email to relay incoming emails should not appear to be originating from the netscreen, they should appear to originate from the original public IP. Is the netscreen acting as a relay itself in some way? What services are you running on the netscreen device?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
postfix+mysql+dovecot mail server thunderbird clinet configuration issue Vimuth Linux - Server 3 01-02-2013 12:39 AM
postfix+mysql+dovecot mail server thunderbird clinet configuration issue Vimuth Linux - Newbie 2 01-01-2013 04:17 AM
Postfix+Dovecot error : RELAY ACCESS DENIED when send mail out to Other domain simon.unix Linux - Networking 6 09-16-2009 10:54 AM
Setting up a mail server with Dovecot and/or Postfix with virtual domains Josh1billion Linux - Server 12 11-27-2008 02:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration