truemail 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/truemail/audit/base.rb +4 -0
- data/lib/truemail/audit/ptr.rb +26 -9
- data/lib/truemail/version.rb +1 -1
- data/lib/truemail/wrapper.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 232ed298a07a579faf90cacc3026134e5ddf7115341df4f337c1108d262e284a
|
4
|
+
data.tar.gz: 997c3a81c6fcf3faa2e797fcd9047970a7a39f66551252529aaaa3a4ea978428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffa32874a430e4af6a04828744f0d5c9f1adc7d9f5a58de547c62666ecc639c7b4af2a1979368a2e1264196e391dfbfe1df33ab2fa42efef39d13447ed94c571
|
7
|
+
data.tar.gz: 1546da1c4106c114a0eb3180ad4361749b5334ca5c791a5f11b6f98aabffa3a4a52f57c52666b82972b7e2a75529c781ff22430180c6c8c529cf2f2a0f7450ae
|
data/.reek.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/truemail/audit/base.rb
CHANGED
data/lib/truemail/audit/ptr.rb
CHANGED
@@ -6,23 +6,32 @@ module Truemail
|
|
6
6
|
require 'ipaddr'
|
7
7
|
require 'resolv'
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
GET_MY_IP_URL = 'https://api.ipify.org'
|
10
|
+
IPIFY_ERROR = 'impossible to detect current host address via third party service'
|
11
|
+
PTR_NOT_FOUND = 'ptr record for current host address was not found'
|
12
|
+
PTR_NOT_REFER = 'ptr record does not reference to current verifier domain'
|
13
|
+
VERIFIER_DOMAIN_NOT_REFER = ''
|
11
14
|
|
12
15
|
def run
|
13
|
-
return if
|
14
|
-
return if
|
15
|
-
add_warning(Truemail::Audit::Ptr::
|
16
|
+
return if !current_host_address && add_warning(Truemail::Audit::Ptr::IPIFY_ERROR)
|
17
|
+
return if ptr_records.empty? && add_warning(Truemail::Audit::Ptr::PTR_NOT_FOUND)
|
18
|
+
return if ptr_not_refer_to_verifier_domain? && add_warning(Truemail::Audit::Ptr::PTR_NOT_REFER)
|
19
|
+
return if verifier_domain_refer_to_current_host_address?
|
20
|
+
add_warning(Truemail::Audit::Ptr::VERIFIER_DOMAIN_NOT_REFER)
|
16
21
|
end
|
17
22
|
|
18
23
|
private
|
19
24
|
|
25
|
+
def detect_ip_via_ipify
|
26
|
+
Net::HTTP.get(URI(Truemail::Audit::Ptr::GET_MY_IP_URL))
|
27
|
+
end
|
28
|
+
|
20
29
|
def current_host_address
|
21
|
-
|
30
|
+
@current_host_address ||= Truemail::Wrapper.call { IPAddr.new(detect_ip_via_ipify) }
|
22
31
|
end
|
23
32
|
|
24
33
|
def current_host_reverse_lookup
|
25
|
-
|
34
|
+
current_host_address.reverse
|
26
35
|
end
|
27
36
|
|
28
37
|
def ptr_records
|
@@ -33,8 +42,16 @@ module Truemail
|
|
33
42
|
end || []
|
34
43
|
end
|
35
44
|
|
36
|
-
def
|
37
|
-
ptr_records.include?(
|
45
|
+
def ptr_not_refer_to_verifier_domain?
|
46
|
+
!ptr_records.include?(verifier_domain)
|
47
|
+
end
|
48
|
+
|
49
|
+
def a_record
|
50
|
+
Truemail::Wrapper.call { Resolv::DNS.new.getaddress(verifier_domain).to_s }
|
51
|
+
end
|
52
|
+
|
53
|
+
def verifier_domain_refer_to_current_host_address?
|
54
|
+
a_record == current_host_address.to_s
|
38
55
|
end
|
39
56
|
end
|
40
57
|
end
|
data/lib/truemail/version.rb
CHANGED
data/lib/truemail/wrapper.rb
CHANGED
@@ -14,7 +14,7 @@ module Truemail
|
|
14
14
|
|
15
15
|
def call(&block)
|
16
16
|
Timeout.timeout(Truemail.configuration.connection_timeout, &block)
|
17
|
-
rescue Resolv::ResolvError
|
17
|
+
rescue Resolv::ResolvError, IPAddr::InvalidAddressError
|
18
18
|
false
|
19
19
|
rescue Timeout::Error
|
20
20
|
retry unless (self.attempts -= 1).zero?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: truemail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.7.
|
232
|
+
rubygems_version: 2.7.9
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: truemail
|