View previous topic :: View next topic |
Author |
Message |
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Thu May 31, 2018 7:49 pm Post subject: [Solved] Metasploit fail to connect to database |
|
|
Hello, i have problem, when i start msfconsole, i have this error:
Code: | [-] Failed to connect to the database: ActiveRecord::ConnectionNotEstablished |
Strange, because i'm connected to internet...
Last edited by Fulgurance on Sat Jan 05, 2019 10:59 am; edited 1 time in total |
|
Back to top |
|
|
Maxxx Guru
Joined: 12 Jan 2016 Posts: 595 Location: Italia
|
Posted: Mon Jun 04, 2018 6:44 am Post subject: |
|
|
Did you start /etc/init.d/postgresql service? |
|
Back to top |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Mon Jun 04, 2018 11:14 pm Post subject: |
|
|
Normally, yes. I have added this with rc-update when my computer start.But it's strange, when i would like to start manually postgresql, terminal ask me to enter root password ! He ignore my sudo command... And i have disabled root account for security...
Code: | zohran@msi-gs73vr-6rf ~ % sudo rc-service postgresql-10 restart
Authenticating root.
Password:
zohran@msi-gs73vr-6rf ~ % rc-update show
binfmt | boot
bootmisc | boot
bumblebee | default
cgroups | sysinit
devfs | sysinit
dhcpcd | default
dmesg | sysinit
fsck | boot
hostname | boot
hwclock | boot
keymaps | boot
killprocs | shutdown
kmod-static-nodes | sysinit
local | default nonetwork
localmount | boot
loopback | boot
modules | boot
mount-ro | shutdown
mtab | boot
netmount | default
opentmpfiles-dev | sysinit
postgresql-10 | default
procfs | boot
root | boot
savecache | shutdown
swap | boot
sysctl | boot
sysfs | sysinit
sysklogd | default
termencoding | boot
udev | sysinit
udev-trigger | sysinit
urandom | boot
wpa_supplicant | default |
|
|
Back to top |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Fri Sep 07, 2018 8:14 am Post subject: |
|
|
No more idea ? I have updated to the last version of postgresql (11), but the same problem ... |
|
Back to top |
|
|
n05ph3r42 Tux's lil' helper
Joined: 11 Jul 2016 Posts: 134
|
Posted: Fri Oct 12, 2018 6:44 pm Post subject: |
|
|
did you configured database.yml correctly?
did you set MSF_DATABASE_CONFIG variable? |
|
Back to top |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Sat Oct 27, 2018 8:58 pm Post subject: |
|
|
Where i configure this variable ? What file ? |
|
Back to top |
|
|
Muso Veteran
Joined: 22 Oct 2002 Posts: 1052 Location: The Holy city of Honolulu
|
Posted: Sat Oct 27, 2018 11:10 pm Post subject: |
|
|
Code: | /etc/init.d/postgresql-11 start |
Then launch msfconsole, and inside of msfconsole do this :
This will eliminate the "using slow search" issue.
Fulgurance wrote: | And i have disabled root account for security... |
Odd choice. Many pentest tools play better as root. _________________ "You can lead a horticulture but you can't make her think" ~ Dorothy Parker
2021 is the year of the Linux Desktop! |
|
Back to top |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Sun Nov 11, 2018 11:52 am Post subject: |
|
|
I have found the true problem:
Code: | fulgurance@msi-gs73vr-6rf ~ $ pg_ctl start
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information. |
Where i configure this variable ? With what metasploit configuration file ? |
|
Back to top |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Tue Nov 20, 2018 4:16 pm Post subject: |
|
|
I have found where is set this variable, in /etc/conf.d/postgresql-11 file, but this variable is set !
But correctly ? I don't know:
Code: | # Comma-separated list of directories that contain a unix
# socket. Created and controlled by the related initscript. The
# directories created will be owned root:postgres with mode 1775.
#
# /run/postgresql is the default directory.
PG_SOCKET_DIRECTORIES="/run/postgresql"
# Which port and socket to bind PostgreSQL
PGPORT="5432"
# How long to wait for server to start in seconds
START_TIMEOUT=10
# NICE_QUIT ignores new connections and wait for clients to disconnect from
# server before shutting down. NICE_TIMEOUT in seconds determines how long to
# wait for this to succeed.
NICE_TIMEOUT=60
# Forecfully disconnect clients from server and shut down. This is performed
# after NICE_QUIT. Terminated client connections have their open transactions
# rolled back.
# Set RUDE_QUIT to "NO" to disable. RUDE_TIMEOUT in seconds.
RUDE_QUIT="YES"
RUDE_TIMEOUT=30
# If the server still fails to shutdown, you can force it to quit by setting
# this to YES and a recover-run will execute on the next startup.
# Set FORCE_QUIT to "YES" to enable. FORCE_TIMEOUT in seconds.
FORCE_QUIT="NO"
FORCE_TIMEOUT=2
# Extra options to run postmaster with, e.g.:
# -N is the maximal number of client connections
# -B is the number of shared buffers and has to be at least 2x the value for -N
# Please read the man-page to postmaster for more options. Many of these
# options can be set directly in the configuration file.
#PGOPTS="-N 512 -B 1024"
# Pass extra environment variables. If you have to export environment variables
# for the database process, this can be done here.
# Don't forget to escape quotes.
#PG_EXTRA_ENV="PGPASSFILE=\"/path/to/.pgpass\""
##############################################################################
#
# The following values should not be arbitrarily changed.
#
# `emerge --config dev-db/postgresql:11' uses these values to
# determine where to create the data directory, where to place the
# configuration files, and any additional options to pass to initdb.
#
# The initscript also uses these variables to inform PostgreSQL where to find
# its data directory and configuration files.
#
##############################################################################
# Location of configuration files
PGDATA="/etc/postgresql-11/"
# Where the data directory is located/to be created
DATA_DIR="/var/lib/postgresql/11/data"
# Additional options to pass to initdb.
# See `man initdb' for available options.
PG_INITDB_OPTS="--encoding=UTF8" |
|
|
Back to top |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Thu Nov 22, 2018 12:13 am Post subject: |
|
|
I have found source of problem.
Code: | msf > db_connect fulgurance@fulgurance
[-] No database driver installed. Try 'gem install pg' |
But when i install this gem, i have the same error in msfconsole. Metasploit don't found this gem... |
|
Back to top |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1198
|
Posted: Sat Jan 05, 2019 10:59 am Post subject: |
|
|
Solved when added my user to wheel account Just group right access problem |
|
Back to top |
|
|
|