dradis / dradis-ce

Dradis Framework: Collaboration and reporting for IT Security teams
https://dradis.com/ce/
GNU General Public License v2.0
668 stars 190 forks source link

./bin/setup fails #560

Closed maxowner1024 closed 4 years ago

maxowner1024 commented 4 years ago

Using mysql2 0.5.2 Fetching nokogumbo 2.0.1 Installing nokogumbo 2.0.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/lib/dradis-ce/ruby/2.5.0/gems/nokogumbo-2.0.1/ext/nokogumbo

/usr/bin/ruby2.5 -r ./siteconf20191210-62879-1ynl7b1.rb extconf.rb extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/$(RUBY_BASE_NAME)2.5 /usr/lib/ruby/2.5.0/rubygems/dependency.rb:312:in to_specs': Could not find 'nokogiri' (= 1.10.4) - did find: [nokogiri-1.10.5] (Gem::MissingSpecVersionError) Checked in 'GEM_PATH=/usr/lib/dradis-ce/ruby/2.5.0', executegem envfor more information from /usr/lib/ruby/2.5.0/rubygems/dependency.rb:322:into_spec' from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1055:in find_by_name' from extconf.rb:9:in

'

extconf failed, exit code 1

Gem files will remain installed in /usr/lib/dradis-ce/ruby/2.5.0/gems/nokogumbo-2.0.1 for inspection. Results logged to /usr/lib/dradis-ce/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nokogumbo-2.0.1/gem_make.out

An error occurred while installing nokogumbo (2.0.1), and Bundler cannot continue. Make sure that gem install nokogumbo -v '2.0.1' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile: sanitize was resolved to 5.0.0, which depends on nokogumbo

== Command ["bundle install"] failed ==

aapomm commented 4 years ago

Hi @maxowner1024 . What OS are you using for this? It can't seem to install the nokogumbo gem in your machine. Can you try running the suggested command:

gem install nokogumbo -v '2.0.1' --source 'https://rubygems.org/'

It will fail but it might give us some insight as to why.

maxowner1024 commented 4 years ago

嗨@ maxowner1024。您正在使用什么操作系统?它似乎无法nokogumbo在您的计算机中安装gem。您可以尝试运行建议的命令:

gem install nokogumbo -v '2.0.1' --source 'https://rubygems.org/'

它将失败,但是它可能使我们对原因有所了解。

kali-2019-3-amd64

root@ide:~/Desktop/tools/dradis-ce# gem install nokogumbo -v '2.0.1' --source 'https://rubygems.org/' Building native extensions. This could take a while... Successfully installed nokogumbo-2.0.1 Parsing documentation for nokogumbo-2.0.1 Done installing documentation for nokogumbo after 0 seconds 1 gem installed root@ide:~/Desktop/tools/dradis-ce#

aapomm commented 4 years ago

Can you try running ./bin/setup again and see what changed?

GalvanizedTunic commented 4 years ago

I had this same issue running on Kali 2019.4. I was able to resolve it by adding two commands: apt-get install -y libmariadb-dev-compat and gem install rake to the process found here: https://dradisframework.com/ce/documentation/install_kali.html#dependencies

From a fresh Kali instance to a running Dradis server: apt-get install -y zlib1g-dev apt-get install -y libsqlite3-dev cd /opt/ git clone https://github.com/dradis/dradis-ce.git gem install rake apt-get install -y libmariadb-dev-compat ./dradis-ce/bin/setup ./dradis-ce/bin/rails server

noraj commented 4 years ago

On ruby 2.4.1, the issue seems similar but there is nothing to do with nokogumbo:

$ ruby bin/setup
...
Fetching nokogiri 1.10.8
Installing nokogiri 1.10.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/nokogiri-1.10.8/ext/nokogiri
/home/noraj/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20200226-43665-1mxh8dy.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... no
Building nokogiri using system libraries.
pkg-config could not be used to find libxml-2.0
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libxslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libexslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/noraj/.rbenv/versions/2.4.1/bin/$(RUBY_BASE_NAME)
        --help
        --clean
        --use-system-libraries
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-libxml-2.0-config
        --without-libxml-2.0-config
        --with-pkg-config
        --without-pkg-config
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib
        --with-libxslt-config
        --without-libxslt-config
        --with-exslt-dir
        --without-exslt-dir
        --with-exslt-include
        --without-exslt-include=${exslt-dir}/include
        --with-exslt-lib
        --without-exslt-lib=${exslt-dir}/lib
        --with-libexslt-config
        --without-libexslt-config

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/nokogiri-1.10.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/nokogiri-1.10.8 for inspection.
Results logged to /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/nokogiri-1.10.8/gem_make.out

An error occurred while installing nokogiri (1.10.8), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.8' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  dradis-html_export was resolved to 3.15.0, which depends on
    rails_autolink was resolved to 1.1.6, which depends on
      rails was resolved to 5.2.4.1, which depends on
        actioncable was resolved to 5.2.4.1, which depends on
          actionpack was resolved to 5.2.4.1, which depends on
            actionview was resolved to 5.2.4.1, which depends on
              rails-dom-testing was resolved to 2.0.3, which depends on
                nokogiri

== Command ["bundle install"] failed ==

I have extra/libxml2 2.9.10-1 [installed] and extra/libxslt 1.1.34-2 [installed] too. I'm on ArchLinux.

rachkor commented 4 years ago

@noraj this looks like a dependency error. What do you get when you run the suggested commands?

gem install pkg-config -v "~> 1.1"
gem install nokogiri -v '1.10.8' --source 'https://rubygems.org/'
noraj commented 4 years ago

Running this I can finish the dependencies installation.

In Gemfile nokogiri is already using version 1.10.8 and pkg-config doesn't appears in Gemfile or Gemfile.lock so it may be added in it to fix this first issue.

https://github.com/dradis/dradis-ce/blob/ce36be475a8a7dca3f6149006801c8e27c36cbc6/Gemfile#L84

But now I have another error with the sample loading:


== Loading some sample content ==
Loaded add-ons:
        acunetix - Processes Acunetix XML format
        api - Dradis REST HTTP API
        brakeman - Processes Brakeman JSON output, use: brakeman -f json -o results.json
        burp - Processes Burp Scanner output
        csv - Export results in CSV format
        cvss - Risk Calculator: CVSSv3
        dread - Provides a DREAD score calculator under /calculators/dread
        html_export - Generate advanced HTML reports
        metasploit - Processes Metasploit XML output, use: db_export
        nessus - Processes Nessus XML v2 format (.nessus)
        netsparker - Processes Netsparker XML format
        nexpose - Processes Nexpose XML format
        nikto - Processes Nikto output
        nmap - Processes Nmap output
        nto_spider - Processes NTOSpider reports
        open_vas - Processes OpenVAS XML v6 or v7 format
        projects - Save and restore project information
        qualys - Processes Qualys output
        saint - Processes SAINT XML format
        zap - Processes ZAP XML format
      create  templates/notes/basic_fields.txt
bundler: failed to load command: thor (/home/noraj/.rbenv/versions/2.4.1/bin/thor)
Errno::EACCES: Permission denied @ dir_s_mkdir - /shared
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/2.4.0/fileutils.rb:229:in `mkdir'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/2.4.0/fileutils.rb:229:in `fu_mkdir'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/2.4.0/fileutils.rb:207:in `block (2 levels) in mkdir_p'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/2.4.0/fileutils.rb:205:in `reverse_each'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/2.4.0/fileutils.rb:205:in `block in mkdir_p'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/2.4.0/fileutils.rb:191:in `each'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/2.4.0/fileutils.rb:191:in `mkdir_p'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/actions/create_file.rb:62:in `block in invoke!'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/actions/empty_directory.rb:117:in `invoke_with_conflict_check'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/actions/create_file.rb:60:in `invoke!'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/actions.rb:94:in `action'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/actions/create_file.rb:25:in `create_file'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:122:in `template'
  /tmp/dradis-ce/lib/tasks/thor/setup.rb:75:in `welcome'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/runner.rb:42:in `method_missing'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:29:in `run'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:128:in `run'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.20.3/bin/thor:6:in `<top (required)>'
  /home/noraj/.rbenv/versions/2.4.1/bin/thor:22:in `load'
  /home/noraj/.rbenv/versions/2.4.1/bin/thor:22:in `<top (required)>'

== Command ["bin/bundle exec thor dradis:setup:welcome"] failed ==

Which is weird because:

➜ gem list | grep thor
thor (0.20.3)
➜ thor version
Thor 0.20.3
➜ ls -lh /home/noraj/.rbenv/versions/2.4.1/bin/thor
-rwxr-xr-x 1 noraj noraj 476 mars   2 11:48 /home/noraj/.rbenv/versions/2.4.1/bin/thor
rachkor commented 4 years ago

@noraj this looks like a file permissions issue?

Errno::EACCES: Permission denied @ dir_s_mkdir - /shared` Dradis is trying to create a /shared folder to place some of the sample content there

noraj commented 4 years ago

With Ruby 2.4.1 there is still the dependency issue with nokogiri:

Fetching nokogiri 1.10.8
Installing nokogiri 1.10.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/nokogiri-1.10.8/ext/nokogiri
/home/noraj/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20200717-25597-enidfw.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... no
Building nokogiri using system libraries.
pkg-config could not be used to find libxml-2.0
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libxslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

pkg-config could not be used to find libexslt
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1"

ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/noraj/.rbenv/versions/2.4.1/bin/$(RUBY_BASE_NAME)
        --help
        --clean
        --use-system-libraries
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-libxml-2.0-config
        --without-libxml-2.0-config
        --with-pkg-config
        --without-pkg-config
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib
        --with-libxslt-config
        --without-libxslt-config
        --with-exslt-dir
        --without-exslt-dir
        --with-exslt-include
        --without-exslt-include=${exslt-dir}/include
        --with-exslt-lib
        --without-exslt-lib=${exslt-dir}/lib
        --with-libexslt-config
        --without-libexslt-config

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/nokogiri-1.10.8/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/nokogiri-1.10.8 for inspection.
Results logged to /home/noraj/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/nokogiri-1.10.8/gem_make.out

An error occurred while installing nokogiri (1.10.8), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.8' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  dradis-html_export was resolved to 3.17.0, which depends on
    rails_autolink was resolved to 1.1.6, which depends on
      rails was resolved to 5.2.4.3, which depends on
        actioncable was resolved to 5.2.4.3, which depends on
          actionpack was resolved to 5.2.4.3, which depends on
            actionview was resolved to 5.2.4.3, which depends on
              rails-dom-testing was resolved to 2.0.3, which depends on
                nokogiri

== Command ["bundle install"] failed ==

So I ran

➜ gem install nokogiri -v '1.10.8' --source 'https://rubygems.org/'

And re-run, ruby bin/setup after that and it was ok.

I didn't need to run gem install pkg-config -v "~> 1.1" but that maybe what's missing from the Gemfile.

619 fixed the Stop bin/setup from creating folders outside dradis-ce/ issue by stopping bin/setup from creating folders outside dradis-ce/. But the Nokogiri dependency issue was not fixed.