[Pidgin] #12144: store passwords in a file which is not constantly written to

Pidgin trac at pidgin.im
Fri Jun 11 05:05:22 EDT 2010


#12144: store passwords in a file which is not constantly written to
-------------------------+--------------------------------------------------
 Reporter:  simon_w      |        Owner:              
     Type:  enhancement  |       Status:  new         
Milestone:               |    Component:  pidgin (gtk)
  Version:  2.7.1        |   Resolution:              
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by simon_w):

 for anyone who might stumble across this, here is my best wrapper-script
 solution for working with gnome-keyring.  it depends on a python script I
 found [https://launchpad.net/gkeyring here] to interact with the gnome-
 keyring itself.  Of course this could all be rolled together into one
 python script, and perhaps I'll do that at some point, but for now I like
 the fact that I can simply swap it out for the GPG encrypted passwords
 file on my fluxbox system.

 {{{
 #!/bin/bash

 GKEYRING=$HOME/scripts/gkeyring.py
 PURPLE_FOLDER=$HOME/.purple
 TEMP_FOLDER=$(mktemp -d)


 function cleanup()
 {
     sed -i'' -e'/<password>/d' $TEMP_FOLDER/accounts.xml
     for i in $(find $TEMP_FOLDER/ -maxdepth 1 -mindepth 1 -type f);
     do
         cp $i $PURPLE_FOLDER/$(basename $i);
     done;
     rm -rf $TEMP_FOLDER
 }

 for i in $(find $PURPLE_FOLDER/ -maxdepth 1 -mindepth 1);
 do
     ln -s $i $TEMP_FOLDER/$(basename $i);
 done;

 rm $TEMP_FOLDER/accounts.xml && cp $PURPLE_FOLDER/accounts.xml
 $TEMP_FOLDER/accounts.xml

 accounts="acct at gmail.com acct2 at hotmail.com acct3 at yahoo.com 999999999"
 #pwds=$(gpg2 --use-agent --decrypt $HOME/passwords/passwords.gpg)

 for acc in $accounts;
 do
     #pwd=$(echo "$pwds" | grep -oP "(?<=$acc ).*")
     pwd=$($GKEYRING -p account=$acc --output=secret)
     sed -i'' -e"s#<name>$acc/*</name>#&\n\t\t<password>$pwd</password>#"
 $TEMP_FOLDER/accounts.xml
 done;

 trap cleanup EXIT

 pidgin --config=$TEMP_FOLDER

 }}}

 This way as much as possible is symlinked.  Since pidgin/purple appears to
 clobber any files it touches the fact that a symlinked file is overwritten
 is not an indication that it has changed, but I figure this will do.
 Comments or suggestions (or pitfalls!) are very welcome.

 Now I can use Dropbox to sync my Pidgin config, without having to enter 6
 different account passwords every time I login!

 Apologies to anyone who might feel this is an inappropriate forum to post
 this, but I think it might be useful to others in my situation.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/12144#comment:1>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list