Recently I needed to access my keepass database file from a console. Keepass is a wonderful tool to store passwords. It's Linux counterpart keepassX is available in most major distributions.
However, keepassX is a graphical tool and I was booting from a console based distro with a very limited set of libraries. I said to myself, that it would be cool to be able to open keepass files from the console.
After some Google searches, I've found the ckpass project on sourceforge that does exactly what I wanted.
It depends on ncurses, openssl and libkpass.
I wanted to compile that all statically, so I could put it on my usbkey / dropbox and use it in case of emergency.
Here's a recipe I've made to compile ckpass-0.1 statically (32bit ELF) on Ubuntu 10.04 64bit.
(I needed a 32bit version so it can run on most small Linux distro available)
First of all create a work directory where you are going to download everything. (e.g /tmp/work)
mkdir /tmp/work
cd /tmp/work
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz
UPDATE
If you have a problem when starting ckpass (error opening terminal)
Don't forget to export the TERMINFO before executing ckpass.
export TERMINFO=/usr/share/terminfo/
on some distribution you will have to do :
export TERMINFO=/lib/terminfo/
However, keepassX is a graphical tool and I was booting from a console based distro with a very limited set of libraries. I said to myself, that it would be cool to be able to open keepass files from the console.
After some Google searches, I've found the ckpass project on sourceforge that does exactly what I wanted.
It depends on ncurses, openssl and libkpass.
I wanted to compile that all statically, so I could put it on my usbkey / dropbox and use it in case of emergency.
Here's a recipe I've made to compile ckpass-0.1 statically (32bit ELF) on Ubuntu 10.04 64bit.
(I needed a 32bit version so it can run on most small Linux distro available)
First of all create a work directory where you are going to download everything. (e.g /tmp/work)
mkdir /tmp/work
cd /tmp/work
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz
wget http://mirror.switch.ch/ftp/mirror/openssl/source/openssl-1.0.0c.tar.gz
wget http://downloads.sourceforge.net/project/ckpass/ckpass-0.1.tar.gz
wget http://downloads.sourceforge.net/project/libkpass/libkpass-3/libkpass-3.tar.gz
tar xzf ncurses-5.7.tar.gz
tar xzf openssl-1.0.0c.tar.gz
tar xzf ckpass-0.1.tar.gz
tar xzf libkpass-3.tar.gz
you might need to get the package install libc6-dev-i386
sudo apt-get install libc6-dev-i386
BASEDIR=/tmp/work
PREFIX=${BASEDIR}/install/
OPENSSL_HOME=${BASEDIR}/openssl-1.0.0c
LIBKPASS_HOME=${BASEDIR}/libkpass-3
CKPASS_HOME=${BASEDIR}/ckpass-0.1
NCURSES_HOME=${BASEDIR}/ncurses-5.7
cd ${OPENSSL_HOME}
make clean;./Configure linux-elf -m32 no-dso no-shared --prefix=${PREFIX} && make install
cd ${LIBKPASS_HOME}
make clean;./configure --prefix=${PREFIX} --disable-shared LDFLAGS="-L${OPENSSL_HOME} -m32" CFLAGS="-m32 -I${OPENSSL_HOME}/include" && make install
cd ${NCURSES_HOME}
make clean;./configure --prefix=${PREFIX} --without-cxx --disable-shared LDFLAGS="-L${OPENSSL_HOME} -m32" CFLAGS="-m32 -I${OPENSSL_HOME}/include" && make install
cd ${CKPASS_HOME}
make clean; ./configure LDFLAGS="-static -L${OPENSSL_HOME} -L ${LIBKPASS_HOME}/.libs -m32 $(${PREFIX}/bin/ncurses5-config --libs)" CFLAGS="-m32 -I${OPENSSL_HOME}/include -I${LIBKPASS_HOME}/src $(${PREFIX}/bin/ncurses5-config --cflags)" LIBS="-lssl -lcrypto -lkpass -lncurses" && make && strip ckpass
After everything is done "file ckpass" should output this :
ckpass: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.15, stripped
I recommend to build every library one by one (do not copy & paste the whole thing). If you have an error during the execution of configure, check config.log, it contains precious informations to help you debug.
If you want to try it yourself and you have some problems doing it, feel free to post a comment, I will try to help you out.
For your convenience, I've uploaded the binary here
For your convenience, I've uploaded the binary here
UPDATE
If you have a problem when starting ckpass (error opening terminal)
Don't forget to export the TERMINFO before executing ckpass.
export TERMINFO=/usr/share/terminfo/
on some distribution you will have to do :
export TERMINFO=/lib/terminfo/
No comments:
Post a Comment