Bug 228722 - security/metasploit "No database driver installed. Try 'gem install pg'"
Summary: security/metasploit "No database driver installed. Try 'gem install pg'"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Antoine Brodin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-03 10:41 UTC by Marco Beishuizen
Modified: 2018-07-29 15:22 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (tanawts)


Attachments
msf.diff (2.26 KB, patch)
2018-07-28 06:53 UTC, Antoine Brodin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Beishuizen 2018-06-03 10:41:49 UTC
I try to use security/metasploit on FreeBSD. It installs fine and I can run msfconsole, but metasploit cannot connect to the postgresql database:

[...]
[4mmsf[0m [0m> db_status
[-] No database driver installed. Try 'gem install pg'
[...]

The suggested gem install pg doesn't work either:

[...]
[4mmsf[0m [0m> gem install pg
[*] exec: gem install pg

Building native extensions. This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.4/gems/pg-1.0.0/ext
/usr/local/bin/ruby24 -r ./siteconf20180602-31634-1qgflo4.rb extconf.rb
/usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find pg-1.0.0 in any of the sources (Bundler::GemNotFound)
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/spec_set.rb:85:in `map!'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/spec_set.rb:85:in `materialize'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/definition.rb:171:in `specs'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/definition.rb:238:in `specs_for'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/definition.rb:227:in `requested_specs'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/runtime.rb:108:in `block in definition_method'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/runtime.rb:20:in `setup'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler.rb:107:in `setup'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/setup.rb:20:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in `require'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.4/gems/pg-1.0.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4/extensions/amd64-freebsd-11/2.4/pg-1.0.0/gem_make.out
[...]

The databases/rubygem-pg port is installed.
Comment 1 Marco Beishuizen 2018-06-03 10:44:49 UTC
Perhaps I need to add that postgresql10 is running on FreeBSD 11.1:


FreeBSD yokozuna 11.1-STABLE FreeBSD 11.1-STABLE #0 r328478: Sat Jan 27 22:31:28 CET 2018     root@yokozuna:/usr/obj/usr/src/sys/YOKOZUNA  amd64
Comment 2 Walter Schwarzenfeld freebsd_triage 2018-06-06 06:30:20 UTC
Btw:

pkg check -dn

Checking all packages: 100%
metasploit is missing a required shared library: libstdc++.so
Comment 3 Marco Beishuizen 2018-06-06 13:57:51 UTC
(In reply to w.schwarzenfeld from comment #2)
A "pkg check -dn" shows that my system does seem to miss some shared libraries, but metasploit is not one of them:

root@yokozuna:~# pkg check -dn
Checking all packages: 100%
cadaver is missing a required shared library: libreadline.so.6
tex-web2c has a missing dependency: openjpeg15
wdm is missing a required shared library: libwraster.so.5
wireshark-qt5 is missing a required shared library: libsmi.so.2
xorg has a missing dependency: dri
Comment 4 tanawts 2018-06-07 02:37:41 UTC
Acknowledged, working on repro and troubleshooting.
Comment 5 Walter Schwarzenfeld freebsd_triage 2018-06-07 15:01:39 UTC
(In reply to Marco Beishuizen from comment #3)
Thanks, I have to look. Maybe, it is error of my system.
Comment 6 Walter Schwarzenfeld freebsd_triage 2018-06-13 09:35:38 UTC
"No database driver installed", exists still after update to 4.16.60.
And:
pkg check -dn
metasploit is missing a required shared library: libstdc++.so
rubygem-metasploit-payloads is missing a required shared library: libstdc++.so.
Comment 7 Walter Schwarzenfeld freebsd_triage 2018-06-25 14:21:15 UTC
metasploit updated to 4.16.63. ports r 473314.
Comment 8 Walter Schwarzenfeld freebsd_triage 2018-06-25 14:21:39 UTC
ports r473314
Comment 9 Walter Schwarzenfeld freebsd_triage 2018-06-25 14:22:36 UTC
Once again , wrong revision number. ports r473315.
Comment 10 Walter Schwarzenfeld freebsd_triage 2018-06-25 15:13:42 UTC
Still: No database driver installed. Try 'gem install pg'
Comment 11 Antoine Brodin freebsd_committer 2018-07-28 06:53:22 UTC
Created attachment 195519 [details]
msf.diff

Please try attached patch.
Comment 12 Marco Beishuizen 2018-07-29 14:27:17 UTC
This patch seems to work. "db_status" now shows:

[...]
[4mmsf[0m [0m> db_status
[*] postgresql selected, no connection
[...]

Thanks!
Comment 13 commit-hook freebsd_committer 2018-07-29 15:18:10 UTC
A commit references this bug:

Author: antoine
Date: Sun Jul 29 15:17:37 UTC 2018
New revision: 475661
URL: https://svnweb.freebsd.org/changeset/ports/475661

Log:
  Metasploit database requires rubygem-pg version 0.2x

  PR:		228722
  Reported and tested by:	Marco Beishuizen
  MFH:		2018Q3

Changes:
  head/security/metasploit/Makefile
  head/security/rubygem-metasploit-credential/Makefile
  head/security/rubygem-metasploit_data_models/Makefile
Comment 14 commit-hook freebsd_committer 2018-07-29 15:21:15 UTC
A commit references this bug:

Author: antoine
Date: Sun Jul 29 15:20:19 UTC 2018
New revision: 475662
URL: https://svnweb.freebsd.org/changeset/ports/475662

Log:
  MFH: r475661

  Metasploit database requires rubygem-pg version 0.2x

  PR:		228722
  Reported and tested by:	Marco Beishuizen

Changes:
_U  branches/2018Q3/
  branches/2018Q3/security/metasploit/Makefile
  branches/2018Q3/security/rubygem-metasploit-credential/Makefile
  branches/2018Q3/security/rubygem-metasploit_data_models/Makefile