Metasploit && PostgreSQL
Righto, so the other day I obliterated my postgre install, don’t ask me why or how. It suffice to say it was gone. Add to the fact that metasploit has deprecated the db_driver command, only supporting postgre now, so the sqlite3 instance I had is no more. Oh and if at any point during this post you sit there thing, what the fuck is he on about, I’m writing it as I understand, which might not be correct.
Anyway, I installed postgress and setup a new user. I have constant issues with my Internet connection between home and campus (both going through the university connection, only one requires proxy auth). apt-get was failing and I hate constantly changing settings so I just downloaded and compiled from source.
wget <postgres URL> tar -xvf postgres-version && cd postgres-version ./configure make make install
Made a postgres user for metasploit, created a database and granted permissions to the metasploit user.
sudo -u postgres psql postgres-# create user msfuser with password 'somepassword'; postgres-# create database msfdb; postgres=# grant all privileges on database msfdb to msfuser;
I then fired up metasploit, connected to the db and thought everything was fine, but everytime I restarted my msfconsole session it would forget my db settings. mep.
Anyway, so did some digging in /opt/metasploit-X.X.X/config/
found the database.yml configuration and edited it to match the newly made database settings. Now everything is happy again and peace has been restored, no more msfconsole - n to keep it from crying…