sslcheck 0.9.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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +177 -0
- data/Rakefile +14 -0
- data/acceptance/acceptance_helper.rb +1 -0
- data/acceptance/checking_certificates_spec.rb +23 -0
- data/acceptance/client_spec.rb +67 -0
- data/blinky_tests +3 -0
- data/lib/sslcheck.rb +20 -0
- data/lib/sslcheck/certificate.rb +121 -0
- data/lib/sslcheck/certificate_client.rb +10 -0
- data/lib/sslcheck/check.rb +65 -0
- data/lib/sslcheck/client.rb +68 -0
- data/lib/sslcheck/generic_error.rb +15 -0
- data/lib/sslcheck/parser.rb +96 -0
- data/lib/sslcheck/validator.rb +111 -0
- data/lib/sslcheck/validators/ca_bundle.rb +23 -0
- data/lib/sslcheck/validators/common_name.rb +27 -0
- data/lib/sslcheck/validators/errors.rb +15 -0
- data/lib/sslcheck/validators/expiration_date.rb +10 -0
- data/lib/sslcheck/validators/generic_validator.rb +15 -0
- data/lib/sslcheck/validators/issue_date.rb +10 -0
- data/lib/sslcheck/version.rb +3 -0
- data/run_acceptance_on_ci +7 -0
- data/sentinal +10 -0
- data/spec/ca_bundle_validator_spec.rb +24 -0
- data/spec/cert_fixtures.rb +814 -0
- data/spec/certificate_spec.rb +134 -0
- data/spec/check_spec.rb +172 -0
- data/spec/common_name_validator_spec.rb +40 -0
- data/spec/expiration_date_validator_spec.rb +36 -0
- data/spec/issue_date_validator_spec.rb +36 -0
- data/spec/parser_spec.rb +0 -0
- data/spec/response_spec.rb +13 -0
- data/spec/spec_helper.rb +100 -0
- data/spec/validator_spec.rb +84 -0
- data/sslcheck.gemspec +26 -0
- metadata +165 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module SSLCheck
|
4
|
+
describe 'Validator' do
|
5
|
+
describe 'Using Validators' do
|
6
|
+
before do
|
7
|
+
@cert = Certificate.new(VALID_CERT)
|
8
|
+
@ca_bundle = [Certificate.new(CA_PARENT), Certificate.new(CA_GRAND_PARENT)]
|
9
|
+
@sut = Validator.new
|
10
|
+
end
|
11
|
+
it 'should validate the certificate with available validators' do
|
12
|
+
validator = Validators::GenericValidator
|
13
|
+
|
14
|
+
expect(validator).to receive(:new).and_return(Validators::GenericValidator.new("example.com", @cert, @ca_bundle))
|
15
|
+
@sut.validate("example.com", @cert, @ca_bundle, [validator])
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should have default validators' do
|
19
|
+
expect(Validators::CommonName).to receive(:new).and_return(Validators::CommonName.new("example.com", @cert, @ca_bundle))
|
20
|
+
expect(Validators::IssueDate).to receive(:new).and_return(Validators::IssueDate.new("example.com", @cert, @ca_bundle))
|
21
|
+
expect(Validators::ExpirationDate).to receive(:new).and_return(Validators::ExpirationDate.new("example.com", @cert, @ca_bundle))
|
22
|
+
expect(Validators::CABundle).to receive(:new).and_return(Validators::CABundle.new("example.com", @cert, @ca_bundle))
|
23
|
+
|
24
|
+
@sut.validate("example.com", @cert, @ca_bundle)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
describe 'Validating a Certificate' do
|
28
|
+
context "when an expected common name is not supplied" do
|
29
|
+
before do
|
30
|
+
@sut = Validator.new
|
31
|
+
end
|
32
|
+
it 'should raise an exception' do
|
33
|
+
expect{@sut.validate("", nil, [])}.to raise_exception(Validator::CommonNameMissingError)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
context "when a peer certificate is not supplied" do
|
37
|
+
before do
|
38
|
+
@sut = Validator.new
|
39
|
+
end
|
40
|
+
it 'should raise an exception' do
|
41
|
+
expect{@sut.validate("www.example.com", nil, [])}.to raise_exception(Validator::PeerCertificateMissingError)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
context "when a CA bundle is not supplied" do
|
45
|
+
before do
|
46
|
+
@sut = Validator.new
|
47
|
+
end
|
48
|
+
it 'should raise an exception' do
|
49
|
+
expect{@sut.validate("www.example.com", Certificate.new(VALID_CERT), [])}.to raise_exception(Validator::CABundleMissingError)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
context 'when the certificate is valid' do
|
53
|
+
before do
|
54
|
+
@cert = Certificate.new(VALID_CERT)
|
55
|
+
@ca_bundle = [Certificate.new(CA_PARENT), Certificate.new(CA_GRAND_PARENT), Certificate.new(CA_GREAT_GRAND_PARENT)]
|
56
|
+
@sut = Validator.new
|
57
|
+
@validators = [PassThroughValidator]
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should be valid' do
|
61
|
+
@sut.validate("www.npboards.com", @cert, @ca_bundle, @validators)
|
62
|
+
expect(@sut.valid?).to be
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should have no errors' do
|
67
|
+
@sut.validate("www.npboards.com", @cert, @ca_bundle, @validators)
|
68
|
+
expect(@sut.errors).to be_empty
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should have no warnings' do
|
72
|
+
@sut.validate("www.npboards.com", @cert, @ca_bundle, @validators)
|
73
|
+
expect(@sut.warnings).to be_empty
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class PassThroughValidator < SSLCheck::Validators::GenericValidator
|
81
|
+
def validate
|
82
|
+
nil
|
83
|
+
end
|
84
|
+
end
|
data/sslcheck.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sslcheck/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sslcheck"
|
8
|
+
spec.version = SSLCheck::VERSION
|
9
|
+
spec.authors = ["Clayton Lengel-Zigich"]
|
10
|
+
spec.email = ["clayton@claytonlz.com"]
|
11
|
+
spec.summary = %q{Discover errors with SSL certificates.}
|
12
|
+
spec.description = %q{A simple ruby library to help verify the installation of SSL certificates.}
|
13
|
+
spec.homepage = "http://github.com/clayton/sslcheck"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.1"
|
24
|
+
spec.add_development_dependency "blinky-tape-test-status", "~> 1.1"
|
25
|
+
spec.add_development_dependency "simplecov", "~> 0.9"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sslcheck
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Clayton Lengel-Zigich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: blinky-tape-test-status
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.9'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.9'
|
83
|
+
description: A simple ruby library to help verify the installation of SSL certificates.
|
84
|
+
email:
|
85
|
+
- clayton@claytonlz.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- acceptance/acceptance_helper.rb
|
98
|
+
- acceptance/checking_certificates_spec.rb
|
99
|
+
- acceptance/client_spec.rb
|
100
|
+
- blinky_tests
|
101
|
+
- lib/sslcheck.rb
|
102
|
+
- lib/sslcheck/certificate.rb
|
103
|
+
- lib/sslcheck/certificate_client.rb
|
104
|
+
- lib/sslcheck/check.rb
|
105
|
+
- lib/sslcheck/client.rb
|
106
|
+
- lib/sslcheck/generic_error.rb
|
107
|
+
- lib/sslcheck/parser.rb
|
108
|
+
- lib/sslcheck/validator.rb
|
109
|
+
- lib/sslcheck/validators/ca_bundle.rb
|
110
|
+
- lib/sslcheck/validators/common_name.rb
|
111
|
+
- lib/sslcheck/validators/errors.rb
|
112
|
+
- lib/sslcheck/validators/expiration_date.rb
|
113
|
+
- lib/sslcheck/validators/generic_validator.rb
|
114
|
+
- lib/sslcheck/validators/issue_date.rb
|
115
|
+
- lib/sslcheck/version.rb
|
116
|
+
- run_acceptance_on_ci
|
117
|
+
- sentinal
|
118
|
+
- spec/ca_bundle_validator_spec.rb
|
119
|
+
- spec/cert_fixtures.rb
|
120
|
+
- spec/certificate_spec.rb
|
121
|
+
- spec/check_spec.rb
|
122
|
+
- spec/common_name_validator_spec.rb
|
123
|
+
- spec/expiration_date_validator_spec.rb
|
124
|
+
- spec/issue_date_validator_spec.rb
|
125
|
+
- spec/parser_spec.rb
|
126
|
+
- spec/response_spec.rb
|
127
|
+
- spec/spec_helper.rb
|
128
|
+
- spec/validator_spec.rb
|
129
|
+
- sslcheck.gemspec
|
130
|
+
homepage: http://github.com/clayton/sslcheck
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.4.5
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: Discover errors with SSL certificates.
|
154
|
+
test_files:
|
155
|
+
- spec/ca_bundle_validator_spec.rb
|
156
|
+
- spec/cert_fixtures.rb
|
157
|
+
- spec/certificate_spec.rb
|
158
|
+
- spec/check_spec.rb
|
159
|
+
- spec/common_name_validator_spec.rb
|
160
|
+
- spec/expiration_date_validator_spec.rb
|
161
|
+
- spec/issue_date_validator_spec.rb
|
162
|
+
- spec/parser_spec.rb
|
163
|
+
- spec/response_spec.rb
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/validator_spec.rb
|