LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-25-2008, 01:07 PM   #1
btaylor1988
Member
 
Registered: Nov 2005
Location: England
Distribution: CentOS, Fedora
Posts: 79

Rep: Reputation: 15
postfix, allow all access from outside to send mail


i cant seem to get my email client working from outside to send emails, ive heard it a security risk and best to use ssl.

not sure how to do either of these things, it would be nice to test if i could send emails externaly as a test.

postconf -n:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, address.com, address.com
mydomain = address.com
myhostname = mail.address.com
mynetworks = 192.168.26.0/24, 127.0.0.0/8
mynetworks_style = subnet
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net
soft_bounce = yes
unknown_local_recipient_reject_code = 550

also i can recive emails outside so i no that works
 
Old 08-25-2008, 01:36 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
What is the exact error you recieve? And no, don't open access to anyone, that would allow every spammer to use your server to send spam, viruses, etc. So don't, you share the internet, you don't own it and I don't want any spam or viruses sent to me.
 
Old 08-25-2008, 03:19 PM   #3
btaylor1988
Member
 
Registered: Nov 2005
Location: England
Distribution: CentOS, Fedora
Posts: 79

Original Poster
Rep: Reputation: 15
Error from thunderbird email client:

An error occurred while sending mail. the mail server responded: 4.7.1
<email@address.com>: Relay access denied. please check the message recipients and try again.


i mean is there a way to set single allowed address by any chance, so you could allow incoming connection to send mail out from the server from ip address ???.???.???.???.
 
Old 08-25-2008, 03:54 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
You need to read this: http://www.postfix.org/SMTPD_ACCESS_README.html

It talks about setting up relays, who's allowed, restricting others.
 
Old 08-25-2008, 10:09 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
You could add the IP of your remote client to mynetworks, or add a check_client_access to your smtpd_recipient_restrictions,
Code:
main.cf:
    smtpd_recipient_restrictions = 
        permit_mynetworks, 
        permit_sasl_authenticated,
        reject_unauth_destination,
        reject_rbl_client zen.spamhaus.org,
        reject_rbl_client bl.spamcop.net
you can add a client_access check:

Code:
main.cf:
    smtpd_recipient_restrictions = 
        permit_mynetworks, 
        permit_sasl_authenticated,
        check_client_access hash:/etc/postfix/client_checks,
        reject_unauth_destination,
        reject_rbl_client zen.spamhaus.org,
        reject_rbl_client bl.spamcop.net

client_checks:
    ip.of.permitted.client  OK
This is generally not a good idea, as IPs are spoof-able, making your server subject to becoming an open relay. Get authentication working as soon as possible, or use an SSH tunnel, port fowarding port 25 or 587 (submission).

Don't forget to postmap the file, and reload postfix:

Code:
postmap /etc/postfix/client_checks
postfix reload
 
Old 08-25-2008, 11:57 PM   #6
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
I run a second instance of smtpd on port 465 (smtps) as defined in master.cf:
PHP Code:
smtps    inet  n       -       -       -       -       smtpd
  
-o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes 
(implicit TLS, this is for old Outlook Express compatibility, but works for some other clients like Apple's Mail.app, i.e. you cannot connect without TLS, hence the password is always protected)

and the relevant bits of main.cf:
PHP Code:
smtpd_recipient_restrictions permit_sasl_authenticatedreject_unauth_destination
smtpd_sasl_auth_enable 
yes
smtpd_tls_cert_file 
= /etc/ssl/abydos-new.pem
smtpd_tls_key_file 
= /etc/ssl/private/abydos-new.pem
smtpd_tls_loglevel 
2
smtpd_use_tls 
yes 
 
Old 08-26-2008, 07:29 AM   #7
btaylor1988
Member
 
Registered: Nov 2005
Location: England
Distribution: CentOS, Fedora
Posts: 79

Original Poster
Rep: Reputation: 15
ive been trying to set up secure authentication as you have stated "chort"
but running into a few problems, i now get a password box to put in my password yet it does not seem to work should i set it somewere.

maillog:




Aug 26 13:24:13 central postfix/smtpd[26168]: initializing the server-side TLS engine
Aug 26 13:24:13 central postfix/smtpd[26168]: warning: cannot get certificate from file /etc/ssl/abydos-new.pem
Aug 26 13:24:13 central postfix/smtpd[26168]: warning: TLS library problem: 26168:error:02001002:system library:fopen:No such file or directory:bss_file.c:352:fopen('/etc/ssl/abydos-new.pem','r'):
Aug 26 13:24:13 central postfix/smtpd[26168]: warning: TLS library problem: 26168:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:354:
Aug 26 13:24:13 central postfix/smtpd[26168]: warning: TLS library problem: 26168:error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system lib:ssl_rsa.c:720:
Aug 26 13:24:13 central postfix/smtpd[26168]: cannot load RSA certificate and key data
Aug 26 13:24:13 central postfix/smtpd[26168]: connect from isp.com[???.???.???.???]
Aug 26 13:24:17 central postfix/smtpd[26168]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
Aug 26 13:24:17 central postfix/smtpd[26168]: warning: SASL authentication failure: Password verification failed
Aug 26 13:24:17 central postfix/smtpd[26168]: warning: isp.com[???.???.???.???]: SASL PLAIN authentication failed: generic failure
Aug 26 13:24:18 central postfix/smtpd[26168]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
Aug 26 13:24:18 central postfix/smtpd[26168]: warning: isp.com[???.???.???.???]: SASL LOGIN authentication failed: generic failure
 
Old 08-26-2008, 09:51 AM   #8
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
Well, you need certificates to use TLS... you seem to have skipped that part. You also need to configure SASL.
 
Old 08-26-2008, 12:56 PM   #9
btaylor1988
Member
 
Registered: Nov 2005
Location: England
Distribution: CentOS, Fedora
Posts: 79

Original Poster
Rep: Reputation: 15
ive pasted the code from both your master and main configs, but im a bit lost on creating the certificates.
 
Old 08-27-2008, 09:21 AM   #10
btaylor1988
Member
 
Registered: Nov 2005
Location: England
Distribution: CentOS, Fedora
Posts: 79

Original Poster
Rep: Reputation: 15
got it to work via SSH tunneling now, that seems the most easy way to do it. so thanks Mr. C. and others for the help.

when i can ill try figure my head around securing it using smtps.

thanks.
 
Old 08-27-2008, 01:56 PM   #11
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Use SMTP AUTH if possible over the submission port 587 rather than SMTPS (which is required for some older Outlook clients).
 
  


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 send mail problem(In RH9, kernal 2.4.20, postfix 2.1.5) minor Linux - General 6 09-23-2019 10:09 PM
Postfix - cannot send e-mail abapdr Linux - Software 13 08-13-2013 05:47 AM
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 10:40 PM
just send mail using postfix shipon_97 Linux - Networking 1 08-10-2006 06:01 AM
Postfix will not send mail antken Linux - Networking 1 10-05-2003 06:28 PM

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

All times are GMT -5. The time now is 10:03 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