rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
33.79k stars 13.9k forks source link

postgresql selected, no connection #13821

Closed JonathanBergendahl closed 3 years ago

JonathanBergendahl commented 4 years ago

It worked yesterday. I tried using msfdb in linux and when i do db_status i get postgresql selected no connection. I tried to start the database and it doesn't help.

I ran msfdb reinit and i get this error:

msf5 > sudo msfdb reinit
[*] exec: sudo msfdb reinit

[i] Database already started
psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
[+] Deleting configuration file /usr/share/metasploit-framework/config/database.yml
[+] Stopping database
[+] Starting database
psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
[+] Creating database user 'msf'
createuser: error: could not connect to database postgres: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
[+] Creating databases 'msf'
createdb: error: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
[+] Creating databases 'msf_test'
createdb: error: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
[+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
[+] Creating initial database schema
rake aborted!
PG::ConnectionBad: FATAL:  password authentication failed for user "msf"
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_handling.rb:87:in `connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:941:in `initialize'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:823:in `new'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:823:in `up'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:801:in `migrate'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/tasks/database_tasks.rb:139:in `migrate'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
msf5 > 
JonathanBergendahl commented 4 years ago

I tried using commands from these sources: https://myexploit.wordpress.com/metasploit-postgresql-selected-no-connection-error/ https://github.com/rapid7/metasploit-framework/issues/9386 https://github.com/rapid7/metasploit-framework/issues/9271

ss -ant info: jonathan@kali:~$ ss -ant State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 512 127.0.0.1:9390 0.0.0.0:
LISTEN 0 128 127.0.0.1:9392 0.0.0.0:

LISTEN 0 128 127.0.0.1:80 0.0.0.0:
LISTEN 0 128 127.0.0.1:3000 0.0.0.0:

LISTEN 0 224 127.0.0.1:5432 0.0.0.0:
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58514
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58300
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58304
ESTAB 0 0 192.168.0.179:35978 151.101.0.133:443
ESTAB 0 0 192.168.0.179:60738 104.26.10.153:443
ESTAB 0 0 192.168.0.179:44262 172.67.69.208:443
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58334
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58344
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58516
ESTAB 0 0 192.168.0.179:36642 140.82.114.26:443
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58410
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:58342
LISTEN 0 50
:40815 :
LISTEN 0 50 :1716 :
LISTEN 0 128 [::1]:3000 [::]:

LISTEN 0 224 [::1]:5432 [::]:
LISTEN 0 100
:3780 :
ESTAB 0 0 [::ffff:127.0.0.1]:58410 [::ffff:127.0.0.1]:5432
ESTAB 0 0 [::ffff:127.0.0.1]:58342 [::ffff:127.0.0.1]:5432
ESTAB 0 0 [::ffff:127.0.0.1]:58516 [::ffff:127.0.0.1]:5432
ESTAB 0 0 [::1]:3000 [::1]:45650
ESTAB 0 0 [::ffff:127.0.0.1]:58514 [::ffff:127.0.0.1]:5432
ESTAB 0 0 [::ffff:192.168.0.179]:33602 [::ffff:192.168.0.143]:1716
ESTAB 0 0 [::ffff:127.0.0.1]:58304 [::ffff:127.0.0.1]:5432
ESTAB 0 0 [::1]:45650 [::1]:3000
ESTAB 0 0 [::ffff:127.0.0.1]:58300 [::ffff:127.0.0.1]:5432
TIME-WAIT 0 0 [::1]:46672 [::1]:3000
ESTAB 0 0 [::ffff:127.0.0.1]:58344 [::ffff:127.0.0.1]:5432
ESTAB 0 0 [::ffff:127.0.0.1]:58334 [::ffff:127.0.0.1]:5432
ESTAB 0 0 [::ffff:192.168.0.179]:1716 [::ffff:192.168.0.132]:59351

JonathanBergendahl commented 4 years ago

Programs installed before it stopped working: Nessus Nexpose Dradis Ce OpenVas

OS: Kali linux running Kde plasma

github-actions[bot] commented 4 years ago

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

github-actions[bot] commented 3 years ago

Hi again!

It’s been 60 days since anything happened on this issue, so we are going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.