This is the first time I use MSF on other systems than Kali. And currently there is some issue with msfdb
scripts, so I’m gonna set it up manually. Let’s get started.
1
2
3
4
5
6
7
8
9
$ sudo pacman -S postgresql metasploit
$ sudo -iu postgres
[postgres]$ initdb -D /var/lib/postgres/data
[postgres]$ exit
$ sudo systemctl enable --now postgresql
$ sudo -iu postgres
[postgres]$ createuser msf -P --interactive
[postgres]$ createdb --owner=msf msf
[postgres]$ exit
Now run msfconsole
the first time to create .msf
directory. Once the console is initialised, try connecting to the database:
1
msf5 > db_connect msf@msf
If succeeded, exit msfconsole
, and edit the following file:
1
$ vim ~/.msf4/database.yml
It’s funny that the directory is still called .msf4
while the current version is msf5
. May be it’s for compatibility? For new users the directory should be created as .msf5
though. Paste the following and change ${PASS}
.
1
2
3
4
5
6
7
8
9
production:
adapter: postgresql
database: msf
username: msf
password: ${PASS}
host: localhost
port: 5432
pool: 5
timeout: 5
Now run msfconsole
, and it should connect to the database automatically. Check this with:
1
2
msf5 > db_status
[*] Connected to msf. Connection type: postgresql.
Done. We may also want to double check postgresql
is only listening on localhost
.
1
2
3
4
$ ss -nltp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:5432 0.0.0.0:*
LISTEN 0 128 [::1]:5432 [::]:*