(gdb) break *0x972

Debugging, GNU± Linux and WebHosting and ... and ...

What I Like with *nix OSes, II : Free and Open Source Software

In my previous post on what I like with *nix OSes, programmability and composability, I didn't mention one point that is globally orthogonal, but still participates to programmability aspect: the is a very large set of Free, Libre and Open Source Software (FLOSS). I don't contribute much to these projects (I'd like to but I lack time, I already spend too much time working on my own projects), but in "exchange", I do my best to show (to myself mainly) that the FLOSS ecosystem is mature enough to use it daily. I won't say I use it exclusively, but anytime I can choose, I favor FLOSS software and FLOSS-friendly hardware.

Why would I crack (or pay for) an application when someone happily made it for free? Nowadays, after quite a longtime in this mindset, I'm honestly surprised and astonished when I hear someone saying, "I use a cracked version; I can find you a crack for that tool". In my computing world this doesn't make sense anymore!

At the end of my PhD thesis redaction, I tried to enumerate the FLOSS tools I used my research work, and during the redaction of the manuscript:

Let me also give a practical example of why I FLOSS tools:

Simple/single SSH-based Sign-on

One month ago, I read this article on Hacker News: Signing in to websites with SSH. Although what they discuss is too advanced for my needs, I loved the idea, and I wanted it in some the tools I use.

Step 1: ssh connection

cat >> ~/.bashrc << EOF
ssh_connect_me () {
    ssh 0x972.info /home/kevin/.ssh_log_me
}
EOF

Step 2: remember ssh connection

cat > ~/.ssh_log_me << EOF
#!/bin/bash

WHERE=/var/www/alternc/k/kevin/.ssh_autologin
echo $SSH_CONNECTION | cut -d" " -f1 > $WHERE
echo 'Logged in !' $(cat $WHERE)
EOF
chmod u+x ~/.ssh_log_me

Step 3: adapt tools for autologin

Blogotext:

// autologin for SSH authenticated ips
$AUTOLOGIN_FILE = "/var/www/alternc/k/kevin/.ssh_autologin";
$autologin = FALSE;
if (file_exists($AUTOLOGIN_FILE)
    //&& (time() - filemtime($AUTOLOGIN_FILE)) < 60*60*12 // file is newer than 12h
    && $_SERVER["REMOTE_ADDR"] == str_replace("\n", "", file_get_contents($AUTOLOGIN_FILE))) {
    $autologin = TRUE;
    touch($AUTOLOGIN_FILE);
    $_POST['nom_utilisateur'] = $GLOBALS['identifiant'];
    $_POST['mot_de_passe'] = $GLOBALS['mdp'];
}

Selfoss:

// autologin for SSH authenticated ips
$AUTOLOGIN_FILE = "/var/www/alternc/k/kevin/.ssh_autologin";
if (file_exists($AUTOLOGIN_FILE)
   // && (time() - filemtime($AUTOLOGIN_FILE)) < 60*60*12 // file is newer than 12h
   && $_SERVER["REMOTE_ADDR"] == str_replace("\n", "", file_get_contents($AUTOLOGIN_FILE)))
{
    touch($AUTOLOGIN_FILE);
    $this->loggedin = true;
}

That's nothing complicated, but quite convenient for me! Each time my IP changes, I run ssh_connect_me, and I'm logged in immediately. I'm not sure how secure it is, I'm got daily backups for both databases and nothing confidential accessible to them, so I guess this is safe enough. I initially put a time limit, but I don't see any real interest after all.