Thursday, September 30, 2010

Essential utilities for working with Layer 3 and Layer 4 devices

Networking equipments including switches and routers are the building blocks of any computer network. And if you are one lucky person who gets to meddle with these, there is nothing better than a GNU/Linux machine with few utilities to help you go inside out of these devices, traversing the entire network.

1. Serial port interface for configuration

gtkterm:

This is a cool tool, equivalent of the hyperterminal in Windows machines. You can select any of the available serial ports and configure the baud rate of the selected port with much ease. \

One negative point is users cannot directly copy/paste into the gtkterm terminal. But, we can send raw data by putting it into a text file and using the option "send raw data" in the file menu.

putty:

Needless to mention the versalile nature of this utility, which can be used to send raw data, telnet, ssh, remote login and also to access the serial ports.

I use this utility when I have to log all the configuration I do. Instead of dumping all configuration to the default log file, we can point it to any desired file ( in terminal)

putty -l /home/USER/LOGFILE


2. Packet sniffing and capture:

wireshark:

If the need is to capture and study every packet impinging on the network interface, there ain't another utility as useful as the wireshark (in GUI).
In a Debian machine, when not in root mode, wireshark does not give users the permissions to sniff the packets on the network interfaces, and hence must be run as sudo

sudo wireshark in terminal or gksudo wireshark in run prompt(alt+F2)



tcpdump:

But, when you do not have the privileges of a GUI( which is the case most of the times) and have remotely logged onto a server, the best tool to sniff packets is tcpdump. With its rich filtering options, it is the most handy tool to sniff packets. The comprhensive man page of tcpdump would throw more light on the usability.



With all these utilities and a GNU/Linux machine you are all well equipped to invade the networks :)

Addendum to original post (30/09/10)


Well this is the marvel of the community. With this post and interactions with peers, discovered an efficient terminal based packet sniffer and analyzer !

tshark ( terminal version of wireshark)
By running the next command on the terminal, you see beautiful deciphered packet data on your screen:) Pipe it and read through the entire stuff :)

raghu@fossphosis# tshark -i eth0 -V 
 
tshark packet capture

Tuesday, September 28, 2010

Configuring SSL on Apache2 with self signed SSL certification

Apache is one of the coolest things that has happened in FOSS, and now that about 70% of web servers run Apache, it is now a nondetachable component of the Web.

Apart from its ubiquity, Apache is very handy to simulate and test network conditions.
Like recently, I had to work with two local Secure Socket Layer (SSL) web servers, i.e, servers which can be accessed only by "https://URL". The servers using SSL protocol are different from conventional HTTP protocol for they operate on port 443 instead of port 80 (for http), and are by design more secure.

Configuring Apache2 is straight forward, and I was already running it on my system. To get it serve content on port 443 (SSL), I had to perform a few simple steps.

(Presumptions: Apache2 is already configured and running on a Debian based Linux machine)
(You should perform all these operations as root/ or perform as sudo as shown below)

1. Creating self-signed certificates for SSL

* Install ssl-cert package, if not installed already. In Debian based machines

raghu@fossphosis$ sudo apt-get install ssl-cert

* Creating a default self-signed certificate, in the default directory /etc/ssl/certs

raghu@fossphosis$ sudo make-ssl-cert generate-default-snakeoil --force-overwrite

2. Enabling the locations which can be accessed by clients on SSL

To use the default option, perform

raghu@fossphosis$ sudo a2ensite default-ssl

This lets users access content from /var/www on SSL

3. Enabling SSL module itslef for Apache2

raghu@fossphosis$ sudo a2enmod ssl

4. Finally, restart Apache2 server for the changes to take place

raghu@fossphosis$ sudo /etc/init.d/apache2 restart

5. Test it by requesting for a https URL in your browser
https://localhost/
SSL Error - Google Chrome
Do acknowledge the signature verification of the certificate to browse the content;
https:--localhost - Google Chrome
Happy Secure Socket Layer serving :)