onesnooper-server 0.0.1 → 0.0.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/.travis.yml +16 -0
- data/lib/onesnooper-server.rb +1 -0
- data/lib/onesnooper_server/request_handler.rb +16 -2
- data/lib/onesnooper_server/settings.rb +1 -1
- data/lib/onesnooper_server/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f37b299a996de04590e37698e8653e38524621da
|
4
|
+
data.tar.gz: 2111589b7f09581c5f91f3873d0ca561f2553ebc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dd3a98270426888068976d57e84fe6bbc40c0936bb48bac922ba1cd87414dc4d7ab3be36df85a0695228b52dd4d7f33fec0b369876e59a4db0380ef60a5181e
|
7
|
+
data.tar.gz: 6e5add9f0fad2db2030bebf00fbc672c2632e437f6222bf20654906762738fb9d2d833a212fc59bba52e4d6be985a3e94cfe407646368d28a7dc395da325dd0f
|
data/.travis.yml
ADDED
data/lib/onesnooper-server.rb
CHANGED
@@ -32,7 +32,7 @@ class OnesnooperServer::RequestHandler
|
|
32
32
|
# @param source_port [String] port number of the client
|
33
33
|
def self.parse(monitoring_datagram, source_ip, source_port)
|
34
34
|
unless valid_data?(monitoring_datagram)
|
35
|
-
::OnesnooperServer::Log.
|
35
|
+
::OnesnooperServer::Log.error "[#{self.name}] Dropping invalid monitoring data #{monitoring_datagram.inspect}"
|
36
36
|
return DATAGRAMS.default.new
|
37
37
|
end
|
38
38
|
|
@@ -68,7 +68,21 @@ private
|
|
68
68
|
# @param source_ip [String] IP address to match
|
69
69
|
# @return [Boolean] result
|
70
70
|
def self.valid_peer?(source_ip)
|
71
|
-
|
71
|
+
begin
|
72
|
+
source_ip = ::IPAddr.new(::Resolv.getaddress(source_ip))
|
73
|
+
::OnesnooperServer::Log.debug "[#{self.name}] Resolved source IP" \
|
74
|
+
" address to #{source_ip.inspect}"
|
75
|
+
rescue => ex
|
76
|
+
::OnesnooperServer::Log.error "[#{self.name}] Invalid source IP" \
|
77
|
+
" address #{source_ip.inspect}, dropping"
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
|
81
|
+
::OnesnooperServer::Settings.allowed_sources.each do |allowed_source|
|
82
|
+
return true if ::IPAddr.new(allowed_source).include?(source_ip)
|
83
|
+
end
|
84
|
+
|
85
|
+
false
|
72
86
|
end
|
73
87
|
|
74
88
|
# Retrieves a list of instances for allowed store backends.
|
@@ -8,5 +8,5 @@ class OnesnooperServer::Settings < ::Settingslogic
|
|
8
8
|
source "/etc/onesnooper-server/onesnooper-server.yml" if File.readable?("/etc/onesnooper-server/onesnooper-server.yml")
|
9
9
|
source "#{gem_root}/config/onesnooper-server.yml"
|
10
10
|
|
11
|
-
namespace ENV['RAILS_ENV'] ?
|
11
|
+
namespace ENV['RAILS_ENV'].blank? ? 'production' : ENV['RAILS_ENV']
|
12
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onesnooper-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Parak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -202,6 +202,7 @@ extensions: []
|
|
202
202
|
extra_rdoc_files: []
|
203
203
|
files:
|
204
204
|
- ".gitignore"
|
205
|
+
- ".travis.yml"
|
205
206
|
- Gemfile
|
206
207
|
- LICENSE
|
207
208
|
- README.md
|