wood_menu My Weblog My Gallery About me Contact me
Follow me on twitter

January 2010 Archives

OpenID : How to setup your own identity server using SimpleID

OpenID is a way to provide a single digital identity across the Internet. Instead of creating multiple accounts, remember the login/password couples on all the website you visit, you can use a single OpenID identity if this type of authentication is supported by the target website.

An OpenID is in the form of a unique URL, and is authenticated by the user's 'OpenID provider' (that is, the entity hosting their OpenID URL).The OpenID protocol does not rely on a central authority to authenticate a user's identity. Since neither the OpenID protocol nor Web sites requiring identification may mandate a specific type of authentication, non-standard forms of authentication can be used, such as smart cards, biometrics, or ordinary passwords.

While you can create an identity on various providers websites (it's possible you already have one see Get an Openid) you may want to host your own identity server.

There are a lot of identities servers, in various languages (PHP, Ruby, Python, Java...) i've decided to use SimpleID a lightweight PHP-based solution which doesn't rely on any database. Here is an overview of these features :

  • Support for OpenID 1.1 and 2.0
  • Support for Simple Registration Extension 1.0 and 1.1 draft
  • Multiple identities support

 

Installation

Start by downloading the archive at Sourceforge, extract it then move the cache, identities, www folders to your webserver.
Configure your Web Server (apache, lighttpd...) by adding a new virtualhost pointing to the "www" folder. For standard use, you don't need to setup any rewrite rule or anything else.
Rename config.default.inc to config.inc, then edit this file to put correct paths for the different needed folders
 

Add an Identity

Create an identity file called "yournickname.identity" in the identities folder, your apache/lighttpd user must have read access to this file.

identity=http://vhost.yourdomain.tld
pass=3408cad97ec7f9c09775da84048ecc0
[sreg]
nickname=your_nickname
email=yourmail@domain.tld
administrator=1
fullname=John Doe
dob=1957-01-02
gender=M
postcode=1234
country=ch
language=en
timezone=Europe/Zurich

As for the "pass" line, you have to put the MD5 Hash of your password.

That's all, you can now login to SimpleID using your new identity, and use this identity to login in various websites.


Posted by Alexandre De Dommelin on Sat Jan 16 19:53:37 UTC 2010 | Permanent link | File under: Articles

Notifications irssi distant grace a libnotify

Voici une solution pour afficher des notifications locales lors de la réception de messages dans votre irssi distant (sans X forwarding)...

Ne souhaitant pas mettre en place une solution nécessitant l'installation de paquets relatifs à X sur mon serveur, je me suis tourné vers une solution utilisant un script perl intégré à irssi et d'un autre script sur le poste client qui se chargera d'afficher les notifications sur le bureau en les récupérant via SSH

Configuration coté serveur

 
use strict;
use Irssi;
 
sub priv_msg {
        my ($server,$msg,$nick,$address,$target) = @_;
        filewrite($nick." " .$msg );
}
 
sub hilight {
    my ($dest, $text, $stripped) = @_;
    if ($dest->{level} & MSGLEVEL_HILIGHT) {
        filewrite($dest->{target}. " " .$stripped );
    }
}
 
sub filewrite {
        my ($text) = @_;
        open(FILE,">>$ENV{HOME}/.irssi/notifications_log");
        print FILE $text . "\n";
        close (FILE);
}
 
Irssi::signal_add_last("message private", "priv_msg");
Irssi::signal_add_last("print text", "hilight");

Ce bout de code logguera vos messages privés dans le fichier ~/.irssi/notifications_log
C'est fini pour le serveur, passons à la suite.

Configuration côté client

Tout d'abord, commencez par installer le paquet libnotify-bin (en tout cas il s'appelle comme ca sous debian, il fournit le binaire notify-send) Copiez/collez le code ci-dessous dans un fichier que vous placerez dans votre repertoire de scripts persos favoris (~/bin dans mon cas)

 
#!/bin/sh
ssh user@host.tld tail -F -n1 ~/.irssi/notifications_log | while read heading message
do notify-send -i gtk-dialog-info -t 300000 -- "${heading}" "${message}"
done

Pensez à mettre votre login / adresse serveur à la place de "user@host.tld", le bit d'execution sur le script, puis rajoutez une ligne dans votre ~/.xinitrc pour qu'il soit lancé automatiquement lors de votre connexion.


Posted by Alexandre De Dommelin on Tue Jan 12 20:00:00 UTC 2010 | Permanent link