msfconsole on Windows, get error:Failed to connect to the database: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5433?
msfdb reinit and then running msfconsole fixes the issue but only for a single instance of msfconsole. Restarting or exiting session and running again results in the same errorMsfconsole should connect to db without issue on every start.
On start, database fails to connect due to "connection refused."
If I run msfdb init before running msfconsole it connects fine, but wiping the database before every time I run metasploit is not something I want in the long run.
db_status returns:
[*] postgresql selected, no connectiondb
after running db_connect -y C:\Users\myuser\.msf4\database.yml, db_status returns the same
Windows 10 Pro
10.0.17134 Build 17134
Framework: 4.17.17-dev-2ce34b4a0e4c4610079fad98a50e068bd50be6fa
Console : 4.17.17-dev-2ce34b4a0e4c4610079fad98a50e068bd50be6fa
Windows installer from official website
This is a fresh install and I have limited experience running metasploit on Windows so I'm not sure if this is a bug or if there is some configuration needed on my end.
What's your postgres configuration? Maybe correct its config would fix it.
I have no idea how to check that as I didn't need to install postgresql separately from metasploit.
@dotaxis If you do not need the features relevant to db, just ignore this error message, it would not disturb the remaining functions.
I do make use of features relevant to the db. Even if I didn't, using metasploit without it considerably slows down the search function of msfconsole.
No, for now, the search command did not rely on the db.
If you actually want to use it, correct its config and check it again.
You gave me literally no info on how to find or correct the db config for metasploit on Windows and just closed the issue lmao.
Thanks for all your help.
It is neither a issue nor a bug, even a msf problem. Come on, try to drill
it down. I would reopen if there is acutually a issue.
On Sun, Oct 14, 2018 at 15:52 Chase Taylor notifications@github.com wrote:
You gave me literally no info on how to find or correct the db config for
metasploit on Windows and just closed the issue lmao.Thanks for all your help.
—
You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub
https://github.com/rapid7/metasploit-framework/issues/10805#issuecomment-429604469,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AVfdHoH2PmdlZl49fXYWftJl_gIrmp-Mks5uku1CgaJpZM4Xa_k8
.>
Green-m
There is literally zero information on the web about how to configure the database for Windows since the installer is supposed to handle all of that automatically. There is very little information on the web involving Metasploit on Windows in general.
You asked me to give you my postgres configuration and I said I didn't know how to find it on Windows so you said "just ignore it if you're not using the db." I told you I plan to and you closed the issue.
I'm not some computer illiterate scrub coming here looking for a tutorial on how to do the 1337 h4x I'm just generally unfamiliar with how metasploit runs on Windows.
If you have the authority to close the issue because you know it's not an issue, you could at least throw me a bone and point me in the right direction because I haven't had issues like this on other OS's.
If I remember correctly that metasploit nightly installer would not install the PostgreSQL automated.
That means you have to install it manually, try the official doc for PostgreSQL on windows, configure it by the prompt, listening 127.0.0.1:5433
Doc: https://www.postgresql.org/download/windows/
And I recommend you to use the IRC or slack to ask this type of "How to use xxx" questions.
Oh, sorry, I forgot a detail, are you able to run the db commands such as hosts or loot in msfconsole after reinit the db?
I didn't use the nightly but I'll try uninstalling metasploit and using the nightly along with a manual install of PostgreSQL.
All of those commands run properly after running msfdb reinit which is why I posted the issue. The database connection only seems to be valid for a single session.
I'll try a fresh install with the nightly and an isolated postgresql install in the morning.
edit: msfdb reinit not msfdb init
I am sorry, I just missed some detail carelessly and misunderstood what you mean, this may be an issue.
Reopened.
I fixed this by installing PostgreSQL as a standalone (it is included with the installer for Windows) and manually creating the 'msf' database and user, then editing C:\Users\myuser\.msf4\database.yml to point to the port I setup the new PostgreSQL installation to run on.
This is only a workaround and there is clearly something wrong with the postgres configuration that comes bundled with the metasploit framework.
Also, the search function does, in fact, use the database. It is basically instant when the database is functioning and takes up to a few minutes when it's not.
Hi, we recently made some updates to the database server for Windows installs that should fix the issue you observed. https://github.com/rapid7/metasploit-omnibus/pull/93 , though it does remove Windows 7 support IIRC.
Though you have a workaround, hopefully this helps for future installs. Thanks for the report @dotaxis
It looks like we need to actually start the database if needed in the msfconsole.bat wrapper. Currently it doesn't do this. So not fixed by the latest update.