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

Error during the setup #783

Closed alopez78 closed 2 years ago

alopez78 commented 3 years ago

Good morning, I would aprecciate any support to overcome this problem installing dradis-ce. Thanks in advance. Regards, Angel.

Steps to reproduce

$ git clone https://github.com/dradis/dradis-ce.git $ cd dradis-ce/ $ gem install bundler:2.2.8 $ ruby bin/setup

Expected behavior

Application should install

Actual behavior

root@kali:~/REDEC/dradis-ce# ./bin/setup 

== Enabling default add-ons ==
== Installing dependencies ==
The Gemfile's dependencies are satisfied

== Copying sample files ==

== Preparing database ==
rails aborted!
NameError: uninitialized constant CleanOpenVASSettings
Did you mean?  CleanOpenvasSettings
/root/REDEC/dradis-ce/bin/rails:5:in `<top (required)>'
/root/REDEC/dradis-ce/bin/spring:10:in `block in <top (required)>'
/root/REDEC/dradis-ce/bin/spring:7:in `tap'
/root/REDEC/dradis-ce/bin/spring:7:in `<top (required)>'

Caused by:
NameError: uninitialized constant CleanOpenVASSettings
Did you mean?  CleanOpenvasSettings
/root/REDEC/dradis-ce/bin/rails:5:in `<top (required)>'
/root/REDEC/dradis-ce/bin/spring:10:in `block in <top (required)>'
/root/REDEC/dradis-ce/bin/spring:7:in `tap'
/root/REDEC/dradis-ce/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:prepare
(See full trace by running task with --trace)

== Command ["bin/rails db:prepare"] failed ==

System configuration

Dradis version: dradis/release-3.21.0 (Commits on Feb 12, 2021) Ruby version: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux-gnu] OS version: Description: Kali GNU/Linux Rolling Release: 2020.4

sirEgghead commented 3 years ago

I received the exact same issue after hurdling a previous installation issue. When I received the error that you listed, I ran bundle install, to which I received a message saying that everything was installed. I started up the server and connected to it with my browser, only to receive a lengthy page stating that a migration was in progress. I clicked the button that says "Run pending migrations", only to receive a message similar to the one that you listed here. Hence, I'm still stuck in the same place. I would love to know how to get this installed, as this is my first time attempting to do so and have already come across multiple issues during the installation process.

alopez78 commented 3 years ago

I did what you said. But after clicking "Running pending migrations" i got the same error but in a browser with some more details. Captura de pantalla_2021-02-17_10-44-52

sirEgghead commented 3 years ago

My apologies. I was not giving instructions for you to solve your problem. I was chiming in on the conversation saying that I am having the same problem as you. I hope that we can both get this resolved soon.

alopez78 commented 3 years ago

I know, I know, don't worry about it. I just tried to see what was going on. Let's wait for the experts. I hope so too.

alopez78 commented 3 years ago

SOLUTION After some research about ruby, i have never used this language, I saw the problem. Ruby is case-sensitive:

Change the class name from CleanOpenvasSettings to CleanOpenVASSettings in file dradis-ce/db/migrate/20131002215400_clean_openvas_settings.rb

Execute the ./bin/setup again.

sirEgghead commented 3 years ago

That seems to have done it. I called myself running grep -r -i cleanopenvassettings last night, but I suppose I glossed over that particular results in my no-sleep haze. lol. Thank you for the help.

BuildAndDestroy commented 3 years ago

I had an issue with tzdata-info gem and the cleanopenvassettings class. I'll open a pull request for the Dockerfile and k8s yaml deployment, but here is what is building in my jenkins pipeline:

FROM ubuntu:focal RUN apt update -y RUN apt install git zlib1g zlib1g-dev gcc-10 gcc g++ libssl-dev patch libreadline-dev libyaml-dev libffi-dev make bzip2 autoconf automake libtool bison curl libsqlite3-dev mariadb-server libmariadb-dev -y RUN apt install redis -y RUN useradd -ms /bin/bash dradis RUN mkdir /mnt/backup USER dradis WORKDIR "/home/dradis" RUN git clone git://github.com/sstephenson/rbenv.git .rbenv RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile RUN echo 'eval "$(rbenv init -)"' >> ~/.bash_profile RUN git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build RUN echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile RUN ~/.rbenv/bin/rbenv install -v 2.7.2 RUN ~/.rbenv/bin/rbenv global 2.7.2 RUN ~/.rbenv/shims/ruby -v RUN ~/.rbenv/shims/gem install bundler RUN git clone https://github.com/dradis/dradis-ce.git WORKDIR "/home/dradis/dradis-ce/" RUN sed -i 's#git@github.com:paper-trail-gem/paper_trail.git#https://github.com/paper-trail-gem/paper_trail.git#g' Gemfile RUN sed -i "/^ruby '2.7.2'/a gem 'tzinfo-data', '~> 1.2021.1'" Gemfile RUN sed -i 's/CleanOpenvasSettings/CleanOpenVASSettings/g' ~/dradis-ce/db/migrate/*_clean_openvas_settings.rb RUN ~/.rbenv/shims/ruby ./bin/setup USER root RUN cp -a /home/dradis/dradis-ce/ /mnt/backup/ RUN chown -R dradis:dradis /mnt/backup/* USER dradis WORKDIR "/home/dradis/dradis-ce" EXPOSE 3000 CMD ["/home/dradis/.rbenv/shims/bundle", "exec", "rails", "server", "-b", "0.0.0.0"]

docker build -t dradis-ce:latest -f dradis-ubuntu.docker . docker run -it -p 3000:3000 dradis-ce:latest

etdsoft commented 2 years ago

Sorry about the delay in getting back to y'all this was actually fixed in https://github.com/dradis/dradis-ce/pull/937