LinuxQuestions.org
Help answer threads with 0 replies.
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 11-04-2011, 08:43 AM   #1
mahi_nix
Member
 
Registered: Aug 2010
Distribution: CentOS, RHEL, Ubuntu,
Posts: 154

Rep: Reputation: 16
How to Configure SMTP Server which can relay mail based on IP address


Hello Freinds,

I have to configure SMTP Relay server which can realy mails based on IP addess.

Is that possible and on which mail server. I prefer postfix server. I have Debian installed in my machine.

Any help would be appriciated.

Thanks in Advance
 
Old 11-04-2011, 09:14 AM   #2
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
I have not worked on postfix

I can guide you with sendmail server for relay
Code:
#yum -y install sendmail
Code:
#vi /etc/mail/sendmail.mc

(add these lines or check if they exist)
define(`SMART_HOST', `smtp.your.provider')dnl <--------------provide the details of smtp server in my case I use smtp.gmail.com

define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl <--------------port for relay

define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl <--------------port for smtp

TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl---------------------------------->uncomment this line as done here

define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl------------->uncomment this line as done here

FEATURE(`authinfo', `hash /etc/mail/auth/client-info.db')dnl------------->add this line

dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl---------------->uncomment and remove loopback

FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl --------------> make sure this line is uncommented

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl------------------------>remove loopback address
Code:
#cd /etc/mail/auth
#vi client-info
AuthInfo:(smtp_server) "U:username" "P:Password" "M:PLAIN"
AuthInfo: "U:username" "P:Password" "M:PLAIN"
Code:
#makemap -r hash client-info.db < client-info
Code:
#vi /etc/mail/access
Connect:your-ip           RELAY
Code:
#m4 sendmail.mc > sendmail.cf


Code:
#service sendmail restart
best of luck

Last edited by deep27ak; 11-04-2011 at 09:18 AM.
 
Old 11-04-2011, 09:36 AM   #3
mahi_nix
Member
 
Registered: Aug 2010
Distribution: CentOS, RHEL, Ubuntu,
Posts: 154

Original Poster
Rep: Reputation: 16
Hello Deep27ak,

I need the server which is able to receive an email from specific IP address and then relay it to outside. no other IP's which are not in allowed list can realy email from my SMTP server.
 
Old 11-04-2011, 09:41 AM   #4
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by mahi_nix View Post
Hello Deep27ak,

I need the server which is able to receive an email from specific IP address and then relay it to outside. no other IP's which are not in allowed list can realy email from my SMTP server.
Code:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

instead of 127.0.0.1 give your IP
 
Old 11-04-2011, 10:23 AM   #5
mahi_nix
Member
 
Registered: Aug 2010
Distribution: CentOS, RHEL, Ubuntu,
Posts: 154

Original Poster
Rep: Reputation: 16
Hello Deep27ak,

Do we required first configuration with secondone which you have suggested here.

and this configuration will relay mail comes from specific IP address (Specifica SMTP server) and relay it to outside?

Lets Say it will receive mails from 192.168.0.254 server and realy it to ourside if i will do "DAEMON_OPTIONS(`Port=smtp,Addr=192.168.0.254, Name=MTA')dnl"?

Last edited by mahi_nix; 11-04-2011 at 10:31 AM.
 
Old 11-06-2011, 10:11 PM   #6
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by mahi_nix View Post
Hello Deep27ak,

Do we required first configuration with secondone which you have suggested here.

and this configuration will relay mail comes from specific IP address (Specifica SMTP server) and relay it to outside?

Lets Say it will receive mails from 192.168.0.254 server and realy it to ourside if i will do "DAEMON_OPTIONS(`Port=smtp,Addr=192.168.0.254, Name=MTA')dnl"?
Sorry for the late reply

yes, all the mails will pass from this IP which will act as a RELAY but don't forget to mention the IP in access file and map it to access.db
 
1 members found this post helpful.
  


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
how to Configure spamassassin in SMTP relay server haariseshu Linux - Server 2 10-12-2009 06:22 AM
SMTP Mail relay that authenticates users from a DB froggo Linux - Server 1 03-26-2009 10:58 AM
Postfix SMTP 554 -- how do I relay mail? fultron Linux - Software 1 01-28-2009 04:01 PM
I need help to configure my Linux server to relay all outbound SMTP messages xmdms Linux - Server 2 11-04-2008 04:44 PM
configure sendmail to relay mail to exchange server goldwing Red Hat 3 10-18-2008 04:07 PM

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

All times are GMT -5. The time now is 05:47 AM.

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