contact-data 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ssl_doctor.rb +88 -0
- data/lib/contact-data/version.rb +1 -1
- data/spec/support/cassettes/domain_name.yml +145 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bd73eeb2dc6f8726aed04e826ea544613dbf1be
|
4
|
+
data.tar.gz: 4fa7eea037ee61483620eec08c2cc8ad22e3fd66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1952a1600bb78416bda344cd742fb589982877bfc99ec97a3e25ca7b92bcad975969c42564947749441b70e211142c006d6bd24316332108bf0158943784f95c
|
7
|
+
data.tar.gz: 388944db9157418dc472aa27bbc38c43f23e2087f5f962224f59a471a02aa3a9f535725dbc050fe5852c9981d8d9b5b96e73eb6ba78e3e2f37ff9ed7f1e42816
|
data/bin/ssl_doctor.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Usage: ruby doctor.rb [HOST=status.github.com[:PORT=443]]
|
3
|
+
require 'rbconfig'
|
4
|
+
require 'net/https'
|
5
|
+
|
6
|
+
if ARGV[0] =~ /^[^-]/
|
7
|
+
host, port = ARGV[0].split(':', 2)
|
8
|
+
else
|
9
|
+
host = 'status.github.com'
|
10
|
+
end
|
11
|
+
port ||= 443
|
12
|
+
|
13
|
+
ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
14
|
+
ruby_version = RUBY_VERSION
|
15
|
+
if patch = RbConfig::CONFIG['PATCHLEVEL']
|
16
|
+
ruby_version += "-p#{patch}"
|
17
|
+
end
|
18
|
+
puts "%s (%s)" % [ruby, ruby_version]
|
19
|
+
|
20
|
+
openssl_dir = OpenSSL::X509::DEFAULT_CERT_AREA
|
21
|
+
mac_openssl = '/System/Library/OpenSSL' == openssl_dir
|
22
|
+
puts "%s: %s" % [OpenSSL::OPENSSL_VERSION, openssl_dir]
|
23
|
+
[OpenSSL::X509::DEFAULT_CERT_DIR_ENV, OpenSSL::X509::DEFAULT_CERT_FILE_ENV].each do |key|
|
24
|
+
puts "%s=%s" % [key, ENV[key].to_s.inspect]
|
25
|
+
end
|
26
|
+
|
27
|
+
ca_file = ENV[OpenSSL::X509::DEFAULT_CERT_FILE_ENV] || OpenSSL::X509::DEFAULT_CERT_FILE
|
28
|
+
ca_path = (ENV[OpenSSL::X509::DEFAULT_CERT_DIR_ENV] || OpenSSL::X509::DEFAULT_CERT_DIR).chomp('/')
|
29
|
+
|
30
|
+
puts "\nHEAD https://#{host}:#{port}"
|
31
|
+
http = Net::HTTP.new(host, port)
|
32
|
+
http.use_ssl = true
|
33
|
+
|
34
|
+
# Explicitly setting cert_store like this is not needed in most cases but it
|
35
|
+
# seems necessary in edge cases such as when using `verify_callback` in some
|
36
|
+
# combination of Ruby + OpenSSL versions.
|
37
|
+
http.cert_store = OpenSSL::X509::Store.new
|
38
|
+
http.cert_store.set_default_paths
|
39
|
+
|
40
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
41
|
+
failed_cert = failed_cert_reason = nil
|
42
|
+
|
43
|
+
if mac_openssl
|
44
|
+
warn "warning: will not be able show failed certificate info on OS X's OpenSSL"
|
45
|
+
# This drives me absolutely nuts. It seems that on Rubies compiled against OS X's
|
46
|
+
# system OpenSSL, the mere fact of defining a `verify_callback` makes the
|
47
|
+
# cert verification fail for requests that would otherwise be successful.
|
48
|
+
else
|
49
|
+
http.verify_callback = lambda { |verify_ok, store_context|
|
50
|
+
if !verify_ok
|
51
|
+
failed_cert = store_context.current_cert
|
52
|
+
failed_cert_reason = "%d: %s" % [ store_context.error, store_context.error_string ]
|
53
|
+
end
|
54
|
+
verify_ok
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
user_agent = "net/http #{ruby_version}"
|
59
|
+
req = Net::HTTP::Head.new('/', 'user-agent' => user_agent)
|
60
|
+
|
61
|
+
begin
|
62
|
+
res = http.start { http.request(req) }
|
63
|
+
abort res.inspect if res.code.to_i >= 500
|
64
|
+
puts "OK"
|
65
|
+
rescue Errno::ECONNREFUSED
|
66
|
+
puts "Error: connection refused"
|
67
|
+
exit 1
|
68
|
+
rescue OpenSSL::SSL::SSLError => e
|
69
|
+
puts "#{e.class}: #{e.message}"
|
70
|
+
|
71
|
+
if failed_cert
|
72
|
+
puts "\nThe server presented a certificate that could not be verified:"
|
73
|
+
puts " subject: #{failed_cert.subject}"
|
74
|
+
puts " issuer: #{failed_cert.issuer}"
|
75
|
+
puts " error code %s" % failed_cert_reason
|
76
|
+
end
|
77
|
+
|
78
|
+
ca_file_missing = !File.exist?(ca_file) && !mac_openssl
|
79
|
+
ca_path_empty = Dir["#{ca_path}/*"].empty?
|
80
|
+
|
81
|
+
if ca_file_missing || ca_path_empty
|
82
|
+
puts "\nPossible causes:"
|
83
|
+
puts " `%s' does not exist" % ca_file if ca_file_missing
|
84
|
+
puts " `%s/' is empty" % ca_path if ca_path_empty
|
85
|
+
end
|
86
|
+
|
87
|
+
exit 1
|
88
|
+
end
|
data/lib/contact-data/version.rb
CHANGED
@@ -0,0 +1,145 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://public.xenapto.com/api/v3/contacts/from_domain.json?domain=anthemis.com
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx/1.8.1
|
23
|
+
Date:
|
24
|
+
- Thu, 14 Apr 2016 11:16:30 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '163'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Frame-Options:
|
32
|
+
- SAMEORIGIN
|
33
|
+
X-Xss-Protection:
|
34
|
+
- 1; mode=block
|
35
|
+
X-Content-Type-Options:
|
36
|
+
- nosniff
|
37
|
+
Etag:
|
38
|
+
- W/"759b5d9178f77e2a2d0fa75ee4897054"
|
39
|
+
Cache-Control:
|
40
|
+
- max-age=0, private, must-revalidate
|
41
|
+
X-Request-Id:
|
42
|
+
- 8a791012-1cdc-464f-b602-9a51c8c7b7c2
|
43
|
+
X-Runtime:
|
44
|
+
- '0.067825'
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: '{"contacts":[{"name":"Anthemis Group","contact_type":"organization","slug":"anthemis-group"}],"domain":"anthemis.com","contact_type":"organization","version":"v3"}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Thu, 14 Apr 2016 11:16:30 GMT
|
50
|
+
- request:
|
51
|
+
method: get
|
52
|
+
uri: http://public.xenapto.com/api/v3/contacts/from_domain.json?contact_type=person&domain=anthemis.com
|
53
|
+
body:
|
54
|
+
encoding: US-ASCII
|
55
|
+
string: ''
|
56
|
+
headers:
|
57
|
+
Accept:
|
58
|
+
- "*/*; q=0.5, application/xml"
|
59
|
+
Accept-Encoding:
|
60
|
+
- gzip, deflate
|
61
|
+
User-Agent:
|
62
|
+
- Ruby
|
63
|
+
response:
|
64
|
+
status:
|
65
|
+
code: 200
|
66
|
+
message: OK
|
67
|
+
headers:
|
68
|
+
Server:
|
69
|
+
- nginx/1.8.1
|
70
|
+
Date:
|
71
|
+
- Thu, 14 Apr 2016 11:19:36 GMT
|
72
|
+
Content-Type:
|
73
|
+
- application/json; charset=utf-8
|
74
|
+
Content-Length:
|
75
|
+
- '141'
|
76
|
+
Connection:
|
77
|
+
- keep-alive
|
78
|
+
X-Frame-Options:
|
79
|
+
- SAMEORIGIN
|
80
|
+
X-Xss-Protection:
|
81
|
+
- 1; mode=block
|
82
|
+
X-Content-Type-Options:
|
83
|
+
- nosniff
|
84
|
+
Etag:
|
85
|
+
- W/"a74f008fdc1690a80e0adce9f1c52034"
|
86
|
+
Cache-Control:
|
87
|
+
- max-age=0, private, must-revalidate
|
88
|
+
X-Request-Id:
|
89
|
+
- b67d5255-188a-431a-8ef6-8e72cf78096d
|
90
|
+
X-Runtime:
|
91
|
+
- '0.046081'
|
92
|
+
body:
|
93
|
+
encoding: UTF-8
|
94
|
+
string: '{"contacts":[{"name":"Sean Park","contact_type":"person","slug":"sean-park"}],"domain":"anthemis.com","contact_type":"person","version":"v3"}'
|
95
|
+
http_version:
|
96
|
+
recorded_at: Thu, 14 Apr 2016 11:19:36 GMT
|
97
|
+
- request:
|
98
|
+
method: get
|
99
|
+
uri: http://public.xenapto.com/api/v3/contacts/from_domain.json?contact_type=all&domain=anthemis.com
|
100
|
+
body:
|
101
|
+
encoding: US-ASCII
|
102
|
+
string: ''
|
103
|
+
headers:
|
104
|
+
Accept:
|
105
|
+
- "*/*; q=0.5, application/xml"
|
106
|
+
Accept-Encoding:
|
107
|
+
- gzip, deflate
|
108
|
+
User-Agent:
|
109
|
+
- Ruby
|
110
|
+
response:
|
111
|
+
status:
|
112
|
+
code: 200
|
113
|
+
message: OK
|
114
|
+
headers:
|
115
|
+
Server:
|
116
|
+
- nginx/1.8.1
|
117
|
+
Date:
|
118
|
+
- Thu, 14 Apr 2016 11:20:31 GMT
|
119
|
+
Content-Type:
|
120
|
+
- application/json; charset=utf-8
|
121
|
+
Content-Length:
|
122
|
+
- '218'
|
123
|
+
Connection:
|
124
|
+
- keep-alive
|
125
|
+
X-Frame-Options:
|
126
|
+
- SAMEORIGIN
|
127
|
+
X-Xss-Protection:
|
128
|
+
- 1; mode=block
|
129
|
+
X-Content-Type-Options:
|
130
|
+
- nosniff
|
131
|
+
Etag:
|
132
|
+
- W/"333d258d54d925cc51c6a0de5510466c"
|
133
|
+
Cache-Control:
|
134
|
+
- max-age=0, private, must-revalidate
|
135
|
+
X-Request-Id:
|
136
|
+
- f13a260a-ce8a-4a78-bce2-93e889be0241
|
137
|
+
X-Runtime:
|
138
|
+
- '0.135487'
|
139
|
+
body:
|
140
|
+
encoding: UTF-8
|
141
|
+
string: '{"contacts":[{"name":"Anthemis Group","contact_type":"organization","slug":"anthemis-group"},{"name":"Sean
|
142
|
+
Park","contact_type":"person","slug":"sean-park"}],"domain":"anthemis.com","contact_type":"all","version":"v3"}'
|
143
|
+
http_version:
|
144
|
+
recorded_at: Thu, 14 Apr 2016 11:20:31 GMT
|
145
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contact-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenapto
|
@@ -209,7 +209,8 @@ dependencies:
|
|
209
209
|
description: A Ruby gem to retrieve data about people and organizations from http://public.xenapto.com
|
210
210
|
email:
|
211
211
|
- developers@xenapto.com
|
212
|
-
executables:
|
212
|
+
executables:
|
213
|
+
- ssl_doctor.rb
|
213
214
|
extensions: []
|
214
215
|
extra_rdoc_files: []
|
215
216
|
files:
|
@@ -225,6 +226,7 @@ files:
|
|
225
226
|
- LICENSE
|
226
227
|
- README.md
|
227
228
|
- Rakefile
|
229
|
+
- bin/ssl_doctor.rb
|
228
230
|
- contact-data.gemspec
|
229
231
|
- lib/contact-data.rb
|
230
232
|
- lib/contact-data/contact.rb
|
@@ -244,6 +246,7 @@ files:
|
|
244
246
|
- spec/support/cassettes/deprecated_contact_name_search.yml
|
245
247
|
- spec/support/cassettes/deprecated_contact_search.yml
|
246
248
|
- spec/support/cassettes/deprecated_link_metadata.yml
|
249
|
+
- spec/support/cassettes/domain_name.yml
|
247
250
|
- spec/support/cassettes/links_info_search.yml
|
248
251
|
- spec/support/cassettes/links_latest.yml
|
249
252
|
- spec/support/cassettes/name_search.yml
|
@@ -284,6 +287,7 @@ test_files:
|
|
284
287
|
- spec/support/cassettes/deprecated_contact_name_search.yml
|
285
288
|
- spec/support/cassettes/deprecated_contact_search.yml
|
286
289
|
- spec/support/cassettes/deprecated_link_metadata.yml
|
290
|
+
- spec/support/cassettes/domain_name.yml
|
287
291
|
- spec/support/cassettes/links_info_search.yml
|
288
292
|
- spec/support/cassettes/links_latest.yml
|
289
293
|
- spec/support/cassettes/name_search.yml
|