Putting Debian packages on hold -- The dpkg way

At times, for people like me who use a heterogeneous set of packages, it becomes necessary to put certain packages on “hold” so that nothing breaks.

The plain dpkg way of putting packages on hold is very very simple.
I’ll be taking a package named “foo” as an example. Here are the steps:

**pre >1) dpkg –get-selections foo > selections.txt

**
This will give you the package and its state on your system. The output written to selections.txt would be something like this:
**pre >foo install

[Read More]
Categories: Debian-Pages 

New SSH Session in Konsole

Some quick steps to create an Option for “New SSH Session” under Konsole which includes keychain and ssh-agent for password-less ssh logins.

I’m using a Debian system but majority of the steps should be common across all distributions.

  1. Install keychain and openssl-client programs (ssh-agent is part of openssl- client package under Debian)
    rrs@laptop:~ $ apt-get install keychain openssl-client

  2. Add the following lines to your .bashrc file

    For SSH

    For now I’m gambling the linux session for ssh-agent.

    I’ll have to find a better way in the future. 30/09/2005

    if [ $TERM == linux ]; then

    [Read More]
Categories: Tools Computing 

POP3 SSL && Fetchmail

Small HOWTO on configuring POP3 SSL with Fetchmail.
Here I assume that the server’s SSL certificate is a Self Signed Certificate

  1. openssl s_client -connect mail.logicalwebhost.com:995 -showcerts
    Execute this command to fetch the details of the server and also the certificate.
    The output will be something like below:

rrs@laptop:~ $ openssl s_client -connect mail.someserver.com:995 -showcerts
CONNECTED
depth=0 /C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU =Automatically-generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com
verify error:num=18:self signed certificate
verify return:1
depth=0 /C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU =Automatically-generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com
verify return:1

Certificate chain 0 s:/C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU=Automatically-generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com i:/C=US/ST=CA/L=San Jose/O=Some Internet Hosting Services/OU=Automatically- generated POP3 SSL key/CN=mail.somehost.com/emailAddress=postmaster@researchut.com

[Read More]
Categories: Tools Computing 

Python Fun

Just think what all this small piece of code can do

while x <= 100:
… temp = urllib2.urlopen(address+prefix+str(x)+suffix)
… data = open(prefix+str(x)+suffix, ‘wb’ )
… data.write(temp.read())
… data.close()
… temp.close()
… x +=1

Categories: Fun Programming 

An Eyeful a Day Keeps the Doctor Away

Now I understand, why even though staring carelessly for the past 5 years, my health has not gone bad.

Staring at women ’s breasts is good for men’s health and makes them live longer, a new survey reveals.

Staring at women’s breasts is good for men’s health and makes them live longer, a new survey reveals. Researchers have discovered that a 10-minute ogle at women’s breasts is as healthy as half-an-hour in the gym. A five-year study of 200 men found that those who enjoyed a longing look at busty beauties had lower blood pressure, less heart disease and slower pulse rates compared to those who did not get their daily eyeful.

[Read More]
Categories: Fun 

*nix fun

#!/bin/sh

if ! [test -f /dev/chick] echo “Forgetting something?” exit 1;
fi

mv /dev/chick ~/bedroom
touch chick/breasts
unzip chick/dress
rm -f chick/bra chick/panties
clamscan chick/*
rm ~/pants
cat ~/penis » chick/mouth
cat chick/mouth | grep -v cat ~/penis > chick/mouth # To take it out…
cat ~/bedroom/nightstand/condom » ~/penis
mount ~/bedroom/chick
fsck && fsck && fsck
umount ~/bedroom/chick
while [ -f ~/bedroom/chick ]; do sleep 5
done

… but this is from the guy who has /dev/acd0 symlinked to /dev/chick so he can giggle every time he uses his cdrom

[Read More]
Categories: Fun 

A general weekly life

How has your life been going ?
Ever asked this question to yourself. Do you ever feel yourself lonely; missing ?
Two days of the weekend “silenced” being ended up with Sci-Fi movies and Mugs of Beer at a dark cosy Peecos.
Does it mean life ? Oh! Yes. No dependencies, no nothing. Just bindaas

Categories: Psyche 

Kernel Prayer

Our kernel who art in the protected memory areas hallowed
be thy interfaces (syscalls). thy init(8)/init(1M) come.
thy will (memory protection and processes scheduling) be
done on the userspace as it is done where thou reside.
and give us our regular time quanta and forgive us our
memory trespasses (violations) as we forgive to the
meatware (and the software developers). and lead us
not into a fault but deliver us from the SIGSEGV. amen.

Categories: Fun 

Who says GUI Programming in shell is difficult ?

Today, I wanted a quick utility to help me enter passwords for encfs during mount.
I was looking for something plain, simple and userfriendly.
At the end I ended up to use the shell for it.

Yes, using dialog/Xdialog you can be a GUI programmer in minutes.

If the text is scrambled, you can download the script here.

Cheers!

#!/bin/bash

  1. encfsmount - A simple frontend for encfs
  2. (C) Ritesh Raj Sarraf July 2005

  1. Available only under the GPL

PATH="/bin:/sbin:/usr/bin:/usr/sbin:/home/rrs/bin"  
export PATH

XDIALOG_HIGH_DIALOG_COMPAT=1  
export XDIALOG_HIGH_DIALOG_COMPAT

  1. && exec sudo "$0" "$@"

ASKPASS=`which ssh-askpass`;  
CRYPT="/mnt/windoze/.linuxrc";  
TARGET="/var/tmp/.linuxrc";  
FUSERMOUNT=`which fusermount`;  
ENCFS=`which encfs`;  
ARGS="-u";

#set -vx

DIALOG=`which dialog`;  
[ -n "$DISPLAY" ] && [ -x /usr/bin/Xdialog ] && DIALOG="Xdialog"

mount()  
{ # This is one good way to use dialog to accept passwords # But for some
reason encfs isn't able to read the password # supplied by dialog # Hence, I'm
using ssh-askpass to get the password #$ENCFS $CRYPT $TMP --extpass=`$DIALOG
--title "Password" --password --inputbox "Enter Password" 18 45 2`;

# This uses ssh-askpass $ENCFS $CRYPT $TARGET --extpass=$ASKPASS;

}

check_mount()  
{ # Since encfs isn't returning good exit status # I'm using this hack to
figure out if the mount # passed or failed. grep -i encfs /etc/mtab;
retval=$?;

case $retval in 0) $DIALOG --wrap --title "Information"\ --msgbox
"Successfully Mounted!" 10 41;; 1) $DIALOG --wrap --title "Information"\
--msgbox "Mount Failed!" 10 41;;  
esac  
}

prelim_mount_check()  
{ grep -i encfs /etc/mtab; retval=$?;

case $retval in 0) $DIALOG --wrap --title "Caution"\ --yesno "ALREADY
MOUNTED!\nDo you want to umount ?" 0 0

case $? in 0) umount; esac;; 1) #$DIALOG --wrap --title "Information"\
#--yesno "Do you want to mount crypt ?"\ #case $? in # 0) mount; check_mount;;
#esac;; esac }

umount()  
{ $FUSERMOUNT -u $TARGET;  
}

ask_passwd()  
{ $DIALOG --wrap --title "Password"\ --help "Contact Author Ritesh Raj
Sarraf\nEmail: rrs@researchut.com"\ --inputbox "Please enter your password" 18
45 2 > /tmp/passwd.$$;

retval=$?;  
$INPUT=`cat /tmp/passwd.$$`; #rm -f /tmp/passwd.$$;

case $retval in 0) mount;; #echo "Password is '$input'";; 1) echo
"Cancelled";; 255) echo "Box Closed";;  
esac  
}

main()  
{ $DIALOG --wrap --title "Question"\ --help "Contact Author Ritesh Raj
Sarraf\nEmail: rrs@researchut.com"\ --yesno "Do you want to mount your
encrypted filesystem ?" 0 0

case $? in 0) prelim_mount_check;; 255) $DIALOG --wrap --title "Aborted"\
--infobox "Cancelled"  
esac  
}

main
Categories: Programming  Tags: shell