internet_security_event 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/internet_security_event/tls_status.rb +14 -2
- data/lib/internet_security_event/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c45d13b633f75d73835bc5df4366f4c7dc778637124b04dfcca841d170062bb8
|
4
|
+
data.tar.gz: 51012612ff7d23ae2019471663f7c16b50d04665f467efad9a13abd377662cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba96b78855a50ce723f9f26c869d9b65a4f0261d79730139c16bac20c56ffd9bfd01921f3152cd94c10648d7ae262474cadda190f5c433e48913a00f9a6b62ab
|
7
|
+
data.tar.gz: c77cf433031d25d2c61089e098db1a097853432449060bd1600e66ef5d2a6c37a0a3065182ffb2dcb623222da708898dfe6ffb5b5ccc5a59301adbc1308a7446
|
@@ -37,18 +37,30 @@ module InternetSecurityEvent
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def hostname_match_subject?
|
40
|
-
common_name
|
40
|
+
name_match_patern(hostname, common_name)
|
41
41
|
end
|
42
42
|
|
43
43
|
def hostname_match_subject_alternative_name?
|
44
44
|
return false unless certificate
|
45
45
|
|
46
46
|
san = certificate.extensions.select { |ext| ext.oid == 'subjectAltName' }.first
|
47
|
-
|
47
|
+
|
48
|
+
if san
|
49
|
+
alt_names = san.value.split(', ').map { |name| name.sub(/\ADNS:/, '') }
|
50
|
+
return true if alt_names.any? { |alt_name| name_match_patern(hostname, alt_name) }
|
51
|
+
end
|
48
52
|
|
49
53
|
false
|
50
54
|
end
|
51
55
|
|
56
|
+
def name_match_patern(hostname, pattern)
|
57
|
+
re = Regexp.new('\A' + pattern.split('*').map do |st|
|
58
|
+
Regexp.escape(st)
|
59
|
+
end.join('[^.]*') + '\z')
|
60
|
+
|
61
|
+
re.match(hostname)
|
62
|
+
end
|
63
|
+
|
52
64
|
def common_name
|
53
65
|
certificate.subject.to_a.select { |data| data[0] == 'CN' }.map { |data| data[1] }.first if certificate
|
54
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: internet_security_event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain Tartière
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|