Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ 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 'net-ssh', '~>2.9.2'

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'
Expand All @@ -86,7 +87,7 @@ gem 'timezone_local', '~> 0.1.5'
group(:development) do
gem "letter_opener"
gem 'thin'
gem 'byebug'
gem 'pry-byebug', platform: [:ruby_20]
end

group(:test) do
Expand Down
50 changes: 31 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

GIT
remote: https://github.com/Snorby/delayed_job_data_mapper.git
revision: 6f1c4a8c3ad62e4ef6baafec9a2a9914d0643085
Expand Down Expand Up @@ -54,29 +55,30 @@ GEM
activesupport (3.2.22)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.8)
addressable (2.4.0)
ansi (1.5.0)
arel (3.0.3)
bcrypt (3.1.10)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
builder (3.0.4)
byebug (6.0.0)
byebug (8.2.1)
cancan (1.6.10)
capistrano (2.14.1)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capybara (2.4.4)
capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
chronic (0.3.0)
closure-compiler (1.1.11)
coderay (1.1.0)
daemons (1.1.9)
data_objects (0.10.16)
addressable (~> 2.1)
Expand All @@ -87,7 +89,7 @@ GEM
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
devise_cas_authenticatable (1.5.0)
devise_cas_authenticatable (1.7.0)
devise (>= 1.2.0)
rubycas-client (>= 2.2.1)
diff-lcs (1.2.5)
Expand Down Expand Up @@ -165,28 +167,29 @@ GEM
eventmachine (1.0.8)
fastercsv (1.5.5)
geoip (1.1.2)
highline (1.7.3)
highline (1.7.8)
hike (1.2.3)
home_run (1.0.9)
i18n (0.7.0)
jammit (0.5.4)
closure-compiler (>= 0.1.0)
yui-compressor (>= 0.9.1)
journey (1.0.4)
jquery-rails (3.1.3)
jquery-rails (3.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
json_pure (1.8.2)
json_pure (1.8.3)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.4.1)
launchy (~> 2.2)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.2)
mini_portile2 (2.0.0)
minitest (4.7.5)
multi_json (1.11.2)
net-dns (0.6.1)
Expand All @@ -198,14 +201,21 @@ GEM
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
netaddr (1.5.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2)
orm_adapter (0.0.7)
pdfkit (0.4.6)
polyglot (0.3.5)
power_assert (0.2.4)
power_assert (0.2.6)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.3.0)
byebug (~> 8.0)
pry (~> 0.10)
rack (1.4.7)
rack-cache (1.2)
rack-cache (1.5.1)
rack (>= 0.4)
rack-ssl (1.3.4)
rack
Expand Down Expand Up @@ -246,17 +256,18 @@ GEM
rubycas-client (2.3.9)
activesupport
simple_form (1.2.2)
slop (3.6.0)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
stringex (1.5.1)
test-unit (3.1.3)
test-unit (3.1.5)
power_assert
thin (1.6.3)
thin (1.6.4)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
eventmachine (~> 1.0, >= 1.0.4)
rack (~> 1.0)
thor (0.19.1)
tilt (1.4.1)
Expand All @@ -268,9 +279,9 @@ GEM
turn (0.9.7)
ansi
minitest (~> 4)
tzinfo (0.3.44)
tzinfo (0.3.46)
uuidtools (2.1.5)
warden (1.2.3)
warden (1.2.4)
rack (>= 1.0)
whois (2.3.0)
xpath (2.0.0)
Expand All @@ -287,7 +298,6 @@ DEPENDENCIES
activesupport (= 3.2.22)
ansi
bundler (>= 1.0.0)
byebug
cancan (~> 1.6)
capistrano (= 2.14.1)
capybara
Expand Down Expand Up @@ -331,8 +341,10 @@ DEPENDENCIES
mail (~> 2.3)
minitest
net-dns (~> 0.6.1)
net-ssh (~> 2.9.2)
netaddr (~> 1.5.0)
pdfkit (~> 0.4.6)
pry-byebug
rails (= 3.2.22)
railties (= 3.2.22)
rake (= 0.9.2)
Expand All @@ -351,4 +363,4 @@ DEPENDENCIES
whois (~> 2.3.0)

BUNDLED WITH
1.10.6
1.11.2
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Snorby is a ruby on rails web application for network security monitoring that i
## Requirements

* Snort
* Ruby >= 1.9.2
* Ruby >= 1.9.2, <2.x.x
* Rails >= 3.0.0

## Install
Expand Down Expand Up @@ -42,7 +42,7 @@ Snorby is a ruby on rails web application for network security monitoring that i
* Run The Snorby Setup

`rake snorby:setup`

* NOTE: If you get warning such as "already initialized constant PDF", you can fix it by running these commands :

```
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake/dsl_definition'
require 'rake'
include Rake::DSL if defined?(Rake::DSL)

Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ class User
property :last_email_report_at, ZonedTime
property :email_reports, Boolean, :default => false

property :daily_reports, Boolean, :default => false
property :weekly_reports, Boolean, :default => false
property :monthly_reports, Boolean, :default => false

has n, :notifications, :constraint => :destroy

has n, :favorites, :child_key => :user_id, :constraint => :destroy
Expand Down
4 changes: 2 additions & 2 deletions app/views/settings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</div>

<div class='grid_5'>

<% if not Snorby::CONFIG[:user_reports_control] %>
<p>
<%= check_box_tag '[settings][daily]', 1, (Setting.daily ? Setting.find(:daily) : nil) %> <%= label_tag 'Daily Reports' %><br />
<i>(Send a report summarizing the captured traffic daily.)</i><br />
Expand All @@ -55,7 +55,7 @@
<%= check_box_tag '[settings][monthly]', 1, (Setting.monthly ? Setting.find(:monthly) : nil) %> <%= label_tag 'Monthly Reports' %><br />
<i>(Send a report summarizing the captured traffic monthly)</i><br />
</p>

<% end %>
<p>
<%= check_box_tag '[settings][lookups]', 1, (Setting.lookups ? Setting.find(:lookups) : nil) %> <%= label_tag 'Address Lookups' %><br />
<i>(This option enables the analyst to perform basic queries on source & destination addresses using external sources.)</i><br />
Expand Down
19 changes: 19 additions & 0 deletions app/views/users/registrations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,27 @@

<p>
<%= f.check_box :admin %> <%= f.label "Administrator" %>
<br />
<em>(should this user have administrative rights?)</em>
</p>
<% end %>

<% if Snorby::CONFIG[:user_reports_control] %>
<p>
<%= f.check_box :daily_reports %> <%= f.label 'Daily Reports' %>
<br />
<em>(Send a report summarizing the captured traffic daily)</em>
</p>
<p>
<%= f.check_box :weekly_reports %> <%= f.label 'Weekly Reports' %>
<br />
<em>(Send a report summarizing the captured traffic weekly)</em>
</p>
<p>
<%= f.check_box :monthly_reports %> <%= f.label 'Monthly Reports' %>
<br />
<em>(Send a report summarizing the captured traffic monthly)</em>
</p>

<% end %>

Expand Down
4 changes: 2 additions & 2 deletions config/snorby_config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ production:
# searching will use local time.
timezone_search: true
# uncomment to set time zone to time zone of box from /usr/share/zoneinfo, e.g. "America/Cancun"
# time_zone: 'UTC'
time_zone: 'Europe/Paris'

#
# Only Use For Development
Expand All @@ -39,7 +39,7 @@ development:
- "/Users/mephux/.snort/so_rules"
authentication_mode: database
# uncomment to set time zone to time zone of box from /usr/share/zoneinfo, e.g. "America/Cancun"
# time_zone: 'UTC'
time_zone: 'Europe/Paris'
# authentication_mode: cas
# cas_config:
# base_url: https://auth.server.com.br/
Expand Down
6 changes: 3 additions & 3 deletions lib/snorby/jobs/sensor_cache_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def perform
now = current_time.to_date + 0.second
yesterday = current_time.yesterday.to_date + 0.second

if Setting.daily?
if (Snorby::CONFIG[:user_reports_control] and user.daily_reports) or ((not Snorby::CONFIG[:user_reports_control]) and Setting.daily?)
last_report_to_date = if user.last_daily_report_at.present?
user.last_daily_report_at.in_time_zone(user.timezone).to_date + 0.second
else
Expand All @@ -168,7 +168,7 @@ def perform


# Weekly
if Setting.weekly?
if (Snorby::CONFIG[:user_reports_control] and user.weekly_reports) or ((not Snorby::CONFIG[:user_reports_control]) and Setting.weekly?)
current_week = current_time.strftime('%Y%W').to_i

last_weekly_to_date = if user.last_weekly_report_at.present?
Expand All @@ -188,7 +188,7 @@ def perform
end

# Monthly
if Setting.monthly?
if (Snorby::CONFIG[:user_reports_control] and user.monthly_reports) or ((not Snorby::CONFIG[:user_reports_control]) and Setting.monthly?)
current_month = current_time.strftime('%Y%m').to_i

last_monthly_to_date = if user.last_monthly_report_at.present?
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/snorby.rake
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace :snorby do
Signature.update!(:events_count => 0)

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

desc 'Hard Reset - Rebuild Snorby Database'
Expand Down