Coded zone

The place where all the coded stuffs reside.

Wednesday, July 11, 2007

The world of Black Screen

 

This is a sample remote system we are going to investigate..

 1 nmap ku.edu.np

Then I started playing inside..

 2 dig  localhost

Later I made sure if the DNS server is working or not.. by using Dig command

 3 dig localhost port 53

Now I stopped the Name server: "service named stop"

4 service named stop

 

Dig localhost, to ensure which name server is working . Since our name server is stopped just a second ago, It might be another parent server that would reply by the dig. Here was the case that 202.52.242.65 replied at port 53. [This follows the precedence from /etc/resolv.conf]

5 dig localhost port 53 after named shutdown

Below is the famous "Cannot Find server" lol  .. because the name server is down 

6 cannot find server

The files resolv.conf contains the information about which servers to contact. It is usually found at /etc/resolv.conf .

I have here two of the name servers listed. If one fails it contacts the another. However most of the queries will be fetched from the first server.

6 resolv dot conf

Now since our local DNS (Domain Name Server) is down. Lets try to find the ip of hotmail.com by invoking : dig hotmail.com

This will return obviously the ip of hotmail.com as well as the ip of the Server which did the job for us. Most probably here will be 202.52.242.65 to do this for us , because we have kept its name at the second place. The one in the first place is 202.52.242.110, which is our local ip, and its DNS (Domain Name Server) is down now.

7 dig hotmail.com

Now lets start our name server. Service named start.

7 service named start

 

The Error logs, or any logs are printed inside the /var/log/messages at the last portion. You may use tail function, or cat to print the latest log messages about the starting of the name server. Usually during starting name servers.. when there are errors .. I have found no error log is printed at the console, rather errors are printed at the log files. So Its better to find these stuffs there.. Remember /var/log/messages

8 var log messages -- after named start

Here it goes .. Now our DNS is running and, there is at least one server who will reply to our query for the domain. Remember last cannot find server. This time.. it won't say  so.. Rather it worked.. See my domain is working now..

9 rapa.rajesh.com.np success

Okay what is there in the files of name servers? These files are situated inside the folder /var/named/ .  Actually name server is configured by a configuration file /etc/named.conf, in which the directory /var/named is defined. I too have used the same configuration. Hence my files reside at /var/named. Inside that file are other files, within which, we can define different zones, and different subdomains.. like I have used a domain here kucc.ku.edu.np and defined different subdomains within this domain. So simple create any file and define subdomains. like A records, the www subdomain of  kucc.ku.edu.np is defined inside kucc.ku.edu.np as :
www IN A 202.52.242.110.
Which means that, the ip of the subdomain "www.kucc.ku.edu.np"  is 202.52.242.110.

10 var named file list

Okay well we talked about named.conf Here is the screenshot of /var/named/named.conf

11 etc named.conf

Now lets check it out what the DNS analyzers say, like DNSSTUFF.com has something to say about us.. whether working or not..

12 dnsstuff.com

Okay just click the lookup button and there you go: the details of dns related stuff.

13 resolved dnstuff.com

/var/named/named.ca

14 named.ca

/var/named/kucc.ku.edu.np

15 named - kucc.ku.edu.np

Below is the history of whatever we did until now..

17 history upto now

Now lets start towards mail servers. Lets perform nmap scan to see which ports are open for us to watch. If mail servers are on, smtp port 25,and pop3 port 111 must be open.

18 mail server scan

Now lets check by telnetting the ports. telnet at port 25 and telnet at port 110.

20 telnet kucc.ku.edu.np 25 and 110

Okay our mail server is running.. Lets login
21 webmail login

and after logging we get mails inside it:
22 logged inside mail

One benefit of having a mail server is that, the system mails all the attacks and logs to the mail server, so that we can check them periodically. Not that you have to go to /var/log/message to check them all the time .. The logs are sent to the mail box as shown above. In traditional way, we had to check the attacks manually like below:

23 daily attack in ssh list

0 Comments:

Post a Comment

<< Home