tls_test_kit 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 637a1d287aea85271e8d2c7e97042fc922b03600b72efac611c87b0ef19abf3a
4
- data.tar.gz: e7bd1094ee57e891cb694dab80f8e364ba3a5cce7da6329f6731ef792c9fabe1
3
+ metadata.gz: 617f7c08027781a37ba09b5789c399a09fbb94aaade12b47b9316d0bbbff637a
4
+ data.tar.gz: b99cefffc333f375d190639de5c8bfbdef155471c5c81e25ac118dbe51206be1
5
5
  SHA512:
6
- metadata.gz: 4390ba4c72e204c2e87dd4afde53b9a705aeb320706cf99e3f6b190488f534a56bd8b285375b546b20d3948aabdfdbf3d1837ef6fb6b2d74b1877288b6ccb8c7
7
- data.tar.gz: 18bc3706515b94ec75ac4877db75e6563e50ed7754130b951a475017c812c59cf2054abf0209bb1c686f174fe47b847459c2e831f37c565d1582823fdb94cbf7
6
+ metadata.gz: cbc416cedcc9df7f002667ec293af63d9864085eca995db7c955bd9c1650dfc7aefebc03ed9e4914a7e502b3257015d74d38a28cca829476431769fd4df417db
7
+ data.tar.gz: 381c6169d8191420743f435179790ebc9dbc11304df8ee9605022c269b86eebb06d6820ab545e3109040bf3277c5135bfad581bab9930649a49dd2e755b3ca5e
@@ -6,6 +6,8 @@ module TLSTestKit
6
6
  )
7
7
  id :tls_version_test
8
8
 
9
+ output :incorrectly_permitted_tls_versions_messages
10
+
9
11
  class << self
10
12
  def versions
11
13
  {
@@ -59,6 +61,10 @@ module TLSTestKit
59
61
  def version_required?(version)
60
62
  required_versions.include? version
61
63
  end
64
+
65
+ def incorrectly_permitted_tls_version_message_type
66
+ config.options[:incorrectly_permitted_tls_version_message_type] || 'error'
67
+ end
62
68
  end
63
69
 
64
70
  input :url
@@ -69,6 +75,8 @@ module TLSTestKit
69
75
  port = uri.port
70
76
  tls_support_verified = false
71
77
 
78
+ incorrectly_permitted_tls_versions = []
79
+
72
80
  self.class.versions.each do |version, version_string|
73
81
  http = Net::HTTP.new(host, port)
74
82
  http.use_ssl = true
@@ -78,30 +86,48 @@ module TLSTestKit
78
86
  begin
79
87
  http.request_get(uri)
80
88
  if self.class.version_forbidden? version
81
- add_message('error', "Server incorrectly allowed #{version_string} connection.")
89
+ message =
90
+ "#{url} accepted #{version_string} connection even though #{version_string} connections should be denied. " \
91
+ 'The system may deny content from being sent over this connection, but this must be manually verified.'
92
+ incorrectly_permitted_tls_versions << version_string
93
+
94
+ add_message(self.class.incorrectly_permitted_tls_version_message_type, message)
82
95
  elsif self.class.version_required? version
83
- add_message('info', "Server correctly allowed #{version_string} connection as required.")
96
+ add_message('info', "#{url} correctly accepted #{version_string} connection as required.")
84
97
  tls_support_verified = true
85
98
  else
86
- add_message('info', "Server allowed #{version_string} connection.")
99
+ add_message('info', "#{url} accepted #{version_string} connection.")
87
100
  tls_support_verified = true
88
101
  end
89
102
  rescue StandardError => e
90
103
  if self.class.version_required? version
91
- add_message('error', "Server incorrectly denied #{version_string} connection: #{e.message}")
104
+ add_message('error', "#{url} incorrectly denied #{version_string} connection: #{e.message}")
92
105
  elsif self.class.version_forbidden? version
93
- add_message('info', "Server correctly denied #{version_string} connection as required.")
106
+ add_message('info', "#{url} correctly denied #{version_string} connection as required.")
94
107
  else
95
- add_message('info', "Server denied #{version_string} connection.")
108
+ add_message('info', "#{url} denied #{version_string} connection.")
96
109
  end
97
110
  end
98
111
  end
99
112
 
113
+ if incorrectly_permitted_tls_versions.present?
114
+ count = incorrectly_permitted_tls_versions.length
115
+ message =
116
+ "#{url} did not deny TLS connections for #{'version'.pluralize(count)} " \
117
+ "#{incorrectly_permitted_tls_versions.join(', ')}. The system may deny content from being sent over this" \
118
+ 'connection, but this must be manually verified.'
119
+ output incorrectly_permitted_tls_versions_messages: message
120
+ end
121
+
100
122
  errors_found = messages.any? { |message| message[:type] == 'error' }
101
123
 
102
124
  assert !errors_found, 'Server did not permit/deny the connections with the correct TLS versions'
103
125
 
104
126
  assert tls_support_verified, 'Server did not support any allowed TLS versions.'
127
+
128
+ if incorrectly_permitted_tls_versions.present?
129
+ pass "Server accepted TLS connections using versions which should be denied: #{incorrectly_permitted_tls_versions.join(', ')}"
130
+ end
105
131
  end
106
132
  end
107
133
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tls_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core
@@ -96,7 +96,7 @@ licenses:
96
96
  metadata:
97
97
  homepage_uri: https://github.com/inferno_framework/tls-test-kit
98
98
  source_code_uri: https://github.com/inferno_framework/tls-test-kit
99
- post_install_message:
99
+ post_install_message:
100
100
  rdoc_options: []
101
101
  require_paths:
102
102
  - lib
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubygems_version: 3.1.6
115
- signing_key:
115
+ signing_key:
116
116
  specification_version: 4
117
117
  summary: Inferno tests for server TLS support
118
118
  test_files: []