backtrack 5 does not come with a stand-alone postgresql server out-of-the box. metasploit 3.7 though, comes with it's own built-in postgresql server and by-default connects to it on BT5 (type '
db_driver' on a fresh BT5 install or live boot, within msfconsole to see this in action -- note that /opt/framework3/postgresql/data/ is where all the configs reside)! this HOWTO details how you can run your OWN postgresql server and get metasploit to interact with it.
right off the bat I want to thank
sickness for his excellent tutorial =>
Metasploit db_autopwn using PostgreSQL which alot of this doc is sourced (verbatim) to get metasploit up and running. he is the person to be thanked here, I only tweaked things a little to work with BT5.
NOTE: it is NOT required to disable ssl in the postgresql.conf, as the server works without trouble simply be installing postgresql from package.
Code:
apt-get install postgresql libpq-dev
sudo su postgres -c psql
ALTER USER postgres WITH PASSWORD ‘your password’;
\q
sudo passwd -d postgres
sudo su postgres -c passwd
gem install pg
msfconsole
db_driver postgresql
db_connect postgres:”postgreSQL password”@127.0.0.1/metasploit (“metasploit” being the name of the database)
from there your good to go... I created the file
/root/.msf3/msfconsole.rc with the following so I don't have to type the db_* commands each time ::
Code:
db_driver postgresql
db_connect postgres:”postgreSQL password”@127.0.0.1:5432/metasploit
db_workspace -a PWBv3
lastly if you want to change the port postgresql runs on, change the '
port =' setting in the file
/etc/postgresql/8.4/main/postgresql.conf then restart the server via '
/etc/init.d/postgresql-8.4 restart'
-fnord0