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

Notification in Ratpoison WM when new unread mail in Mutt

After some time spent on Google to find a solution, somebody in #mutt told me to have a look at the status_format option in which we can call an external script ...

The relevant part of the ~/.ratpoisonrc :

set status_format="/usr/local/bin/notify.sh '%r %f (%L) [Msgs:%?M?%M/?%m%?n? New:%n?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?]'|"

/usr/local/bin/notify.sh (quick 'n dirty but it works!) :

#!/bin/bash
#
# Small script which display a message in ratpoison 
# when new incoming mail
#

echo "$1" | grep -q "New" > /dev/null 2>&1

if [ $? -eq 0 ];
then
  ratpoison -c "echo Unread mail in Inbox"
fi

echo "$1"


Posted by Alexandre De Dommelin on Tue Jun 15 20:00:00 UTC 2010 | Permanent Link | Categories: Articles

Yubiauth : Two-factor authentication with Yubikey in OpenSSH

Some times ago I've described a quick solution to setup two-factor authentication with OpenSSH & Yubikey. I've made a clean Perl rewrite of the script with new features.

Working features :

  • Config file in INI format
  • Multiple Yubikeys support for each user
  • "Whitelist" : you can define IP (or networks using CIDR notation) for clients which doesn't need to provide OTP.
  • HMAC verification
  • Error logging

Planned features :

  • Integration of PreludeEasy to report authentication failures to your Prelude SIEM manager.


Available from my Git repository.


Posted by Alexandre De Dommelin on Mon Jun 14 20:05:00 UTC 2010 | Permanent Link | Categories: Articles

Improve web browser integration within Ratpoison WM

Here is a solution based on a custom perl script to improve the integration of your web browser inside Ratpoison.

Ratpoison is a keyboard driven window manager.
I've written a small perl script designed to be called via standard Ratpoison bind functions to interact with Midori (can be easily used with other web browsers). Here are the default binds :

  • :gg : search for in google.com
  • :dp : load packages.debian.org page of
  • :db : load bugs.debian.org page of
  • :wi : search for in Wikipedia

There is also a shortcut (actually bind to escape-g) which send the current selection to the browser, if the selection is an URL, load it into the browser, otherwise search for string in Google.

Relevant part of my ~/.ratpoisonrc :

# Browser Wrapper
bind g exec ~/bin/browser_wrapper.pl selection `$RATPOISON -c getsel`
alias gg exec ~/bin/browser_wrapper.pl gg
alias dp exec ~/bin/browser_wrapper.pl dp
alias db exec ~/bin/browser_wrapper.pl db
alias wi exec ~/bin/browser_wrapper.pl wi

~/bin/browser_wrapper.pl :

#!/usr/bin/perl

{
  my $shortcut = $ARGV[0] || 'gg';
  my $browser = "/usr/bin/midori";
  my $request = undef;
  my $url = undef;

  foreach $argnum ( 1 .. $#ARGV ) {
    $request .= $ARGV[$argnum].'%20';
  }

  $request =~ s/\%20$//;

  my $shortcuts_table = {
    'gg' => sub {
              $url = "http://www.google.fr/search?q=" . $request;
              system( $browser . " " . $url );
            },

    'dp' => sub {
              $url = "http://packages.debian.org/" . $request;
              system( $browser . " " . $url );
            },

    'db' => sub {
              $url = "http://bugs.debian.org/" . $request;
              system( $browser . " " . $url );
            },

    'wi' => sub {
              $url = "http://en.wikipedia.org/wiki/" . $request;
              system( $browser . " " . $url );
            },

    'selection' => sub {
              if ( $request =~ m/^http:\/\/.*/ ) {
                $url = $request;
              } else {
                $url = "http://www.google.fr/search?q=" . $request;
              }
              system( $browser . " " . $url );
            }
  };

  $shortcuts_table->{$shortcut} ? $shortcuts_table->{$shortcut}->() : $shortcuts_table->{'gg'}->();
}
0;

Posted by Alexandre De Dommelin on Mon Jun 14 20:00:00 UTC 2010 | Permanent Link | Categories: Articles

View HTML emails inside Mutt

More a reminder than a real post, here's how to display HTML emails inside Mutt using w3m.

Put the following line into ~/.mailcap :

text/html; w3m -I %{charset} -T text/html -dump; copiousoutput

And just append :

auto_view text/html

in ~/.mutt/muttrc


Posted by Alexandre De Dommelin on Tue Jun 08 20:00:00 UTC 2010 | Permanent Link | Categories: Tips

New Debian package : libnet-akamai-perl

This package provides a perl module to interact with Akamai CCUAPI to handle multiple purge requests.

Package : http://packages.debian.org/sid/libnet-akamai-perl
Bugs : http://packages.debian.org/libnet-akamai.perl


Posted by Alexandre De Dommelin on Fri May 28 20:00:00 UTC 2010 | Permanent Link | Categories: Tips