LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-15-2002, 06:29 AM   #1
antken
Member
 
Registered: Nov 2000
Posts: 368

Rep: Reputation: Disabled
Question mail server behind linux box


hi,

due to the recent spate of attacks on one of our mail servers i would like to protect it a bit more, by putting it behind a linux box.

i have iptables installed with mandrake 8.2
is it possible to send all connections from smtp and pop ports through the linux box and make them end up on the mail server?

so:
{internet} <------> [linux box] <---------> [mail server]

the internet is connected to the linux box via interface eth1
and the mail server runs on eth0 allong with some other stuff

is this possible? if so is there a howto?
or if possible please could some one tell me what should be added to iptables ?

thanks
 
Old 11-15-2002, 12:06 PM   #2
jrmann1999
Member
 
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306

Rep: Reputation: 30
iptables -t nat -A PREROUTING -p tcp --dport 25 -j DNAT --to ip.of.mailserver.here:25
iptables -t nat -A PREROUTING -p tcp --dport 110 -j DNAT --to ip.of.mailserver.here:110

Use those two lines on your linux box and it should work, you have just specified that you want to forward port 25(and 110) to the address specified, DNAT rewrites the request so it looks like it's coming from the linux box...then rewrites it when the reply comes back...
 
Old 11-15-2002, 01:30 PM   #3
antken
Member
 
Registered: Nov 2000
Posts: 368

Original Poster
Rep: Reputation: Disabled
thanks for that,

i presume if i set the mail server to talk to the linux box as a gateway people will be able to connect to the mail server and send mail to the out side world




unfortunatly i had to make a switch from ipchains to iptables and i am still getting to grips with it
 
Old 11-15-2002, 02:46 PM   #4
jrmann1999
Member
 
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306

Rep: Reputation: 30
There's a few more issues w/ getting NAT working, but that was the gist of forwarding. If you search for iptables and nat on google you'll find how to setup the box to talk from behind the firewall. You can do this in other ways to block IP's, but they become complex.
 
Old 11-15-2002, 06:06 PM   #5
antken
Member
 
Registered: Nov 2000
Posts: 368

Original Poster
Rep: Reputation: Disabled
i also presume the first part of the command: iptables -t nat ...

is like the mount command, you are telling to load the nat module for this rule?

i have been searching google for iptables and nat and most of the results are for firewall sample scripts i have only found so far one how-to but i think i am picking it up now!!


thanks
 
Old 11-16-2002, 06:35 PM   #6
antken
Member
 
Registered: Nov 2000
Posts: 368

Original Poster
Rep: Reputation: Disabled
i have added the port forwarding into my iptables and it seems to be working

i started to wonder if it was not working when i tried to access the mail server
from the linux box its self but it works from outside the box ( on the net )

i have noticed when i filter out other ports, for example port 21, nmap reports the ports as being filtered

how could i close the port completely using iptables so it does not show what so ever on an nmap scan?
 
Old 02-18-2003, 02:07 PM   #7
Pcghost
Senior Member
 
Registered: Feb 2003
Location: The Real Washington
Distribution: Debian, Android
Posts: 1,819

Rep: Reputation: 46
I would start by setting the default policies to DROP. That should prevent all ports not explicitly opened to show as stealthed on a GRC scan, or non-existent on other scans..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
novel users to access linux box for mail mistich Linux - Software 0 08-18-2005 03:21 PM
Sending mail from linux box alex360 Linux - Newbie 2 07-08-2005 10:56 AM
can we configure a Linux server with mail server,file server and web server kumarx Linux - Newbie 5 09-09-2004 06:21 AM
sendmail server mail box creation problems kjsubbu Linux - Networking 0 08-25-2003 05:47 AM
What is being sent out from my Linux Box using mail? SForsgren Linux - General 2 05-03-2003 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:15 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration