Saturday, 26 June 2010

Secure chat

This guide explains how to set up a secure, point to point chat system. With two participants, one holds the conversation file and allows the other to login to their machine, via ssh. The holder sets up an account for the remote user, and provides themselves with access to the remote users files, but does not allow the reverse. The remote user then executes a remote tail or cat command to view the conversation file; and executes a remote,

echo "This is to be sent" >> ~/conversation

command, to add to the conversation.

The host is running a tail script, once a second to update the chat window also.

Secure, point to point transmission, without a third party software to worry about.

Two scripts, then. One to append to the conversation file, and one to loop on a viewing.

-----------------------------------------

add.sh

ssh login@ipaddress echo $1 >> ~/conversation

view.sh

while true ; ssh login@ipaddress tail ~/conversation; sleep 1 ; done


The host sets up port forwarding etc. Passwordless ssh is required.

-------------------------------

Add the new used: sudo adduser
Restrict access for the new user to only their local stuff: Easily said!

------------------------------

Python version: Check http://docs.python.org/library/socket.html for sockets programming, including a server / client example. Combine this with the Python encryption libraries.

No comments:

Post a Comment