简体   繁体   中英

rake aborted! Don't know how to build task 'snorby:setup'

I am trying to install snorby on my ubuntu 16.04 Desktop, But when I run RAILS_ENV=production bundle exec rake snorby:setup. I get the error rake aborted! Don't know how to build task 'snorby:setup' rake aborted! Don't know how to build task 'snorby:setup' . Somebody can help me resolve the issue? Thanks veryy muchhhhh. and this my 'Gamefile'

UPDATE : Upload my RAILS_ENV=production bundle exec rake -vT and file /lib/tasks/snorby.rake

source 'https://rubygems.org'

RAILS_VERSION = '3.2.22'
RSPEC_VERSION = '~> 2.0.0'
DATAMAPPER    = 'https://github.com/datamapper'
DM_VERSION    = '~> 1.2.0'

gem 'rubocop', require: false ## This is not the original gamefile, I added this gamefile to another package, which is rubocop. because before I get the message "Rake Aborted: needed Rubocop / task_file. You can notice" gem 'rubocop', require: false"

gem 'rake', '0.9.2'
gem 'request_store', '~> 1.0.5'
gem 'rails',                       RAILS_VERSION
gem 'jquery-rails'
gem 'bundler',                     '>= 1.0.0'
gem 'env'
gem 'json', '~> 1.8.3'

# Jruby
gem 'jruby-openssl',               :platforms => :jruby
gem 'warbler',                     :platforms => :jruby
gem 'jruby-rack-worker',           :platforms => :jruby
# gem 'glassfish', :platforms => :jruby

# DateTime Patches
gem 'home_run',                    :require => 'date', :platforms => :mri

gem 'activesupport',               RAILS_VERSION, :require => 'active_support'
gem 'actionpack',                  RAILS_VERSION, :require => 'action_pack'
gem 'actionmailer',                RAILS_VERSION, :require => 'action_mailer'
gem 'railties',                    RAILS_VERSION, :require => 'rails'
gem 'dm-core',                     DM_VERSION
gem 'dm-rails',                    DM_VERSION
gem 'dm-do-adapter',               DM_VERSION
gem 'dm-active_model',             DM_VERSION
gem 'dm-mysql-adapter',            DM_VERSION
gem 'dm-postgres-adapter',         DM_VERSION

gem 'dm-pager',                    '~> 1.1.0'
gem "dm-ar-finders",               DM_VERSION
gem 'dm-migrations',               DM_VERSION
gem 'dm-types',                    DM_VERSION
gem 'dm-validations',              DM_VERSION
gem 'dm-constraints',              DM_VERSION
gem 'dm-transactions',             DM_VERSION
gem 'dm-aggregates',               DM_VERSION
gem 'dm-timestamps',               DM_VERSION
gem 'dm-observer',                 DM_VERSION
gem 'dm-serializer',               DM_VERSION
gem 'dm-is-read_only',             '~> 0.3', :git => 'https://github.com/postmodern/dm-is-read_only.git' 
gem 'dm-chunked_query',            '~> 0.3'

# Deploy with Capistrano
gem 'capistrano',                  '2.14.1'

# Rails Plugins
gem 'jammit',                      '~> 0.5.4'
gem 'cancan',                      '~> 1.6'
gem 'devise',                      '~> 1.4'
gem 'dm-devise',                   '~> 1.5'
gem 'rubycas-client'
gem 'devise_cas_authenticatable'
gem "mail",                        '~> 2.3'
gem "RedCloth",                    "~> 4.2.9", :require => 'redcloth'
gem 'chronic',                     '~> 0.3.0'
gem 'pdfkit',                      '~> 0.4.6'
gem 'ezprint',                     :git => 'https://github.com/mephux/ezprint.git', :branch => 'rails3', :require => 'ezprint'
gem 'daemons',                     '~> 1.1.0'

gem 'delayed_job',                 '~> 2.1.4'
gem 'delayed_job_data_mapper',     '~> 1.0.0.rc', :git => 'https://github.com/Snorby/delayed_job_data_mapper.git'

# Working On This
# gem 'delayed_job',                 '~> 3.0'
# gem 'delayed_job_data_mapper',     '~> 1.0.0.rc', :git => 'https://github.com/collectiveidea/delayed_job_data_mapper.git'

# Old - Remove Avatar Support
# gem 'rmagick',                     '~> 2.13.1'
# gem 'dm-paperclip',                '~> 2.4.1', :git => 'https://github.com/Snorby/dm-paperclip.git'

gem 'net-dns',                     '~> 0.8.0'
gem 'whois',                       '~> 2.3.0'
gem 'simple_form',                 '~> 1.2.2'
gem 'geoip',                       '~> 1.1.1'
gem 'netaddr',                     '~> 1.5.0'
gem 'dm-zone-types',               '~> 0.3'
gem 'timezone_local',              '~> 0.1.5'

group(:development) do
  gem "letter_opener"
  gem 'thin'
  gem 'byebug'
end

group(:test) do
  gem 'capybara'
  gem 'test-unit'   
  gem 'rspec',                    RSPEC_VERSION
  gem 'rspec-core',               RSPEC_VERSION, :require => 'rspec/core'
  gem 'rspec-expectations',       RSPEC_VERSION, :require => 'rspec/expectations'
  gem 'rspec-rails',                  RSPEC_VERSION
  gem 'ansi'
  gem 'turn'
  gem 'minitest'
end

group(:doc) do
  gem 'dm-visualizer',  '~> 0.1.0'
end

This is not the original gamefile, I added this gamefile to another package, which is rubocop. because before I get the message "Rake Aborted: needed Rubocop / task_file. You can notice" gem 'rubocop', require: false"

# Snorby - All About Simplicity.
#
# Copyright (c) 2012 Dustin Willis Webber (dustin.webber at gmail.com)
#
# Snorby is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Foobar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

require "./lib/snorby/dm/types"
require "./lib/snorby/jobs"
require "./lib/snorby/worker"

namespace :snorby do

  desc 'Setup'  
  task :setup => :environment do

    Rake::Task['secret'].invoke

    # Create the snorby database if it does not currently exist
    Rake::Task['db:create'].invoke

    # Snorby update logic 
    Rake::Task['snorby:update'].invoke
  end

  desc 'Update Snorby'
  task :update => :environment do

    # Setup the snorby database
    Rake::Task['db:autoupgrade'].invoke

    # Load Default Records
    Rake::Task['db:seed'].invoke

    # Restart Worker
    Rake::Task['snorby:restart_worker'].invoke
  end

  desc 'Update Snorby DB'
  task :dbupdate => :environment do

    # Setup the snorby database
    Rake::Task['db:autoupgrade'].invoke

    # Load Default Records
    Rake::Task['db:seed'].invoke
  end

  desc 'Remove Old CSS/JS packages and re-bundle'
  task :refresh => :environment do
    `jammit`
  end

  desc 'Start Snorby Worker if not running'
  task :start_worker => :environment do

    if Snorby::Worker.running?
      exit 0
    end

    # otherwise, restart worker.
    Rake::Task['snorby:restart_worker'].invoke
  end

  desc 'Restart Worker/Jobs'
  task :restart_worker => :environment do

    if Snorby::Worker.running?
      puts '* Stopping the Snorby worker process.'
      Snorby::Worker.stop
    end

    count = 0
    stopped = false
    while !stopped 

      stopped = true unless Snorby::Worker.running?
      sleep 5 

      count += 1
      if count > 10
        STDERR.puts "[X] Error: Unable to stop the Snorby worker process."
        exit -1
      end
    end

    unless Snorby::Worker.running?
      puts "* Removing old jobs"
      Snorby::Jobs.find.all.destroy

      puts "* Starting the Snorby worker process."
      Snorby::Worker.start

      count = 0
      ready = false
      while !ready 

        ready = true if Snorby::Worker.running?
        sleep 5 

        count += 1
        if count > 10
          ready  = true
        end
      end


      if Snorby::Worker.running?
        Snorby::Jobs.find.all.destroy
        puts "* Adding jobs to the queue"
        Snorby::Jobs.run_now!
      else
        STDERR.puts "[X] Error: Unable to start the Snorby worker process."
        exit -1
      end
    end

  end

  desc 'Soft Reset - Reset Snorby metrics'
  task :soft_reset => :environment do

    # Reset Counter Cache Columns
    puts 'Reseting Snorby metrics and counter cache columns'
    Severity.update!(:events_count => 0)
    Sensor.update!(:events_count => 0)
    Signature.update!(:events_count => 0)

    puts 'This could take awhile. Please wait while the Snorby cache is rebuilt.'
    Snorby::Jobs.reset_cache(:all, true)
  end

  desc 'Hard Reset - Rebuild Snorby Database'
  task :hard_reset => :environment do

    # Drop the snorby database if it exists
    Rake::Task['db:drop'].invoke

    # Invoke the snorby:setup rake task
    Rake::Task['snorby:setup'].invoke

  end

end

This file /lib/tasks/snorby.rake

This image output :

RAILS_ENV=production bundle exec rake snorby:setup

RAILS_ENV=production bundle exec rake -vT

EDIT : SOLVED My Problem. you must install :

gem install bundler -v 1.17.1 gem install rails -v 4.2.2 gem install sprockets -v 3.7.2 gem install rake --version=0.9.2

or if you wanna install Suricata, Snorby, and barnyard2. I suggestion you follow this : guide install

It most likely that you have install the Snorby to a specific environments,

please copy/paste your 'Gemfile', so we can have a look.

You can also list all rake tasks in production environment by

RAILS_ENV=production bundle exec rake -vT

UPDATE:

Snorby seems to be a standalone web application, so the rake task is defined as any other custom rake tasks

You should be able to find a lib/tasks/snorby.rake file, If not I recommend you to re-download the repo from: https://github.com/Snorby/snorby/snorby , and follow the instructions in README.md

Another update: This project seems stop updating since Nov 13, 2017, with 122 issues remain opening, I personally would not use this project for network security monitoring.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM