Skip to content

Commit 2575067

Browse files
committed
Merge branch 'master' of baltig.sandia.gov:scot/SCOT
2 parents bdf7b08 + 2c38496 commit 2575067

File tree

40 files changed

+2571
-1989
lines changed

40 files changed

+2571
-1989
lines changed

bin/update_incidents.pl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env perl
2+
3+
use MongoDB;
4+
use Data::Dumper;
5+
use v5.18;
6+
7+
my $mongo = MongoDB->connect->db('scot-prod');
8+
my $collection = $mongo->get_collection('incident');
9+
my $cursor = $collection->find({});
10+
11+
print "starting...\n";
12+
print $cursor->count . " incident records\n";
13+
my %lookup = ();
14+
15+
while (my $incident = $cursor->next) {
16+
17+
my $id = $incident->{id};
18+
print "...incident $id\n";
19+
20+
my %data = (
21+
reportable => $incident->{reportable},
22+
type => $incident->{type},
23+
category => $incident->{category},
24+
security_category => $incident->{security_category},
25+
sensitivity => $incident->{sensitivity},
26+
doe_report_id => $incident->{doe_report_id},
27+
);
28+
29+
my %newinc = (
30+
id => $id,
31+
created => $incident->{created},
32+
updated => $incident->{updated},
33+
occurred => $incident->{occurred},
34+
discovered => $incident->{discovered},
35+
reported => $incident->{reported},
36+
when => $incident->{when} // 0,
37+
subject => $incident->{subject},
38+
promoted_from => $incident->{promoted_from},
39+
data_fmt_ver => "incident_v2",
40+
data => \%data,
41+
);
42+
43+
$collection->update_one({id => $id}, \%newinc);
44+
45+
}

demo/demo2.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
use lib '/opt/scot/lib';
44
use Scot::Util::ScotClient;
5+
use Scot::Env;
56
use MIME::Base64;
67
use Data::Dumper;
78
use JSON;
89
use strict;
910
use warnings;
1011
use v5.18;
1112

13+
my $env = Scot::Env->new({
14+
config_file => '/opt/scot/etc/scot.cfg.pl',
15+
});
1216

1317
my %users = (
1418
admin => '61E4663E-6CAB-11E7-B011-FEE80D183886',
@@ -26,6 +30,7 @@
2630
auth_type => 'apikey',
2731
api_key => $users{$user},
2832
servername => 'scotdemo.com',
33+
env => $env,
2934
config => {
3035

3136
},

docker-configs/flair/flair.cfg.pl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
logfile => '/var/log/scot/scot.flair.log',
2121
log_level => 'DEBUG',
2222
},
23+
## Flair.pm needs to know how to connect to the ActiveMQ topic
2324
stomp_host => "activemq",
2425
stomp_port => 61613,
2526
topic => "/topic/scot",
27+
## updates to flair-ed entries and alerts will be done by this account
2628
default_owner => "scot-admin",
2729
# modules used by flair app
2830
modules => [
@@ -43,7 +45,7 @@
4345
attr => 'scot',
4446
class => 'Scot::Util::ScotClient',
4547
config => {
46-
servername => 'localhost',
48+
servername => 'scot',
4749
# username with sufficient scot perms to create alert(groups)
4850
username => 'scot-alerts',
4951
# the password for that user
@@ -127,4 +129,8 @@
127129
},
128130
},
129131
],
132+
# future use:
133+
location => "scot_demo",
134+
site_identifier => "scot_demo",
135+
default_share_policy => "none",
130136
);

docker-configs/mail/alert.cfg.pl

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
1+
####
2+
#### alert.cfg.pl
3+
####
4+
#### Used to configure the SCOT email alert input program
5+
#### bin/alert.pl which uses Scot::App::Mail
6+
####
7+
18
%environment = (
9+
10+
## See perl DateTime documenation for values matching your locale
211
time_zone => 'America/Denver',
12+
13+
## Set up Scot Logging to your liking. See Log::Log4perl documentaton
14+
## for details on layout and log_level. By default, log_level of DEBUB
15+
## is very verbose, but is probably the level you want to be able to
16+
## figure out an error after it occurs.
317
log_config => {
418
logger_name => 'SCOT',
519
layout => '%d %7p [%P] %15F{1}: %4L %m%n',
620
appender_name => 'scot_log',
721
logfile => '/var/log/scot/scot.mail.log',
822
log_level => 'DEBUG',
923
},
24+
25+
## MODULES
26+
## Each hash in the following array, will result in an attribute
27+
## being created in the Scot/Env.pm module that points to the class
28+
## described. if you ever get a "cant find foo in Scot::Env" you might
29+
## be missing something here
30+
1031
modules => [
32+
## describe to SCOT how to talk to your imap server
1133
{
1234
attr => 'imap',
1335
class => 'Scot::Util::Imap',
@@ -25,6 +47,7 @@
2547
ignore_size_errors => 1, # ignore_size_errors
2648
},
2749
},
50+
## describe how for the Scot Perl client to find the SCOT server
2851
{
2952
attr => 'scot',
3053
class => 'Scot::Util::ScotClient',
@@ -38,6 +61,7 @@
3861
authtype => 'Local',
3962
},
4063
},
64+
## mongodb connection information
4165
{
4266
attr => 'mongo',
4367
class => 'Scot::Util::MongoFactory',
@@ -48,6 +72,7 @@
4872
find_master => 1,
4973
},
5074
},
75+
## ActiveMQ connection info
5176
{
5277
attr => 'mq',
5378
class => 'Scot::Util::Messageq',
@@ -57,6 +82,7 @@
5782
stomp_port => 61613,
5883
},
5984
},
85+
## Elasticsearch connection info
6086
{
6187
attr => 'es',
6288
class => 'Scot::Util::ElasticSearch',
@@ -66,8 +92,12 @@
6692
},
6793
},
6894
],
95+
## parser_dir is where to find the modules that can parse the emails
6996
parser_dir => '/opt/scot/lib/Scot/Parser',
97+
## alert.pl can utilize rest or direct mongo connection to input data
7098
get_method => "mongo", # other value is "rest"
99+
## leave_unseen = 1 means SCOT will leave emails marked "unread"
100+
## leave_unseen = 0 means SCOT marks emails read after processing
71101
leave_unseen => 1,
72102
# interactive => [ yes | no ]
73103
# pauses processing after each message and writes to console
@@ -76,6 +106,7 @@
76106
# max_processes => 0 to positive int
77107
# number of child processes to fork to parse messages in parallel
78108
# 0 = disable forking and do all messages sequentially
109+
# recommendation is 5-10 in production, 0 for testing.
79110
max_processes => 0,
80111
# fetch_mode => [ unseen | time ]
81112
# unseen looks for unseen messages via imap protocol
@@ -91,8 +122,13 @@
91122
# approved_alert_domains => [ 'domain1\.org', ... ]
92123
# only domains listed in this array can send email to scot
93124
# periods need to be escaped by \
94-
approved_alert_domains => [ 'domain.tld' ],
125+
approved_alert_domains => [ 'domain\.tld' ],
95126
# approve_accounts => [ '[email protected]' ];
96127
# account in this domain can also send to scot
97128
approved_accounts => [ '[email protected]' ],
129+
130+
# future use:
131+
location => "scot_demo",
132+
site_identifier => "scot_demo",
133+
default_share_policy => "none",
98134
);

docker-configs/mongodb/mongod.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ storage:
1616
systemLog:
1717
destination: file
1818
logAppend: true
19-
path: /var/log/mongodb/mongod.log
19+
path: /var/log/mongodb/
2020

2121
# network interfaces
2222
net:

docker-configs/reflair/reflair.cfg.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@
5353
},
5454
},
5555
],
56+
# future use:
57+
location => "scot_demo",
58+
site_identifier => "scot_demo",
59+
default_share_policy => "none",
5660
);

docker-configs/scot/scot.cfg.pl

Lines changed: 101 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# authentication can be "Remoteuser", "Local", or "Ldap"
1414
auth_type => 'Local',
1515

16-
authclass => 'Controller::Auth::Local',
17-
1816
# group mode can be "local" or "ldap"
1917
group_mode => 'local',
2018

@@ -43,6 +41,15 @@
4341

4442
share_after_time => 10, # minutes
4543

44+
stomp_host => "localhost",
45+
stomp_port => 61613,
46+
topic => "/topic/scot",
47+
48+
# location and site_identifier (future use)
49+
location => 'demosite',
50+
site_identifier => "demosite",
51+
default_share_policy => "none",
52+
4653
# mojo defaults are values for the mojolicious startup
4754
mojo_defaults => {
4855
# change this after install and restart scot
@@ -54,7 +61,7 @@
5461
# hypnotoad workers, 50-100 heavy use, 20 - 50 light
5562
# hypnotoad_workers => 75,
5663
hypnotoad => {
57-
listen => [ 'http://scot:3000?reuse=1' ],
64+
listen => [ 'http://0.0.0.0:3000?reuse=1' ],
5865
workers => 20,
5966
clients => 1,
6067
proxy => 1,
@@ -199,24 +206,24 @@
199206
}, # end enrichments stanza
200207
#{
201208
# attr => 'ldap',
202-
# class => 'Scot::Util::Ldap',
203-
# config => {
204-
# servername => 'ldap.domain.tld',
205-
# dn => 'cn=cn_name,ou=local config,dc=tld',
206-
# password => 'changemenow',
207-
# scheme => 'ldap',
208-
# group_search => {
209-
# base => 'ou=groups,ou=orgname1,dc=dcname1,dc=dcname2,dc=dcname3',
210-
# filter => '(| (cn=wg-scot*))',
211-
# attrs => [ 'cn' ],
212-
# },
213-
# user_groups => {
214-
# base => 'ou=accounts,ou=ouname,dc=dcname1,dc=dcname1,dc=dcname1',
215-
# filter => 'uid=%s',
216-
# attrs => ['memberOf'],
217-
# }
218-
# }, # end ldap config
219-
#}, # end ldap
209+
# class => 'Scot::Util::Ldap',
210+
# config => {
211+
# servername => 'ldap.domain.tld',
212+
# dn => 'cn=cn_name,ou=local config,dc=tld',
213+
# password => 'changemenow',
214+
# scheme => 'ldap',
215+
# group_search => {
216+
# base => 'ou=groups,ou=orgname1,dc=dcname1,dc=dcname2,dc=dcname3',
217+
# filter => '(| (cn=wg-scot*))',
218+
# attrs => [ 'cn' ],
219+
# },
220+
# user_groups => {
221+
# base => 'ou=accounts,ou=ouname,dc=dcname1,dc=dcname1,dc=dcname1',
222+
# filter => 'uid=%s',
223+
# attrs => ['memberOf'],
224+
# }
225+
# }, # end ldap config
226+
# }, # end ldap
220227
],
221228
entity_regexes => [],
222229
#
@@ -309,7 +316,7 @@
309316
help => 'The id of the SCOT datatype that originated this sig',
310317
label => "Reference ID",
311318
},
312-
{
319+
{
313320
type => "multi_select",
314321
key => "action",
315322
value => [
@@ -465,6 +472,59 @@
465472
help => "Select Date/Time Incident was closed",
466473
},
467474
],
475+
incident_v2 => [
476+
{
477+
type => 'dropdown',
478+
key => 'type',
479+
value => [
480+
# place your types here...
481+
{ value => "none", selected => 1 },
482+
{ value => "intrusion", selected => 0 },
483+
{ value => "malware", selected => 0 },
484+
],
485+
value_type => {
486+
type => "static",
487+
url => undef,
488+
key => 'type',
489+
},
490+
label => "Incident Type",
491+
help => <<'EOF',
492+
<table>
493+
<tr> <th>intrusion</th><td>An intrusion occurred</td> </tr>
494+
<tr> <th>malware</th> <td>Malware detected</td> </tr>
495+
</table>
496+
EOF
497+
},
498+
{
499+
type => "calendar",
500+
key => "discovered",
501+
value => "",
502+
value_type => {
503+
type => "static",
504+
url => undef,
505+
key => 'discovered',
506+
},
507+
label => "Date/Time Discovered",
508+
help => "Select Date/Time Incident was discovered",
509+
},
510+
{
511+
type => "dropdown",
512+
key => "severity",
513+
value => [
514+
{value => 'NONE', selected => 1},
515+
{value => 'Low', selected => 0},
516+
{value => 'Moderate', selected => 0},
517+
{value => 'High', selected => 0},
518+
],
519+
value_type => {
520+
type => "static",
521+
url => undef,
522+
key => 'severity',
523+
},
524+
label => 'Incident severity',
525+
help => "Select best match for incident severity",
526+
},
527+
],
468528
guide => [
469529
{
470530
type => "input_multi",
@@ -480,4 +540,23 @@
480540
},
481541
],
482542
},
543+
dailybrief => {
544+
mail => {
545+
from => '[email protected]',
546+
547+
host => 'smtp.yourdomain.com',
548+
},
549+
url => 'https://scot.yourdomain.com/'
550+
},
551+
incident_summary_template => <<EOF,
552+
<table>
553+
<tr><th>Description</th><td><i>place description of the incident here</i></td></tr>
554+
<tr><th>Related Indicators</th><td><i>Place IOC's here</i></td></tr>
555+
<tr><th>Source Details</th><td><i>Place wource port, ip, protocol, etc. here</i></td></tr>
556+
<tr><th>Compromised System Details</th><td><i>Place details about compromised System here</i></td></tr>
557+
<tr><th>Recovery/Mitigation Actions</th><td><i>Place recovery/mitigation details here</i></td></tr>
558+
<tr><th>Physical Location of System</th><td><i>Place the city and State of system location</i></td></tr>
559+
<tr><th>Detection Details</th><td><i>Place Source, methods, or tools used to identify incident</i></td></tr>
560+
</table>
561+
EOF
483562
);

0 commit comments

Comments
 (0)