norad_beacon 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/lib/norad_beacon/container_options.rb +1 -3
- data/lib/norad_beacon/result.rb +21 -1
- data/lib/norad_beacon/version.rb +1 -1
- data/norad_beacon.gemspec +3 -2
- metadata +25 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d13c67f1371165cae9ca885c7573faf2e1f39fa0
|
|
4
|
+
data.tar.gz: 26752d82f9b15c9f2a8871ae4b9f412457e6d3dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bbd5d5da22ab1905f6635b3fc893cb063b55ff3b886ffae1fa7baf557a3e63ac2eea9409116dd5f189c3b308569ef124b90b84efacf6fc75426fe3d52ccd9aa7
|
|
7
|
+
data.tar.gz: 7e312d7ce61eb84a25440653d1a1b3d1b76cfdb5d56582fb41d939f6a37ad4279e5169b7f931141e7b17519798db7dfe45e6c129409ff135b183a053263e22bf
|
data/.rubocop.yml
CHANGED
|
@@ -18,14 +18,12 @@ module NoradBeacon
|
|
|
18
18
|
# Reads encrypted credentials from disk, decrypts the
|
|
19
19
|
# credentials, and loads and returns the YAML.
|
|
20
20
|
# @return [Hash]
|
|
21
|
-
# rubocop:disable YAMLLoad
|
|
22
21
|
def decrypt_and_load
|
|
23
22
|
aes_key = load_key_from_env
|
|
24
|
-
symbolize YAML.
|
|
23
|
+
symbolize YAML.safe_load(decrypt_containers_file(aes_key))
|
|
25
24
|
rescue Psych::SyntaxError
|
|
26
25
|
raise NoradBeaconError, e.message
|
|
27
26
|
end
|
|
28
|
-
# rubocop:enable YAMLLoad
|
|
29
27
|
|
|
30
28
|
# Load the Base64 encoded key from the environment
|
|
31
29
|
# @return [String] AES Key
|
data/lib/norad_beacon/result.rb
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require 'json'
|
|
3
|
+
require 'openssl'
|
|
3
4
|
|
|
4
5
|
module NoradBeacon
|
|
5
6
|
class Result
|
|
7
|
+
attr_reader :nid, :sir, :status, :output, :title, :description, :signature
|
|
8
|
+
|
|
9
|
+
# I'm making both of these values constants to reinforce the idea that these values should
|
|
10
|
+
# *never* change. If they do, all ignore rules in the Norad database we'll be invalidated.
|
|
11
|
+
SIGNATURE_DIGEST = OpenSSL::Digest.new('sha256')
|
|
12
|
+
SIGNATURE_KEY = 'n0r4dRULES'
|
|
13
|
+
|
|
6
14
|
# rubocop:disable ParameterLists
|
|
7
15
|
def initialize(nid, status, output, title, description, sir = 'unevaluated')
|
|
8
16
|
@nid = nid
|
|
@@ -11,12 +19,19 @@ module NoradBeacon
|
|
|
11
19
|
@output = output
|
|
12
20
|
@title = title
|
|
13
21
|
@description = description
|
|
22
|
+
@signature = compute_signature
|
|
14
23
|
end
|
|
15
24
|
# rubocop:enable ParameterLists
|
|
16
25
|
|
|
17
26
|
def to_json(*a)
|
|
18
27
|
{
|
|
19
|
-
nid:
|
|
28
|
+
nid: nid,
|
|
29
|
+
sir: sir,
|
|
30
|
+
status: status,
|
|
31
|
+
output: output,
|
|
32
|
+
title: title,
|
|
33
|
+
description: description,
|
|
34
|
+
signature: signature
|
|
20
35
|
}.to_json(*a)
|
|
21
36
|
end
|
|
22
37
|
|
|
@@ -33,5 +48,10 @@ module NoradBeacon
|
|
|
33
48
|
return 'unevaluated'
|
|
34
49
|
end
|
|
35
50
|
end
|
|
51
|
+
|
|
52
|
+
def compute_signature
|
|
53
|
+
result_for_signature = nid.to_s + title.to_s + status.to_s
|
|
54
|
+
OpenSSL::HMAC.hexdigest(SIGNATURE_DIGEST, SIGNATURE_KEY, result_for_signature)
|
|
55
|
+
end
|
|
36
56
|
end
|
|
37
57
|
end
|
data/lib/norad_beacon/version.rb
CHANGED
data/norad_beacon.gemspec
CHANGED
|
@@ -28,7 +28,8 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
|
30
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
31
|
-
spec.add_development_dependency '
|
|
32
|
-
spec.add_development_dependency '
|
|
31
|
+
spec.add_development_dependency 'rainbow', '~> 2.1.0' # There is a bug in rainbow 2.2.1
|
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 0.47'
|
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.5'
|
|
33
34
|
spec.add_development_dependency 'bundler-audit', '~> 0.5'
|
|
34
35
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: norad_beacon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Blake Hitchcock
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: exe
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2017-01-
|
|
13
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: httparty
|
|
@@ -82,34 +82,48 @@ dependencies:
|
|
|
82
82
|
- - "~>"
|
|
83
83
|
- !ruby/object:Gem::Version
|
|
84
84
|
version: '10.0'
|
|
85
|
+
- !ruby/object:Gem::Dependency
|
|
86
|
+
name: rainbow
|
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - "~>"
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: 2.1.0
|
|
92
|
+
type: :development
|
|
93
|
+
prerelease: false
|
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - "~>"
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: 2.1.0
|
|
85
99
|
- !ruby/object:Gem::Dependency
|
|
86
100
|
name: rubocop
|
|
87
101
|
requirement: !ruby/object:Gem::Requirement
|
|
88
102
|
requirements:
|
|
89
|
-
- - "
|
|
103
|
+
- - "~>"
|
|
90
104
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: '0'
|
|
105
|
+
version: '0.47'
|
|
92
106
|
type: :development
|
|
93
107
|
prerelease: false
|
|
94
108
|
version_requirements: !ruby/object:Gem::Requirement
|
|
95
109
|
requirements:
|
|
96
|
-
- - "
|
|
110
|
+
- - "~>"
|
|
97
111
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: '0'
|
|
112
|
+
version: '0.47'
|
|
99
113
|
- !ruby/object:Gem::Dependency
|
|
100
114
|
name: rspec
|
|
101
115
|
requirement: !ruby/object:Gem::Requirement
|
|
102
116
|
requirements:
|
|
103
|
-
- - "
|
|
117
|
+
- - "~>"
|
|
104
118
|
- !ruby/object:Gem::Version
|
|
105
|
-
version: '
|
|
119
|
+
version: '3.5'
|
|
106
120
|
type: :development
|
|
107
121
|
prerelease: false
|
|
108
122
|
version_requirements: !ruby/object:Gem::Requirement
|
|
109
123
|
requirements:
|
|
110
|
-
- - "
|
|
124
|
+
- - "~>"
|
|
111
125
|
- !ruby/object:Gem::Version
|
|
112
|
-
version: '
|
|
126
|
+
version: '3.5'
|
|
113
127
|
- !ruby/object:Gem::Dependency
|
|
114
128
|
name: bundler-audit
|
|
115
129
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -177,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
177
191
|
version: '0'
|
|
178
192
|
requirements: []
|
|
179
193
|
rubyforge_project:
|
|
180
|
-
rubygems_version: 2.6.
|
|
194
|
+
rubygems_version: 2.6.9
|
|
181
195
|
signing_key:
|
|
182
196
|
specification_version: 4
|
|
183
197
|
summary: Gem to help with posting blackbox results to Norad.
|