armitage , postgresql, database connection failed
database armitage postgresql not working
msf5 > db_status [*] postgresql selected, no connection msf5 > workspace [-] Database not connected msf5 > workspace -a lab4 [-] Database not connected msf5 > workspace -a lab4 [-] Database not connected msf5 > workspace -h [-] Database not connected
/etc/init.d/postgresql start Starting postgresql (via systemctl): postgresql.service.
sudo service metasploit start Failed to start metasploit.service: Unit metasploit.service not found.
Armitage connection refused
fata: password authincation faild for msf
armitage Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true [] I will use /home/torpedo/armitage-tmp as a working directory [] Starting msfrpcd for you. [] MSGRPC starting on 127.0.0.1:55553 (NO SSL):Msg... [] MSGRPC ready at 2020-08-06 21:32:09 -0400.
(java:5874): GLib-GObject-WARNING **: 21:32:23.588: invalid cast from 'JawImpl_4098' to 'AtkText'
(java:5874): Atk-CRITICAL **: 21:32:23.588: atk_text_get_character_count: assertion 'ATK_IS_TEXT (text)' failed
(java:5874): GLib-GObject-WARNING **: 21:32:23.588: ../../../gobject/gsignal.c:3599: signal name 'text_changed::delete' is invalid for instance '0x7efb940fe480' of type 'JawImpl_4098'
(java:5874): GLib-GObject-WARNING **: 21:32:23.598: invalid cast from 'JawImpl_4098' to 'AtkText'
(java:5874): Atk-CRITICAL **: 21:32:23.598: atk_text_get_character_count: assertion 'ATK_IS_TEXT (text)' failed
ss -lntp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 224 0.0.0.0:5432 0.0.0.0:*
LISTEN 0 224 [::]:5432 [::]:*
sudo systemctl enable --now postgresql
Synchronizing state of postgresql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable postgresql
i have cp the database.yml from cd /usr/share/metasploit-framework/config/ cp database.yml /var/run/postgresql/.s.PGSQL.5432
and at last when i reinit the msfdb
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)
can anybody guide me???
Had a similar issue recently (when using msfconsole), this is what I did to resolve it, with many thanks to the ParrotSec Community:
sudo make-ssl-cert generate-default-snakeoil
sudo msfdb reinit
Back in msfconsole, running db_status will confirm the Postgres is now connected.
Alternatively, you may wish to disable SSL in the postgresql.conf file at /etc/postgresql/12/main/postgresql.conf.
yes but when i run reinit i got ActiveRecord::ConnectionNotEstablished: connection to server at "::1", port 5433 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?.... i run msf again db_status postgresql selected, no connection i tryed " sudo make-ssl-cert generate-default-snakeoil " but still issue