opendns-dnsdb 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95ec5ab3b69662472fe1a8e276083cad001dc2ca
4
- data.tar.gz: 3cc6ed001303febda2213640d0c555cf9b0f49c7
3
+ metadata.gz: b6ffc6fbdbd3300935d4bbedcfa0a9c6fabb2c2d
4
+ data.tar.gz: 5636e568eee7c925f5b2a2713f5394df5a3a4ce3
5
5
  SHA512:
6
- metadata.gz: 41c2801130fde839e1b011e140803732b4187f252415981863cca6392742c9cf37ed8f977ce8e7f467b456eaa7c2538dcb33ce8ead38fb020100326cdfb1ebba
7
- data.tar.gz: 6b5596e31c8c4493ac953a0c56ca3bc94dba07989fb8e939392c23f5209e077b227e8ecfa1bb09ea22fca81e2561b7a9a2c4a1ff392df9bd464f4747d6b94f1e
6
+ metadata.gz: 2e0e80f6dba1e3445af8f10d8a8a46c3368a3e015624279d98bdd9902f49bd4c1f210640ec8a91ba384f4b773a9b99c8d378d0ff4a94c10aee355d25c2e0e21a
7
+ data.tar.gz: 70985d6a478bf5248520c316ec6b51642133fce350f4b51357b9c17804f39fc93a374c3b48d3affed9668fa85fb392c626dda626947b571a5f25593d6fd5ffec
data/README.md CHANGED
@@ -12,14 +12,15 @@ building classifiers and reputation systems.
12
12
  Documentation
13
13
  -------------
14
14
 
15
- [Click here to read the full documentation of the OpenDNS DNSDB library](http://opendns-dnsdb-client-for-ruby.readthedocs.org/en/latest/).
15
+ [Click here to read the full documentation of the Security Graph library](http://opendns-dnsdb-client-for-ruby.readthedocs.org/en/latest/).
16
16
 
17
17
  Example
18
18
  -------
19
19
 
20
20
  ```ruby
21
21
  # Setup
22
- db = OpenDNS::DNSDB.new(sslcert: 'client.p12', sslcertpasswd: 'opendns')
22
+ db = OpenDNS::DNSDB.new(sslcert: 'client.pem',
23
+ sslcerttype: 'pem', sslcertpasswd: 'opendns')
23
24
 
24
25
  # A short list of known spam domains using a fast-flux infrastructure
25
26
  spam_names = ['com-garciniac.net', 'bbc-global.co.uk', 'com-october.net']
@@ -62,3 +63,19 @@ traffic = db.high_pass_filter(traffic, cutoff: 10)
62
63
  traffic_is_suspicious =
63
64
  db.relative_standard_deviation(traffic['www.github.io']) > 90
64
65
  ```
66
+
67
+ Note on certificates format
68
+ ---------------------------
69
+
70
+ The curl library currently has some major issues dealing with
71
+ certificates stored in the PKCS12 format.
72
+
73
+ If the certificate you have been given is in PKCS12 format (`.p12`
74
+ file extension), just convert it to a `.pem` certificate file:
75
+
76
+ openssl pkcs12 -in client.p12 -out client.pem -clcerts
77
+
78
+ And supply the path to the `.pem` file to the library.
79
+
80
+ Also make sure that the version of the curl library you are using is
81
+ up-to-date. Old versions had major bugs with concurrent queries.
@@ -9,7 +9,7 @@ Installation
9
9
 
10
10
  .. code-block:: bash
11
11
 
12
- $ bundle && rake install
12
+ $ gem install opendns-dnsdb
13
13
 
14
14
  Example
15
15
  =======
@@ -78,16 +78,31 @@ Setup
78
78
  .. code-block:: ruby
79
79
 
80
80
  require 'opendns-dnsdb'
81
- db = OpenDNS::DNSDB.new(sslcert: 'client.p12', sslcertpasswd: 'opendns')
81
+ db = OpenDNS::DNSDB.new(sslcert: 'client.pem', sslcertpasswd: 'opendns')
82
82
 
83
83
  Supported options:
84
84
 
85
85
  * ``timeout``: timeout for each query, in seconds (default: 15 seconds)
86
86
  * ``sslcert``: path to the SSL certificate
87
- * ``sslcerttype``: SSL certificate type, defaults to ``p12``
87
+ * ``sslcerttype``: SSL certificate type, defaults to ``pem``.
88
88
  * ``sslcertpasswd``: SSL certificate password
89
89
  * ``maxconnects``: max number of parallel operations (default: 10)
90
90
 
91
+ Note on certificates format
92
+ ===========================
93
+
94
+ The curl library currently has some major issues dealing with
95
+ certificates stored in the PKCS12 format.
96
+
97
+ If the certificate you have been given is in PKCS12 format (`.p12`
98
+ file extension), just convert it to a `.pem` certificate file:
99
+
100
+ .. code-block:: bash
101
+
102
+ openssl pkcs12 -in client.p12 -out client.pem -clcerts
103
+
104
+ And supply the path to the ``.pem`` file to the library.
105
+
91
106
  Operations
92
107
  ==========
93
108
 
@@ -37,14 +37,15 @@ module OpenDNS
37
37
  @timeout = params[:timeout].to_f if params[:timeout]
38
38
  @maxconnects = DEFAULT_MAXCONNECTS
39
39
  @maxconnects = params[:maxconnects].to_i if params[:maxconnects]
40
- @sslcerttype = params[:sslcerttype] || 'p12'
41
- @sslcertpasswd = params[:sslcertpasswd] || ''
40
+ @sslcerttype = params[:sslcerttype] || 'pem'
41
+ @sslcertpasswd = params[:sslcertpasswd] || 'opendns'
42
42
  @options = {
43
43
  followlocation: true,
44
44
  timeout: @timeout,
45
45
  sslcert: @sslcert,
46
46
  sslcerttype: @sslcerttype,
47
- sslcertpasswd: @sslcertpasswd
47
+ sslcertpasswd: @sslcertpasswd,
48
+ maxconnects: @maxconnects
48
49
  }
49
50
  end
50
51
 
@@ -76,13 +76,15 @@ module OpenDNS
76
76
  end
77
77
 
78
78
  def distinct_related_names(names, options = { }, &filter)
79
- res = Response::Distinct.new(distinct_rrs(related_names(names, &filter)))
80
- res = res[0...options[:max_names]] if options[:max_names]
79
+ names = [ names ] unless names.kind_of?(Enumerable)
80
+ res = Response::Distinct.new(distinct_rrs(related_names(names, &filter))) - names
81
+ return res[0...options[:max_names]] if options[:max_names] && res.length >= options[:max_names]
81
82
  if (options[:max_depth] || 1) > 1
82
83
  options0 = options.clone
83
84
  options0[:max_depth] -= 1
84
85
  related = distinct_related_names(res, options0, &filter)
85
- res = (res + related).uniq
86
+ res += related - names
87
+ res.uniq!
86
88
  res = res[0...options[:max_names]] if options[:max_names]
87
89
  end
88
90
  res
@@ -1,5 +1,5 @@
1
1
  module OpenDNS
2
2
  class DNSDB
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
 
2
2
  require 'opendns-dnsdb'
3
3
 
4
- CERT_FILE = '/tmp/client.p12'
4
+ CERT_FILE = '/tmp/client.pem'
5
5
  CERT_PASSWD = 'opendns'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opendns-dnsdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Denis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-04 00:00:00.000000000 Z
11
+ date: 2013-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake