ssltool 0.0.1 → 0.0.4
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.
- data/lib/ssltool/adapters/sequel.rb +16 -7
- data/lib/ssltool/certificate_store.rb +2 -0
- metadata +2 -2
@@ -7,13 +7,7 @@ module SSLTool
|
|
7
7
|
class SequelAdapter < Adapter
|
8
8
|
def initialize(database_url)
|
9
9
|
@database = Sequel.connect(database_url)
|
10
|
-
|
11
|
-
column :pool, :varchar, null:false
|
12
|
-
column :pem, :text, null:false
|
13
|
-
column :fingerprint, :char, null:false, size:40
|
14
|
-
index :fingerprint
|
15
|
-
index [:pool, :fingerprint], unique:true
|
16
|
-
end
|
10
|
+
init_certificates_table
|
17
11
|
@certificates = @database[:certificates]
|
18
12
|
end
|
19
13
|
|
@@ -31,6 +25,21 @@ module SSLTool
|
|
31
25
|
@certificates.multi_insert(insert_set)
|
32
26
|
end
|
33
27
|
end
|
28
|
+
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def init_certificates_table
|
33
|
+
return if @database.table_exists? :certificates
|
34
|
+
@database.create_table :certificates do
|
35
|
+
column :pool, :varchar, null:false
|
36
|
+
column :pem, :text, null:false
|
37
|
+
column :fingerprint, :char, null:false, size:40
|
38
|
+
index :fingerprint
|
39
|
+
index [:pool, :fingerprint], unique:true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
34
43
|
end
|
35
44
|
end
|
36
45
|
end
|
@@ -48,12 +48,14 @@ module SSLTool
|
|
48
48
|
return if combined_trusted_pool.superset?(unfiltered_pool.to_set)
|
49
49
|
viable_pool = unfiltered_pool.select { |c|
|
50
50
|
!strict || c.version < 2 ? !c.for_domain_name? : c.certificate_authority? && c.certificate_sign? }.to_set
|
51
|
+
return if combined_trusted_pool.superset?(viable_pool)
|
51
52
|
working_pool = intermediate_pool + viable_pool - excluded_pool
|
52
53
|
all_chains = working_pool.map { |cert| cert.chain_from(working_pool) }
|
53
54
|
unique_chains = all_chains.sort_by(&:length).reverse.inject([]) { |chains, chain|
|
54
55
|
chains << chain unless chains.any? { |longer_chain| (chain - longer_chain).empty? }; chains }
|
55
56
|
trusted_certs = unique_chains.select { |chain| trust?(chain) }.flatten
|
56
57
|
trusted_certs -= detect_circular_chains(unique_chains).flatten
|
58
|
+
return if trusted_certs.to_set == @intermediate_pool
|
57
59
|
@intermediate_pool.replace(trusted_certs)
|
58
60
|
@adapter.store_pool(:intermediate, intermediate_pool)
|
59
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssltool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-09-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
14
14
|
description: Orders and completes SSL certificate trust chains, maintains an up-to-date
|
15
15
|
pool of viable intermediates and trusted roots, and provides other tooling for dealing
|
16
|
-
with SSL certificate
|
16
|
+
with SSL certificate and key woes.
|
17
17
|
email: dev@caiochassot.com
|
18
18
|
executables: []
|
19
19
|
extensions: []
|