Wednesday, February 4, 2009

Mail-Notification with SSL/TSL support

The idea with Mail Notification is to run a small application that alerts you about new emails. This is a very desirable thing because almost all email applications (such as thunderbird) are heavy in the use of computer resources. Moreover, the ones that have an email notification built in (evolution for instance) may just not be counted among your preferred ones. Mail Notification avoids having to keep your email application always open in order to get alerted of the arrival of new emails.

One problem with Mail Notification is its lack of support for secure protocols, such as SSL/TSL (it appears to be a problem with the license, see this forum for more on this). However, it is not difficult to enable SSL/TSL support, though you'll have to compile Mail Notification from source. The following procedure illustrates how to get MAil Notification with SSL/TSL support enabled in Ubuntu Intrepid (I modified/adapted the steps that follow from this nice post).

0. If you want to save some time, get sudo access by typing sudo su followed by your passwd. If you do this, you won't have to write sudo everytime you want to run apt-get. In what follows, I assume you've done this so I'll save the sudo in front of every command line I type below.

1. Move to the /tmp directory.

2. Get the source packages for mail-notification package. In a terminal, run:

apt-get source mail-notification

This will give you a subdirectory (and other packages) with the sources to build mail-notification (in my case I got the directory /tmp/mail-notification-5.4.dfsg.1).

3. Now you need to get all the development packages needed to compile the mail-notification package by running:

apt-get build-dep mail-notification

This command line can be used whenever you want to build something from source and are unsure about the 'development packages' that particular application needs. It will download a lot of stuff but later you can delete the unnecessary things by running sudo atp-get autoremove.

4. Get the development package necessary to compile mail-notification with SSL support:

apt-get install libssl-dev

5. Move to the mail-notification-5.4.dfsg.1 directory (cd mail-notification-5.4.dfsg.1 will do the trick since you already are at /tmp). Within the mail-notification-5.4.dfsg.1 directory, go to debian (so you end up at /tmp/mail-notification-5.4.dfsg.1/debian) and type

gedit rules

You should get a file with lots of stuff. Look for the following section:

configure: configure-stamp
configure-stamp:
dh_testdir
./jb configure ssl=no sysconfdir=/etc destdir=$(DEBIAN_DIR)/tmp/
touch $@

Change the line that ./jb configure ssl=no to ./jb configure ssl=yes. Save and close this file.

6. Modify the changelog file to let eveyone who uses your compiled package know what this change is about. Do this by editing the changelog file (gedit changelog). I wrote something like this at the beginning of the file:

mail-notification (5.4.dfsg.1-1build1a) intrepid; urgency=low

* Enable SSl/TSL support.

-- Cristian Troncoso-Valverde Wed, 04 Feb 2009 11:43:18 +1100


7. Finally, come back to the /tmp/mail-notification-5.4.dfsg.1 directory and issue the following command::

dpkg-buildpackage -uc -b

(type dpkg-buildpackage --help to see what the role of -uc and -b is).

8. Type cd .. to get back to the /tmp directory. Now type ls. You should see a file with .deb extension (something like mail-notification-evolution_5.4.dfsg.1-1build1a_amd64.deb). This is your mail-notification package ready to be installed in your system. To install it you can open nautilus and click directly on this file or you can issue the following command:

dpkg -i mail-notification_3.0.dfsg.1-3ubuntu8a_i386.deb


9. Once installed, go to System -> Preferences and click on Mail Notification. When you add a new account, you should see that SSL/TSL support is now enable so you can set it up for your email account.

10. Enjoy!

Sunday, February 1, 2009

SSHFS on Ubuntu Intrepid

SSHFS is a protocol based on ssh that can be used to mount a folder remotely on your local machine. It's a very effective way to treat folders located on remote machines as if they were part of your local machine folder. For instance, you can use the DVD burner on your laptop to burn nice DVD's without having to actually download all those pictures you have on your old home's desktop computer.

In what follows, I will assume you have ssh already installed in both machines (the remote and the local one). Here are the steps I followed to get SSHFS working on my laptop:

1. Install sshfs by running on a terminal the following:

sudo apt-get install sshfs

(some dependencies will also be installed here).

2. Create a local mount directory. You can create this folder wherever you like but make sure that you're the owner of the directory. For instance, I create the folder remote on my media directory and then change the ownership of the folder:

sudo mkdir /media/remote
sudo chown your-username /media/remote

The folder 'remote' will be used to locally mount the remote folder in your computer.

3. Make sure you belong to the group 'fuse'. To do this, go to System->Administration->Users and Groups, and there select 'fuse' and add yourself to this group.


Now you're ready to mount your remote folder. The way we do this is as follows. Say I want to access the folder 'pictures' that is situated in my home-desktop computer whose domain name is desktop-pc. Then, if the full path is /home/myuser/pictures we have to run the following command to mount this folder on my laptop (local machine):

sshfs desktop-pc:/home/myuser/pictures /media/remote

Go to /media/remote and check that all files in the folder picture on desktop-pc are available in your local machine. You can now do whatever you want with this files as if they were a local folder (for instance, you can burn a DVD with all the pictures in this folder).

In case you've set ssh access to your remote machine through a port different from port 22 (say port 23) and/or only to some users (say only to the user called nameuser), you can modify sshfs the same way you'd do it when you run ssh. In my example, this can achieved as follows:

sshfs -p 23 nameuser@desktop-pc:/home/myuser/pictures /media/remote

Finally, once you're done you can unmount this directory by issuing the following command:

fusermount -u /media/remote

Enjoy!