Setting up a home VPN

During my holidays, it became clear that having a VPN access towards home might just come in handy some times. Besides that, it can also allow to protect your data when using a public/untrusted WiFi connection.

So with the bad weather, I started setting up an OpenVPN server using some of my course material from Annecy and other documentation.

I’ll skip the certificate generation (can be found here), but here’s a sample config:

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server #DHCP assigned to clients
ifconfig-pool-persist ipp.txt #keeps track of client/address allocation
push "route" #pushes local network to client
push "redirect-gateway def1 bypass-dhcp" #makes all client traffic go through vpn
push "dhcp-option DNS" #push dns
push "dhcp-option DNS" # ^
client-to-client #allows connected clients to see each other
keepalive 10 120
comp-lzo #enable compression
user nobody #reduce daemon priviliges
group nogroup # ^
status openvpn-status.log
log-append openvpn.log
verb 3
mute 20

To allow traffic to go on the network, we have to add NAT on the VPN server
iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE
Also allow ip forwarding. To have persistent firewall rules, check here.

Client configuration:

dev tun
proto udp
remote 1194
resolv-retry infinite
nobind #no need for specific port number
persist-key #preserve state between restarts
persist-tun #^
ca ca.crt
cert client.crt #generate one per client
key client.key
ns-cert-type server
comp-lzo #enable compression

I’ve put it on a machine that has Wake-On-LAN, so that I can fire it up by sending a magic packet through the net, then connect to it with the VPN.

Posted in Linux, Software | Tagged , , , , | Leave a comment

Mirroring FTP directories with lftp

Since a while, I’ve been looking for a simple way to sync/mirror a local directory with an FTP directory. In this case, to update without going through FileZilla every time.

Turns out, there is a program for linux called lftp which will do just that, and quite easily.

The way I’ve done it is to create a script that will manage this, and launch it when I want to send an update:

#! /bin/bash
echo "Updating"

lftp -f "
open $HOST
user $USER $PASS
mirror --reverse \ # reverse mirror = put files
 --newer-only # only files that have been changed
 --delete \ # delete files that no longer exist
 --use-cache \ # can be faster
 --verbose \
 --exclude-glob .* \ # exclude files that start with .
echo "done"

This will sync all files from /home/user/local/dir towards /your/remote_dir of the remote server, creating a mirror copy.

You can then put this in a cron job to automatically update any changes every day:

@daily /home/user/

or anything else you fancy.


Posted in Software, WebDev | Tagged , , , , , | Leave a comment

The glory of mpd

For some time now, I’ve been wanting to have a way to music server accessible over the web, so that I could for example, have a computer holding my music library with a web server and some sort of magic software on it, so that you could play the music on that PC by controlling it from another PC (or smartphone, or whatever).

Well after some research, it turns out that the sort of magic software I was looking for exists, and is called mpd.

I’ve installed it on my Ubuntu partition for testing purposes. It doesn’t work completely out of the box, of course; you first have to go through a bit of configuration and find a web interface to use, then configure Apache (or whatever you have) to work with it.

After that it works really quite nicely, and you can control your music from any other networked device.

Posted in Linux, Software, WebDev | Tagged , , , , | Leave a comment


During the trip to Portugal, we (re)discovered one of the awesome features of my camera: tilting playback.

What is this? Well, you take a burst of up to 10 pictures (over 1 or 5 seconds) and then you can replay the sequence by tilting the camera.

We found this really fun and interesting, so we started doing experiments on how we could make some cool shots, depending on the timer and how we held/moved the camera.

Later-on, we thought it could be great to have a website, to review them in a way that would be fairly easy, and share them with the world.

A bit of development further, and here we have !

Posted in Travel, WebDev | Tagged , , , | Leave a comment

The benefits of f.lux when doing an all-nighter

Doing your coursework at the last moment, not a good idea. Having to do an all-nighter for it, not good for many reasons.

However, there is a piece of software I’ve been using for quite some time now, that can make working in front of your PC during those long nights (and generally, any other time) a bit easier: f.lux

It makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day.

How exactly does it work?

Well, it’s quite simple:

  1. Select what type of lighting you have
  2. Select your location (to match sunrise/sunset times)
  3. Select transition speed
  4. Done.

f.lux then takes care of changing the colour temperature to follow the day/night cycle all on its own (that’s why your location is useful). You can also de-activate it for an hour if you want/need.

For the transition speed, I’d suggest putting it on slow, because it in fact changes in that amount of time when you go from the night-time to daytime setting. Example: it is 5:46 and f.lux believes you have gone from night to day, so it will take {TransitionSpeed} to go from reddish to bluish.

So yeah it does change your screen colour a bit, but I honestly haven’t had any trouble adapting to that (I’d only notice it when the screen is at an odd angle), and my eyes don’t feel quite as tired when spending long times on my PC, especially at night. I couldn’t tell if I sleep better, but I definitely don’t get as much eye strain 🙂

If you want to check out its benefits: install it, stay on the PC until some time at night, then deactivate it (niark!).

f.lux is free and available for Windows, Mac, Linux, and even for iPhone/iPad! I hear they’re also working on an Android version.

Posted in Software, University | Tagged , , , , | Leave a comment