Suramya's Blog

Visit suramya.com Who am I?

February 25, 2016

Indian Patent office rejects Software patents

Filed under: Computer Software,My Thoughts — Suramya @ 8:00 PM

As you know software patents are something of a scourge in the computer industry and are hated for the most part (except by the companies using them to make money/stifle innovation and competition). There is extensive debate on the topic all of which boils down to the following three questions:

  • Should software patents even be allowed? If they are then how do we define the boundary between patentable and non-patentable software?
  • Is the inventive step and non-obviousness requirement is applied too loosely to software?
  • Are software patents discouraging innovation instead of encouraging it?

The Indian patent office has ruled on 19th Feb 2016 that software patents discourage innovation by using the following three part test to determine the patentability of Computer Related Inventions (CRIs), which precludes software from being patented:

  • Openly construe the claim and identify the actual contribution;
  • If the contribution lies only in mathematical method, business method or algorithm, deny the claim;
  • If the contribution lies in the field of computer programme, check whether it is claimed in conjunction with a novel hardware and proceed to other steps to determine patentability with respect to the invention.. The computer programme in itself is never patentable. If the contribution lies solely in the computer programme, deny the claim. If the contribution lies in both the computer programme as well as hardware, proceed to other steps of patentability.

This is a great step in ensuring that useless/basic idea’s don’t get patented and stifle innovation.

– Suramya

Source: Press Release: Indian Patent Office Says No to Software Patents

February 20, 2016

How to encrypt your Hard-drive in Linux

We have heard multiple stories where someone looses a pendrive or a laptop containing sensitive/private data which is then published by the person who found the drive embarrassing the owner of the data. The best way to prevent something like that from happening to you if you loose a disk is to make sure all your data is encrypted. Historically this used to be quite painful to setup and required a lost of technical know-how. Thankfully this is no longer the case. After trying a bunch of different options I found Linux Unified Key Setup-on-disk-format (LUKS) to be the most user-friendly and easy to setup option for me.

Setting it up is quite easy by following the instructions over at www.cyberciti.biz. However since things on the internet have a tendency of disappearing on a fairly frequent basis, I am using this post to save a paraphrased version of the installation instructions (along with my notes/comments) just in case the original site goes down and I need to reinstall. All credit goes to original author. So without further ado here we go:

Install cryptsetup

First we need to install cryptsetup utility which contains all the utilities we need to encrypt our drive. To install it in Debian/Ubuntu you just issue the following command as root:

apt-get install cryptsetup

Configure LUKS partition

Warning: This will remove all data on the partition that you are encrypting. So make sure you have a working backup before proceeding amd don’t blame me if you manage to destroy your data/device.

Run the following command as root to start the encryption process:

cryptsetup -y -v luksFormat <device>

where <device> is the partition we want to encrypt (e.g. /dev/sda1). The command will ask you for confirmation and a passphrase. This passphrase is not recoverable so make sure you don’t forget it.

Create drive mapping

Once the previous command completes you need to create a mapping of the encrypted drive by issuing the following command:

cryptsetup luksOpen <device> backup2

You can also map a partition to using its UUID (which is what I do) by issuing the following command instead (This works great if you want to script automated backups to an external drive):

cryptsetup luksOpen UUID=88848060-fab7-4e9e-bac2-f9a2323c7c29 backup2

Replace the UUID in the example with the UUID of your drive. (Instructions on how to find the UUID are available here).

Use the following command to see the status for the mapping and to check if the command succeeded:

cryptsetup -v status backup2

Format LUKS partition

Now that we have created the mapping we need to write zeroes to the encrypted device, to ensure that the outside world sees this as random data and protects the system against disclosure of usage by issuing the following command:

dd if=/dev/zero of=/dev/mapper/backup2

Since this command can take a long time to complete depending on the drive size and dd by default doesn’t give any feedback on the percentage completed/remaining I recommend that you use the pv command to monitor the progress by issuing the following command instead:

pv -tpreb /dev/zero | dd of=/dev/mapper/backup2 bs=128M

This will take a while to run so you can go for a walk or read a book while it runs. Once the command completes you can create a filesystem on the device (I prefer to use ext4 but you can use any filesystem you like) by formatting the device:

mkfs.ext4 /dev/mapper/backup2

After the filesystem is created you can mount and use the partition as usual by issuing the following command:

mount /dev/mapper/backup2 /mnt/backup

That’s it. You now have an encrypted partition that shows up as a regular partition in Linux which you can use as a regular drive without having to worry about anything. No special changes are needed to use this partition which means any software can use it without requiring changes.

How to unmount and secure the data

After you are done transferring data to/from the drive you can unmount and secure the partition by issuing the following commands as root:

umount /mnt/backup

followed by

cryptsetup luksClose backup2

Creating a backup of the LUKS headers

Before you start anything else, you should create a backup copy of the LUKS header because if this header gets corrupted somehow then all data in the encrypted partition is lost forever with no way to recover it. From the cryptsetup man page:

“LUKS header: If the header of a LUKS volume gets damaged, all data is permanently lost unless you have a header-backup. If a key-slot is damaged, it can only be restored from a header-backup or if another active key-slot with known passphrase is undamaged. Damaging the LUKS header is something people manage to do with surprising frequency. This risk is the result of a trade-off between security and safety, as LUKS is designed for fast and secure wiping by just overwriting header and key-slot area.”

Create a backup by issuing the following command:

cryptsetup luksHeaderBackup <device> --header-backup-file <file>

Important note: a LUKS header backup can grant access to most or all data, therefore you need to make sure that nobody has access to it.

In case of disaster where our LUKS header gets broken, we can restore it by issuing the following command:

cryptsetup luksHeaderRestore <device> --header-backup-file <file>

How to remount the encrypted partition?

Issue the following commands in sequence to mount the partition:

cryptsetup luksOpen <device> backup2
mount /dev/mapper/backup2 /mnt/backup

Please note that data encrypted by LUKS is quite obvious with most Linux systems identifying it as an encrypted partition automatically. So if someone examines your system they will know you have encrypted data and can force you to divulge the password by various means (including the use of Rubber-hose Cryptanalysis. )

If you want the encrypted partition to be hidden then you can use Deniable encryption/Hidden Partition or use steganography. I haven’t really used either so can’t comment on how to set it up correctly but maybe I can talk about it in a future post after I explore them a bit more.

Well this is all for now, hope you find this useful. Will write more later.

– Suramya

February 1, 2016

Recovering from KP: Day trip to Hogenakkal Falls

Filed under: My Life — Suramya @ 10:54 PM

After the KP trek I wanted to relax so last weekend I went for a day trip to Hogenakkal Falls with friends and this weekend I did absolutely nothing and it was glorious 🙂 This post was supposed to have been published last week but first I was waiting for the pics to be uploaded and then got busy with work so didn’t get a chance to finish the post before today. But better later than never so here we go.

We (14 of us) left Bangalore at ~7am which was quite good considering certain folks (and I am not going to name names) were running quite late and made me wait outside my house for almost 45 mins. We had hired a 13 seater Tempo Traveller for the trip and the guy made pretty good time. Coincidentally it was Shammi’s birthday so when we stopped for breakfast we cut the cake and created enough of a racket disturbing everyone else in the restaurant that the owner asked us to move to a private room so that we didn’t scare the rest of his customers away.


The Mandatory cake facial

After finishing food we were on our way and spent the next 3 hours fooling around. Played a whole lot of dumb-charades , took selfies and basically drove the driver nuts. The way was quite scenic and traffic wasn’t too bad but even if that wasn’t the case the company was fun enough to make the trip enjoyable. This time most of the folks who came for the trip were people who we knew so there were no unpleasant surprises like last time.


Everyone Smile

Once we got to the falls we found that the only place where you were allowed to go into the water was this one place that didn’t look very clean and there was a very long queue so we all decided to skip that and go directly for the boat ride in the coracles (Bamboo Boats) with the idea that we would get into the water in a cleaner less crowded area. As there were 14 of us and each boat could only take 4 people at a time we rented 4 boats and were off. The boat ride was a two part affair where we boated to an Island sort of place and then had to walk across to get to the other side while the boatman carried the boats across then we got back in the water and spent a good 2 hours (maybe more) in the water. Not sure of the exact time we spent in the water as I had to take my watch off and put it in the bag along with the phone to prevent it from getting soaked. Though having things in the bag didn’t really help much because my spare set of clothes were completely wet by the time we finished, thankfully the phone and the watch escaped this fate and were reasonably dry.


Us in the boat

IMG-20160127-WA0012
Some of the small falls we saw during the boat ride

Due to some restrictions we were not allowed to get in the water during the boat ride but thanks to some negotiations we were allowed to get in the water in a secluded area with a small waterfall and it was great. We spent almost an hour in the water over there and had to be forced out of the water.

After the boat ride finished we had a late lunch (really late ’cause it was around 4pm) at Hotel Tamil Nadu. The food was decent and quite tasty (though that could be because we were starving so all food would have tasted good by this time). After lunch we fooled around a bit outside the restaurant ’cause no one was in the mood to head back.

IMG_1860
Lets climb a tree like our ancestors used to…

IMG_1897
Group Pic outside the Tamil Nadu Restaurant

IMG_1947
How can we have a birthday celebration without Birthday Bumps?

On the way back we had a pit stop on the way to watch the sunset and it was gorgeous. Took a whole bunch of pics and then we were on our way again. After a bit folks decided the best way to pass the time was to dance in the bus. I am surprised that the driver didn’t get into an accident considering the amount of racket we made and how distracting it must have been to have 14 people dancing/screaming behind him for almost 3 hours. Unfortunately none of the photos I took of the dancing came out clean, but still the memories are crystal clear. We stopped for dinner at a roadside bar/restaurant but it looked very shady so we decided to get the food packed and ate our dinner in the bus itself which was an experience in itself.


IMG_2096
Sunset on the way back from Hogenakkal Falls

IMG_2146
Group pic at the sunset point

Finally we reached Bangalore around 10pm (maybe a bit earlier) and then all of us went our different ways with great memories and a plan to do similar trips again in the near future.

Well this is all for now, will write more later.

– Suramya

Powered by WordPress