internet_security_event 2.0.0 → 4.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96f9a7ff480196b6577e3d641424234b389a047b9c96c4f3984d8eabc1def59b
4
- data.tar.gz: 194a8f754e108ac4abc3caec23711da90744aedc9afd0709e138f513ae07d840
3
+ metadata.gz: c0e9c8ea09fa7bf7a9ba45617a8895c3cef64191c7c9d79781e1cf7f0c429908
4
+ data.tar.gz: e76ee0ae675bb3b23f19c069b44711a6e994399c3a376498c64f23046b023d12
5
5
  SHA512:
6
- metadata.gz: 225eb6c94b4d3888546451f3676dd243e52b5587cce800fa1da10638f0b0c202bd2365bc6091419c63e5a6e406f55ba34d1b94e103911ce071e1bf7f301627e8
7
- data.tar.gz: 669d9be990c119395fb67b76db876f94319693a3379d9e9a28442f5cb30498a93510f5b1142f83d47fca0bc7e3ae34d6df7c8a52b81394d37ac957afd315045d
6
+ metadata.gz: ad03d4baf5eeb39dd8006c761c00106ee7bf3f7ed713ed68afb1db5a28dad1dd464fd66a89dc021b18afa27da19358a12ab4ab1a5d5be2d83c9a2e5d7390dadc
7
+ data.tar.gz: 0ef2288e630626c33dd39b2eb46492a557ed9c886cbeb41478e73c7e9b192bb883d9ab94d2928f608d0b6e10bffbf9c947362951e7724c0dfedf87492787c1f6
@@ -7,8 +7,6 @@ on:
7
7
  pull_request:
8
8
  branches:
9
9
  - main
10
- schedule:
11
- - cron: "0 17 * * *"
12
10
 
13
11
  jobs:
14
12
  rubocop:
@@ -28,10 +26,10 @@ jobs:
28
26
  strategy:
29
27
  matrix:
30
28
  ruby:
31
- - "2.6"
32
- - "2.7"
33
- - "3.0"
34
29
  - "3.1"
30
+ - "3.2"
31
+ - "3.3"
32
+ - "3.4"
35
33
  name: Ruby ${{ matrix.ruby }}
36
34
  steps:
37
35
  - uses: actions/checkout@v2
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  AllCops:
2
2
  AllowSymlinksInCacheRootDirectory: true
3
3
 
4
- require:
4
+ plugins:
5
5
  - rubocop-rake
6
6
  - rubocop-rspec
7
7
 
@@ -9,7 +9,7 @@ Layout/HashAlignment:
9
9
  EnforcedColonStyle: table
10
10
  EnforcedHashRocketStyle: table
11
11
 
12
- Metrics/LineLength:
12
+ Layout/LineLength:
13
13
  Max: 160
14
14
 
15
15
  Style/Documentation:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [v4.0.0](https://github.com/smortex/internet_security_event/tree/v4.0.0) (2025-10-07)
9
+
10
+ [Full Changelog](https://github.com/smortex/internet_security_event/compare/v3.0.0...v4.0.0)
11
+
12
+ **Breaking changes:**
13
+
14
+ - Switch to ActiveSupport 7.x [\#6](https://github.com/smortex/internet_security_event/pull/6) ([smortex](https://github.com/smortex))
15
+
16
+ **Implemented enhancements:**
17
+
18
+ - Run CI an Ruby 3.3 and 3.4 [\#7](https://github.com/smortex/internet_security_event/pull/7) ([smortex](https://github.com/smortex))
19
+
20
+ ## [v3.0.0](https://github.com/smortex/internet_security_event/tree/v3.0.0) (2023-04-17)
21
+
22
+ [Full Changelog](https://github.com/smortex/internet_security_event/compare/v2.0.0...v3.0.0)
23
+
24
+ **Breaking changes:**
25
+
26
+ - Add support for verifying CRL [\#4](https://github.com/smortex/internet_security_event/pull/4) ([smortex](https://github.com/smortex))
27
+
3
28
  ## [v2.0.0](https://github.com/smortex/internet_security_event/tree/v2.0.0) (2022-07-16)
4
29
 
5
30
  [Full Changelog](https://github.com/smortex/internet_security_event/compare/v1.2.1...v2.0.0)
data/Rakefile CHANGED
@@ -7,9 +7,19 @@ require 'rspec/core/rake_task'
7
7
  RSpec::Core::RakeTask.new(:spec)
8
8
 
9
9
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
10
+ config.header = <<~HEADER.chomp
11
+ # Changelog
12
+
13
+ All notable changes to this project will be documented in this file.
14
+
15
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
16
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
17
+ HEADER
18
+ config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog ignore]
10
19
  config.user = 'smortex'
11
20
  config.project = 'internet_security_event'
12
21
  config.since_tag = 'v1.2.1'
22
+ config.issues = false
13
23
  require 'internet_security_event/version'
14
24
  config.future_release = "v#{InternetSecurityEvent::VERSION}"
15
25
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = 'Build events describing the status of various internet services'
14
14
  spec.homepage = 'https://github.com/smortex/internet_security_event'
15
15
  spec.license = 'MIT'
16
- spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
16
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
17
17
 
18
18
  # Specify which files should be added to the gem when it is released.
19
19
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.add_dependency 'activesupport', '~> 6.0'
27
+ spec.add_dependency 'activesupport', '~> 7.0'
28
28
 
29
29
  spec.add_development_dependency 'bundler'
30
30
  spec.add_development_dependency 'github_changelog_generator'
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'internet_security_event/x509_status'
3
+ require 'internet_security_event/x509_certificate_status'
4
4
 
5
5
  module InternetSecurityEvent
6
- class TLSStatus < X509Status
6
+ class TLSStatus < X509CertificateStatus
7
+ attr_reader :hostname
8
+
7
9
  def initialize(hostname, certificate)
8
10
  @hostname = hostname
9
11
  super(certificate)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InternetSecurityEvent
4
- VERSION = '2.0.0'
4
+ VERSION = '4.0.0'
5
5
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'internet_security_event/x509_status'
4
+
5
+ module InternetSecurityEvent
6
+ class X509CertificateRevocationListStatus < X509Status
7
+ attr_reader :crl
8
+
9
+ def initialize(crl)
10
+ @crl = crl
11
+
12
+ super()
13
+ end
14
+
15
+ def description
16
+ super('crl')
17
+ end
18
+
19
+ def to_e
20
+ super.merge({
21
+ issuer: crl.issuer.to_s,
22
+ last_update: crl.last_update.to_s,
23
+ next_update: crl.next_update.to_s,
24
+ })
25
+ end
26
+
27
+ private
28
+
29
+ def not_before
30
+ crl.last_update
31
+ end
32
+
33
+ def not_after
34
+ crl.next_update
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'internet_security_event/x509_status'
4
+
5
+ module InternetSecurityEvent
6
+ class X509CertificateStatus < X509Status
7
+ attr_reader :certificate
8
+
9
+ def initialize(certificate)
10
+ @certificate = certificate
11
+
12
+ super()
13
+ end
14
+
15
+ def description
16
+ super('certificate')
17
+ end
18
+
19
+ def to_e
20
+ super.merge({
21
+ subject: certificate.subject.to_s,
22
+ issuer: certificate.issuer.to_s,
23
+ serial: certificate.serial.to_i,
24
+ not_before: certificate.not_before.to_s,
25
+ not_after: certificate.not_after.to_s,
26
+ })
27
+ end
28
+
29
+ private
30
+
31
+ def not_before
32
+ certificate.not_before
33
+ end
34
+
35
+ def not_after
36
+ certificate.not_after
37
+ end
38
+ end
39
+ end
@@ -4,27 +4,20 @@ require 'active_support/core_ext/numeric/time'
4
4
 
5
5
  module InternetSecurityEvent
6
6
  class X509Status
7
- attr_reader :certificate, :hostname
8
-
9
- def initialize(certificate)
10
- @certificate = certificate
11
- end
12
-
13
- def self.build(certificate)
14
- obj = new(certificate)
7
+ def self.build(object)
8
+ obj = if object.is_a?(OpenSSL::X509::Certificate)
9
+ X509CertificateStatus.new(object)
10
+ elsif object.is_a?(OpenSSL::X509::CRL)
11
+ X509CertificateRevocationListStatus.new(object)
12
+ end
15
13
  obj.to_e
16
14
  end
17
15
 
18
- def to_e # rubocop:disable Metrics/AbcSize
16
+ def to_e
19
17
  {
20
18
  state: state,
21
19
  description: description,
22
20
  metric: metric,
23
- subject: certificate.subject.to_s,
24
- issuer: certificate.issuer.to_s,
25
- serial: certificate.serial.to_i,
26
- not_before: certificate.not_before.to_s,
27
- not_after: certificate.not_after.to_s,
28
21
  }
29
22
  end
30
23
 
@@ -34,11 +27,15 @@ module InternetSecurityEvent
34
27
 
35
28
  private
36
29
 
37
- def description
38
- return "certificate will become valid in #{distance_of_time_in_words_to_now(certificate.not_before)}" if not_valid_yet?
39
- return "certificate has expired #{distance_of_time_in_words_to_now(certificate.not_after)} ago" if expired?
30
+ # Define these method in sub-classes
31
+ # def not_before; end
32
+ # def not_after; end
33
+
34
+ def description(name)
35
+ return "#{name} will become valid in #{distance_of_time_in_words_to_now(not_before)}" if not_valid_yet?
36
+ return "#{name} has expired #{distance_of_time_in_words_to_now(not_after)} ago" if expired?
40
37
 
41
- "certificate will expire in #{distance_of_time_in_words_to_now(certificate.not_after)}"
38
+ "#{name} will expire in #{distance_of_time_in_words_to_now(not_after)}"
42
39
  end
43
40
 
44
41
  def state
@@ -52,27 +49,27 @@ module InternetSecurityEvent
52
49
  end
53
50
 
54
51
  def metric
55
- certificate.not_after - now
52
+ not_after - now
56
53
  end
57
54
 
58
55
  def not_valid_yet?
59
- now < certificate.not_before
56
+ now < not_before
60
57
  end
61
58
 
62
59
  def expired_or_expire_soon?
63
- now + renewal_duration / 3 > certificate.not_after
60
+ now + renewal_duration / 3 > not_after
64
61
  end
65
62
 
66
63
  def expired?
67
- now > certificate.not_after
64
+ now > not_after
68
65
  end
69
66
 
70
67
  def expire_soonish?
71
- now + 2 * renewal_duration / 3 > certificate.not_after
68
+ now + 2 * renewal_duration / 3 > not_after
72
69
  end
73
70
 
74
71
  def validity_duration
75
- certificate.not_after - certificate.not_before
72
+ not_after - not_before
76
73
  end
77
74
 
78
75
  def now
@@ -4,4 +4,6 @@ require 'internet_security_event/now'
4
4
  require 'internet_security_event/tls_status'
5
5
  require 'internet_security_event/tlsa_status'
6
6
  require 'internet_security_event/x509_status'
7
+ require 'internet_security_event/x509_certificate_status'
8
+ require 'internet_security_event/x509_certificate_revocation_list_status'
7
9
  require 'resolv/dns/resource/in/tlsa'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internet_security_event
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Tartière
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-07-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '6.0'
18
+ version: '7.0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '6.0'
25
+ version: '7.0'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: bundler
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +135,6 @@ dependencies:
136
135
  - - ">="
137
136
  - !ruby/object:Gem::Version
138
137
  version: '0'
139
- description:
140
138
  email:
141
139
  - romain@blogreen.org
142
140
  executables: []
@@ -162,13 +160,14 @@ files:
162
160
  - lib/internet_security_event/tls_status.rb
163
161
  - lib/internet_security_event/tlsa_status.rb
164
162
  - lib/internet_security_event/version.rb
163
+ - lib/internet_security_event/x509_certificate_revocation_list_status.rb
164
+ - lib/internet_security_event/x509_certificate_status.rb
165
165
  - lib/internet_security_event/x509_status.rb
166
166
  - lib/resolv/dns/resource/in/tlsa.rb
167
167
  homepage: https://github.com/smortex/internet_security_event
168
168
  licenses:
169
169
  - MIT
170
170
  metadata: {}
171
- post_install_message:
172
171
  rdoc_options: []
173
172
  require_paths:
174
173
  - lib
@@ -176,15 +175,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
175
  requirements:
177
176
  - - ">="
178
177
  - !ruby/object:Gem::Version
179
- version: 2.6.0
178
+ version: 3.1.0
180
179
  required_rubygems_version: !ruby/object:Gem::Requirement
181
180
  requirements:
182
181
  - - ">="
183
182
  - !ruby/object:Gem::Version
184
183
  version: '0'
185
184
  requirements: []
186
- rubygems_version: 3.3.17
187
- signing_key:
185
+ rubygems_version: 3.7.1
188
186
  specification_version: 4
189
187
  summary: Build events describing the status of various internet services
190
188
  test_files: []