Hi Ulairi,
Thanks for this temporary solution. it worked and helped me.
Hope this issue will be fixed soon.
Hi there,
Connection to the postgresql database doesn't work for metasploit after the last updates.
You can check that from msfconsole by typing : db_status which shows : postgresql selected, no connection
As a temporary solution (I hope ;-)), you can, from the msfconsole, type : db_connect -y /opt/metasploit/apps/pro/ui/config/database.yml
This is automatically rebuild the cache and get you connected to the database.
Hope that helps someone out there.
Hi Ulairi,
Thanks for this temporary solution. it worked and helped me.
Hope this issue will be fixed soon.
Thx!
I hope the solution comes this week.
TNX! for fast-fix!!
in one of my kali-machine(a week-ago i've created my-new-database && db_connect-to-it..&& worked) BUT your Fast-Fix ES MEJOR!!!!!
http://www.imagestime.com/show.php/972630_1.PNG.html
Last edited by zimmaro; 2014-09-08 at 09:11.
I had this same error from a brand-new install (Kali 1.0.9 ISO image). I installed it a couple of times thinking that I must have done something to screw it up. When that didn't work, I did an "apt-get purge metasploit" followed by an "apt-get install metasploit", but that didn't fix it. I then tried Ulairi's solution, but got a "file not found" error message when I tried connecting. I then manually went to the folder "/opt/metasploit/apps/pro/ui/config/" and found that there weren't any YML files. However, there was the familiar looking file, "database.yml.example". I copied this file to "database.yml", and the db_connect worked and all seems well, now.
I'm not sure where in the install/configuration steps this database is supposed to be created or renamed, but it's not happening.
hi
if this can be a possibily help && the "the-FIX" by Ulairi(tnx worked in my kali) not """worked""can try this:
this is the OLD procedure USED in bt5-r3 to create a NEW database in postgresql to worked with metasploit...&& worked fine in ONE of my kali's machine
root@bt:~# apt-get install postgresql ###optional or no need#######
root@bt:~# sudo apt-get install libpgsql-ruby #####optional or no need#####
root@bt:~# sudo su postgres
sh-4.1$ createuser root -P
could not change directory to "/root"
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
sh-4.1$ createdb --owner=root metasploit
could not change directory to "/root"
exit
sh-4.1$ exit
exit
root@bt:~# msfconsole
msf > db_driver postgresql[*] Using database driver postgresql ####optional or no need##
msf > db_connect root:toor@127.0.0.1:5432/metasploit
db_workspace -a MyProject
*] Added workspace: MyProject
msf > db_nmap 192.168.1.165 -sS -O[*] Nmap: Starting Nmap .................................................. .................................................. ..........
.................................................. .................................................. ......................
................................
the work is perfect (FOR ME)
bye
Last edited by zimmaro; 2014-09-08 at 09:28.
This all came about with the release of 4.10. Rapid7 is aware of the 'aftermath' of it. For more information ~ https://community.rapid7.com/communi...ting-the-wheel
In short, you need to tell Metasploit the database location if you upgrade. (If you do a fresh install, its been fixed).
Method one - point to the database (you can copy or soft-link. I prefer to soft-link.).
ORCode:ln -sf /opt/metasploit/apps/pro/ui/config/database.yml /root/.msf4/database.yml #cp /opt/metasploit/apps/pro/ui/config/database.yml /root/.msf4/database.yml
Method two - use an alias when starting up msfconsole
Code:file=/root/.bash_aliases; [ -e $file ] grep -q '^alias msfconsole' $file 2>/dev/null || echo -e '\n### Metasploit\nalias msfconsole="msfconsole db_connect -y /opt/metasploit/apps/pro/ui/config/database.yml"\n' >> $file source $file
Last edited by g0tmi1k; 2014-09-16 at 10:17.
This is a Kali-Linux support forum - not general IT/infosec help.
Useful Commands: OS, Networking, Hardware, Wi-Fi
Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
Hardware: Recommended 802.11 Wireless Cards
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/
Thanks G0m1k. It worked for me by copying the database file.
"db_connect -y /etc/dradis/database.yml" it would be working for every kali 2.0 user.![]()
DO NOT DO THIS..
This is linking the use of a 3rd party application (database) into Metasploit & progresql.
If you are using Kali 2 or kali rolling, use msfdb init
As you can see - it will create the database file for you /usr/share/metasploit-framework/config/database.ymlCode:root@kali:~# msfdb init Creating database user 'msf' Enter password for new role: Enter it again: Creating databases 'msf' and 'msf_test' Creating configuration file in /usr/share/metasploit-framework/config/database.yml Creating initial database schema root@kali:~#
...if something goes wrong, msfdb reinit
This is a Kali-Linux support forum - not general IT/infosec help.
Useful Commands: OS, Networking, Hardware, Wi-Fi
Troubleshooting: Kali-Linux Installation, Repository, Wi-Fi Cards (Official Docs)
Hardware: Recommended 802.11 Wireless Cards
Search: https://www.kali.org/search/
Documentation: http://docs.kali.org/ (Offline PDF version)
Bugs Reporting & Tool Requests: https://bugs.kali.org/
Kali Tool List, Versions & Man Pages: http://tools.kali.org/
What if someone has already used "db_connect -y /etc/dradis/database.yml" ?
How can they revert the changes?
I'm facing this problem, and i did all that.. but the connection keep failing..
:\ tks!!Code:[-] Failed to connect to the database: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? _---------. .' ####### ;." .---,. ;@ @@`; .---,.. ." @@@@@'.,'@@ @@@@@',.'@@@@ ". '-.@@@@@@@@@@@@@ @@@@@@@@@@@@@ @; `.@@@@@@@@@@@@ @@@@@@@@@@@@@@ .' "--'.@@@ -.@ @ ,'- .'--" ".@' ; @ @ `. ;' |@@@@ @@@ @ . ' @@@ @@ @@ , `.@@@@ @@ . ',@@ @ ; _____________ ( 3 C ) /|___ / Metasploit! \ ;@'. __*__,." \|--- \_____________/ '(.,...."/ Taking notes in notepad? Have Metasploit Pro track & report your progress and findings -- learn more on http://rapid7.com/metasploit =[ metasploit v4.11.5-2016010401 ] + -- --=[ 1517 exploits - 875 auxiliary - 257 post ] + -- --=[ 437 payloads - 37 encoders - 8 nops ] + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ] msf > db_status [*] postgresql selected, no connection
Hey, after 2 days i've found the solution here.
https://forums.kali.org/showthread.p...mitage-problem
tks, it worked.
this is what i use in kali linux rolling hope it helps
sudo service postgresql start
sudo msfconsole
msf>db_connect postgresql
hope it works