Advertisement
     
 
 
Search:
General | Linux Hacking | Linux Networking | Linux Security | Windows Hacking
       
Setting up a MailServer with a bogus domain PDF Print E-mail
Written by LE Webmaster   
Wednesday, 26 January 2005
In this series I will tell you how to setup a mailserver with a bogus domain, for eg. yourname@yourname.com You can use fetchmail to download you pop3 mail account and then redirect them to your internal mail account on your LAN. By: Krishna Shekhar ; Krishna_shekhar@gmx.net ;


1. In this series I will tell you how to setup a mailserver with a bogus domain, for eg. yourname@yourname.com
You can use fetchmail to download you pop3 mail account and then redirect them to your internal mail account
on your LAN.
This is how I set it up for my GMX email which is a pop3 account.

2. First we will setup a bogus domain for eg. www.yourname.com on the Linux box which may or may not exist on the Net.

SETTING UP YOUR DNS

3. You need to set up your dns.
4. Go to the /etc directory
[root@linux /etc]# pico named.conf
5. Setup up a new zone for this domain in "named.conf"

zone "yourname.com"{
type master;
file "yourname.com";
notify no;
};

6. Also setup a reverse mapping zone entry for your internal network as well as for your localhost eg. my internal network address is "192.168.0." and localhost is "127.0.0"

zone "0.0.127.IN-ADDR.ARPA"{
type master;
file "127.0.0";
};
zone "0.168.192.IN-ADDR.ARPA"{
type master;
file "192.168.0";
notify no;
};

7. Now switch to the /var/named directory
[root@linux /etc]# cd /var/named
8. First find out your hostname for your box.
[root@linux named]# hostname
linux.yourname.com
9. Now make a file 127.0.0 , the following shows the my configuration, please do read the DNS howto to understand it.
[root@linux named]# pico 127.0.0
########################################################################
$TTL 86400
@ IN SOA linux.yourname.com hostmaster.yourname.com. (
2002010501 ; serial
3600 ; refresh
900 ; retry
1209600 ; expire
86400 ; default_ttl
)
1 IN PTR localhost.yourname.com.
@ IN NS linux.yourname.com.
#########################################################################

10. And make another file called yourname.com
[root@linux named]# pico yourname.com
11. This is what I have
#########################################################################
$TTL 86400
@ IN SOA linux.yourname.com. hostmaster.yourname.com. (
2001091103 ; serial
3600 ; refresh
900 ; retry
1209600 ; expire
43200 ; default_ttl
)

www IN A 192.168.0.13
localhost IN A 127.0.0.1
linux IN A 192.168.0.13
@ IN MX 5 mail.yourname.com.
@ IN NS linux
########################################################################
12. I have setup dns on localhost, beacause that is a reliable way to do it.
13. The ip 192.168.0.13 is a virtual host under localhost.
14. Next create a file for reverse zone mapping entry for your internel network, in my case it is 192.168.0
[root@linux named]# pico 192.168.0
15. This is what my configurtion for internal lan, I have removed entries for other servers.
########################################################################
$TTL 86400
@ IN SOA linux.yourname.com. hostmaster.yourname.com (
2002010501 ; serial
3600 ; refresh
900 ; retry
1209600 ; expire
43200 ; default_ttl
)
13 IN PTR www.yourname.com.
@ IN NS linux.yourname.com.
#######################################################################
16. Now edit /etc/hosts file.
17. [root@linux /etc]# pico hosts
18. This is what you should do
#######################################################################
127.0.0.1 localhost linux.wiplash.com
192.168.0.13 linux.wiplash.com
192.168.0.13 www.wiplash.com
#######################################################################
19. Restart named.
[root@linux /etc]# /sbin/service named restart
20. To test it do a lookup at "www.yourname.com" and it should resolve to 192.168.0.13
21. [root@linux /etc]# nslookup -silent www.yourname.com
Server: 127.0.01
Address: 127.0.0.1#53

Name: www.yourname.com
Address: 192.168.0.13
[root@linux /etc]#

22. Thats it !! You have now configured your working DNS.

SETTING UP SENDMAIL

23. Now we need to setup Sendmail.
24. Edit /etc/sendmail.cf
25. You need to define "local info".

Cw yourname.com
Cw localhost linux.yourname.com

26. Next search for daemonportoptions which makes sendmail listening on the ipaddress of your box, here 192.168.0.36 is the ipaddress of the ethernet interface

O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
O DaemonPortOptions=Port=smtp,Addr=192.168.0.36, Name=MTA

27. By default sendmail does not relay, we need to set it to relay for our internal network.
28. Go to the /etc/mail directory and edit "access"
29. This is what you should have
[root@linux mail]# cat access
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
mail.yourname.com RELAY
192.168.0 RELAY
[root@linux mail]#

30. Now restart sendmail " /sbin/service sendmail restart "
31. Send a mail through your internal network using the servers smtp address. If relay still does not work, download webmin,
and configure sendmail!!
32. Now DNS and Sendmail are set , we need to configure xinetd to listen on the pop3 port.

SETTING UP XINETD

33. Go to /etc/xinetd.d and edit "ipop3".
34. [root@linux xinetd.d]# pico ipop3
35. Set "disable = no"
#############################################################
[root@linux xinetd.d]# cat ipop3
# default: off
# description: The POP3 service allows remote users to access their mail
# using an POP3 client such as Netscape Communicator, mutt,
# or fetchmail.
service pop3
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/ipop3d
log_on_success += USERID
log_on_failure += USERID
}
[root@linux xinetd.d]#
##################################################################

36. Now restart xinetd.d
[root@linux xinetd.d]# /sbin/service xinetd.d restart

36. Do "netstat --inet -a" and look for pop3 port.
37. Test it by telnetting it to port 110.
[root@linux xinetd.d]# telnet 192.168.0.13 110
Trying 192.168.0.13...
Connected to 192.168.0.13.
Escape character is '^]'.
+OK POP3 linux.yourname.com v2000.69rh server ready
38. Check your firewall also allow access to your pop3 port from internal network.

SETTING UP FETCHMAIL

39. Now lets configure Fetchmail which will pop your external email address and will then forward that mail to you internal email
address.
30. Hope you have fetchmail installed. I ran fetcmail for root.
31. Go to the /root directory and create a file .fetchmailrc
32. [root@linux /root]# pico .fetchmailrc
33. This is the configuration for your pop3 email account

[root@linux /root]# cat .fetchmailrc
set syslog
set postmaster "hostmaster@yourname.com"
set daemon 300
poll pop.gmx.net with proto pop3 #
user username pass password is kris ## Pop from gmx and redirect it to local user Kris
here;
[root@linux /root]#

34. Start fetchmail by doing
35. [root@linux /root]# fetchmail&
36. See /var/log/maillog , your mails must be downloading as well as forwarded to you bogus email address here i.e
kris@yourname.com
37. Now go to your windows machine , open up your mail client , and add a new mail account , specify smtp and outgoing address as 192.168.0.36 (here which is the ipaddress of the ethernet interface where we did all this stuff).
38. On Eudora I had to disable SSL, on outlook it was a direct hit!!!!!!!!!
39. You can now see you mails downloading, from Kris@yourname.com which is actually containing emails from my GMX email account.
40 . If you got any problems , please do email me.

regards
Krishna

http://www.KrisinDigitalAge.com

Add as favourites (60)

  Be first to comment this article

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Personal verbal attacks will be deleted.
  • Please don't use comments to plug your web site. Such material will be removed.
  • Just ensure to *Refresh* your browser for a new security code to be displayed prior to clicking on the 'Send' button.
  • Keep in mind that the above process only applies if you simply entered the wrong security code.
Name:
Comment:

Code:* Code

 
< Prev   Next >
 
© Copyright 2002-2008 - Linux Exposed - Sponsored by ConsultPlanet http://www.consultplanet.nl - Contact Linux Exposed