r509-ca-http 0.3.1 → 0.3.2

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.
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: R509::CertificateAuthority::HTTP::Factory::SPKIFactory
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7
10
10
 
11
11
  </title>
12
12
 
@@ -180,9 +180,9 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Thu Feb 6 10:33:49 2014 by
183
+ Generated on Tue Apr 15 17:13:51 2014 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
- 0.8.7.3 (ruby-2.0.0).
185
+ 0.8.7 (ruby-2.1.1).
186
186
  </div>
187
187
 
188
188
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: R509::CertificateAuthority::HTTP::Server
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7
10
10
 
11
11
  </title>
12
12
 
@@ -124,9 +124,9 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Thu Feb 6 10:33:49 2014 by
127
+ Generated on Tue Apr 15 17:13:51 2014 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
- 0.8.7.3 (ruby-2.0.0).
129
+ 0.8.7 (ruby-2.1.1).
130
130
  </div>
131
131
 
132
132
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: R509::CertificateAuthority::HTTP::SubjectParser
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7
10
10
 
11
11
  </title>
12
12
 
@@ -256,9 +256,9 @@
256
256
  </div>
257
257
 
258
258
  <div id="footer">
259
- Generated on Thu Feb 6 10:33:49 2014 by
259
+ Generated on Tue Apr 15 17:13:51 2014 by
260
260
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
261
- 0.8.7.3 (ruby-2.0.0).
261
+ 0.8.7 (ruby-2.1.1).
262
262
  </div>
263
263
 
264
264
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: R509::CertificateAuthority::HTTP::ValidityPeriodConverter
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7
10
10
 
11
11
  </title>
12
12
 
@@ -171,7 +171,10 @@
171
171
  11
172
172
  12
173
173
  13
174
- 14</pre>
174
+ 14
175
+ 15
176
+ 16
177
+ 17</pre>
175
178
  </td>
176
179
  <td>
177
180
  <pre class="code"><span class="info file"># File 'lib/r509/certificateauthority/http/validityperiodconverter.rb', line 3</span>
@@ -184,8 +187,11 @@
184
187
  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Validity period must be positive</span><span class='tstring_end'>&quot;</span></span>
185
188
  <span class='kw'>end</span>
186
189
  <span class='lbrace'>{</span>
187
- <span class='symbol'>:not_before</span> <span class='op'>=&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='int'>6</span> <span class='op'>*</span> <span class='int'>60</span> <span class='op'>*</span> <span class='int'>60</span><span class='comma'>,</span>
188
- <span class='symbol'>:not_after</span> <span class='op'>=&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>+</span> <span class='id identifier rubyid_validity_period'>validity_period</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span>
190
+ <span class='comment'># Begin the validity period 6 hours into the past, to account for
191
+ </span> <span class='comment'># possibly-slow clocks.
192
+ </span> <span class='symbol'>:not_before</span> <span class='op'>=&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='int'>6</span> <span class='op'>*</span> <span class='int'>60</span> <span class='op'>*</span> <span class='int'>60</span><span class='rparen'>)</span><span class='comma'>,</span>
193
+ <span class='comment'># Add validity_period number of seconds to the current time.
194
+ </span> <span class='symbol'>:not_after</span> <span class='op'>=&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>+</span> <span class='id identifier rubyid_validity_period'>validity_period</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span>
189
195
  <span class='rbrace'>}</span>
190
196
  <span class='kw'>end</span></pre>
191
197
  </td>
@@ -198,9 +204,9 @@
198
204
  </div>
199
205
 
200
206
  <div id="footer">
201
- Generated on Thu Feb 6 10:33:49 2014 by
207
+ Generated on Tue Apr 15 17:13:51 2014 by
202
208
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
203
- 0.8.7.3 (ruby-2.0.0).
209
+ 0.8.7 (ruby-2.1.1).
204
210
  </div>
205
211
 
206
212
  </body>
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
6
  <title>
7
- Documentation by YARD 0.8.7.3
7
+ Documentation by YARD 0.8.7
8
8
 
9
9
  </title>
10
10
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  <iframe id="search_frame"></iframe>
58
58
 
59
- <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.7.3</h1>
59
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.7</h1>
60
60
  <div id="listing">
61
61
  <h1 class="alphaindex">Alphabetic Index</h1>
62
62
 
@@ -98,6 +98,13 @@
98
98
 
99
99
  </li>
100
100
 
101
+ <li>
102
+ <span class='object_link'><a href="R509/CertificateAuthority/HTTP/Config.html" title="R509::CertificateAuthority::HTTP::Config (class)">Config</a></span>
103
+
104
+ <small>(R509::CertificateAuthority::HTTP)</small>
105
+
106
+ </li>
107
+
101
108
  </ul>
102
109
  </ul>
103
110
 
@@ -197,9 +204,9 @@
197
204
  </div>
198
205
 
199
206
  <div id="footer">
200
- Generated on Thu Feb 6 10:33:49 2014 by
207
+ Generated on Tue Apr 15 17:13:51 2014 by
201
208
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
202
- 0.8.7.3 (ruby-2.0.0).
209
+ 0.8.7 (ruby-2.1.1).
203
210
  </div>
204
211
 
205
212
  </body>
@@ -46,7 +46,7 @@
46
46
 
47
47
  <ul id="full_list" class="class">
48
48
  <li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li>
49
- <li><a class='toggle'></a> <span class='object_link'><a href="R509.html" title="R509 (module)">R509</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="R509/CertificateAuthority.html" title="R509::CertificateAuthority (module)">CertificateAuthority</a></span><small class='search_info'>R509</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="R509/CertificateAuthority/HTTP.html" title="R509::CertificateAuthority::HTTP (module)">HTTP</a></span><small class='search_info'>R509::CertificateAuthority</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="R509/CertificateAuthority/HTTP/Factory.html" title="R509::CertificateAuthority::HTTP::Factory (module)">Factory</a></span><small class='search_info'>R509::CertificateAuthority::HTTP</small></li><ul><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/Factory/CSRFactory.html" title="R509::CertificateAuthority::HTTP::Factory::CSRFactory (class)">CSRFactory</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP::Factory</small></li><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/Factory/SPKIFactory.html" title="R509::CertificateAuthority::HTTP::Factory::SPKIFactory (class)">SPKIFactory</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP::Factory</small></li></ul><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/Server.html" title="R509::CertificateAuthority::HTTP::Server (class)">Server</a></span> &lt; Base<small class='search_info'>R509::CertificateAuthority::HTTP</small></li><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/SubjectParser.html" title="R509::CertificateAuthority::HTTP::SubjectParser (class)">SubjectParser</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP</small></li><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/ValidityPeriodConverter.html" title="R509::CertificateAuthority::HTTP::ValidityPeriodConverter (class)">ValidityPeriodConverter</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP</small></li></ul></ul></ul>
49
+ <li><a class='toggle'></a> <span class='object_link'><a href="R509.html" title="R509 (module)">R509</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="R509/CertificateAuthority.html" title="R509::CertificateAuthority (module)">CertificateAuthority</a></span><small class='search_info'>R509</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="R509/CertificateAuthority/HTTP.html" title="R509::CertificateAuthority::HTTP (module)">HTTP</a></span><small class='search_info'>R509::CertificateAuthority</small></li><ul><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/Config.html" title="R509::CertificateAuthority::HTTP::Config (class)">Config</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP</small></li><li><a class='toggle'></a> <span class='object_link'><a href="R509/CertificateAuthority/HTTP/Factory.html" title="R509::CertificateAuthority::HTTP::Factory (module)">Factory</a></span><small class='search_info'>R509::CertificateAuthority::HTTP</small></li><ul><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/Factory/CSRFactory.html" title="R509::CertificateAuthority::HTTP::Factory::CSRFactory (class)">CSRFactory</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP::Factory</small></li><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/Factory/SPKIFactory.html" title="R509::CertificateAuthority::HTTP::Factory::SPKIFactory (class)">SPKIFactory</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP::Factory</small></li></ul><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/Server.html" title="R509::CertificateAuthority::HTTP::Server (class)">Server</a></span> &lt; Base<small class='search_info'>R509::CertificateAuthority::HTTP</small></li><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/SubjectParser.html" title="R509::CertificateAuthority::HTTP::SubjectParser (class)">SubjectParser</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP</small></li><li><span class='object_link'><a href="R509/CertificateAuthority/HTTP/ValidityPeriodConverter.html" title="R509::CertificateAuthority::HTTP::ValidityPeriodConverter (class)">ValidityPeriodConverter</a></span> &lt; Object<small class='search_info'>R509::CertificateAuthority::HTTP</small></li></ul></ul></ul>
50
50
 
51
51
  </ul>
52
52
  </div>
@@ -324,9 +324,9 @@ pre.code .dot + pre.code .id,
324
324
  pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; }
325
325
  pre.code .comment { color: #0066FF; }
326
326
  pre.code .const, pre.code .constant { color: #585CF6; }
327
- pre.code .label,
328
327
  pre.code .symbol { color: #C5060B; }
329
328
  pre.code .kw,
329
+ pre.code .label,
330
330
  pre.code .rubyid_require,
331
331
  pre.code .rubyid_extend,
332
332
  pre.code .rubyid_include { color: #0000FF; }
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7
10
10
 
11
11
  </title>
12
12
 
@@ -88,7 +88,7 @@
88
88
  <ul>
89
89
  <li>ca</li>
90
90
  <li>profile</li>
91
- <li>validityPeriod (in days)</li>
91
+ <li>validityPeriod (in seconds)</li>
92
92
  <li>csr (or spki)</li>
93
93
  <li>subject</li>
94
94
  </ul>
@@ -169,11 +169,15 @@
169
169
  <p>For that, we&#39;ve created a few pieces of Rack middleware for your use.</p>
170
170
 
171
171
  <ul>
172
- <li><a href="https://github.com/sirsean/r509-middleware-validity">r509-middleware-validity</a></li>
173
- <li><a href="https://github.com/sirsean/r509-middleware-certwriter">r509-middleware-certwriter</a></li>
172
+ <li><a href="https://github.com/r509/r509-middleware-validity">r509-middleware-validity</a></li>
173
+ <li><a href="https://github.com/r509/r509-middleware-certwriter">r509-middleware-certwriter</a></li>
174
174
  </ul>
175
175
 
176
- <p>After installing one or both of them, you&#39;ll have to edit your <code>config.ru`` and/or</code>config.yaml``` files.</p>
176
+ <p>After installing one or both of them, you&#39;ll have to edit your <code>config.ru</code> and/or <code>config.yaml</code> files.</p>
177
+
178
+ <h2>Signals</h2>
179
+
180
+ <p>You can send a kill -USR2 signal to any running r509-ca-http process to cause it to reload and print its config to the logs (provided your app server isn&#39;t trapping USR2 first).</p>
177
181
 
178
182
  <h2>Support</h2>
179
183
 
@@ -205,9 +209,9 @@
205
209
  </div></div>
206
210
 
207
211
  <div id="footer">
208
- Generated on Thu Feb 6 10:33:49 2014 by
212
+ Generated on Tue Apr 15 17:13:51 2014 by
209
213
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
210
- 0.8.7.3 (ruby-2.0.0).
214
+ 0.8.7 (ruby-2.1.1).
211
215
  </div>
212
216
 
213
217
  </body>
@@ -4,16 +4,18 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.8.7.3</title>
7
+ <title>Documentation by YARD 0.8.7</title>
8
8
  </head>
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  window.onload = function() {
11
- var match = unescape(window.location.hash).match(/^#!(.+)/);
12
- var name = match ? match[1] : 'index.html';
13
- name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
11
+ var match = window.location.hash.match(/^#!(.+)/);
12
+ var name = 'index.html';
13
+ if (match) {
14
+ name = unescape(match[1]);
15
+ }
14
16
  document.writeln('<frameset cols="20%,*">' +
15
17
  '<frame name="list" src="class_list.html" />' +
16
- '<frame name="main" src="' + escape(name) + '" />' +
18
+ '<frame name="main" src="' + name + '" />' +
17
19
  '</frameset>');
18
20
  }
19
21
  </script>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7
10
10
 
11
11
  </title>
12
12
 
@@ -88,7 +88,7 @@
88
88
  <ul>
89
89
  <li>ca</li>
90
90
  <li>profile</li>
91
- <li>validityPeriod (in days)</li>
91
+ <li>validityPeriod (in seconds)</li>
92
92
  <li>csr (or spki)</li>
93
93
  <li>subject</li>
94
94
  </ul>
@@ -169,11 +169,15 @@
169
169
  <p>For that, we&#39;ve created a few pieces of Rack middleware for your use.</p>
170
170
 
171
171
  <ul>
172
- <li><a href="https://github.com/sirsean/r509-middleware-validity">r509-middleware-validity</a></li>
173
- <li><a href="https://github.com/sirsean/r509-middleware-certwriter">r509-middleware-certwriter</a></li>
172
+ <li><a href="https://github.com/r509/r509-middleware-validity">r509-middleware-validity</a></li>
173
+ <li><a href="https://github.com/r509/r509-middleware-certwriter">r509-middleware-certwriter</a></li>
174
174
  </ul>
175
175
 
176
- <p>After installing one or both of them, you&#39;ll have to edit your <code>config.ru`` and/or</code>config.yaml``` files.</p>
176
+ <p>After installing one or both of them, you&#39;ll have to edit your <code>config.ru</code> and/or <code>config.yaml</code> files.</p>
177
+
178
+ <h2>Signals</h2>
179
+
180
+ <p>You can send a kill -USR2 signal to any running r509-ca-http process to cause it to reload and print its config to the logs (provided your app server isn&#39;t trapping USR2 first).</p>
177
181
 
178
182
  <h2>Support</h2>
179
183
 
@@ -205,9 +209,9 @@
205
209
  </div></div>
206
210
 
207
211
  <div id="footer">
208
- Generated on Thu Feb 6 10:33:49 2014 by
212
+ Generated on Tue Apr 15 17:13:51 2014 by
209
213
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
210
- 0.8.7.3 (ruby-2.0.0).
214
+ 0.8.7 (ruby-2.1.1).
211
215
  </div>
212
216
 
213
217
  </body>
@@ -78,12 +78,7 @@ function framesInit() {
78
78
  if (hasFrames) {
79
79
  document.body.className = 'frames';
80
80
  $('#menu .noframes a').attr('href', document.location);
81
- try {
82
- window.top.document.title = $('html head title').text();
83
- } catch(error) {
84
- // some browsers will not allow this when serving from file://
85
- // but we don't want to stop the world.
86
- }
81
+ window.top.document.title = $('html head title').text();
87
82
  }
88
83
  else {
89
84
  $('#menu .noframes a').text('frames').attr('href', framesUrl);
@@ -216,4 +211,4 @@ $(linkSummaries);
216
211
  $(keyboardShortcuts);
217
212
  $(summaryToggle);
218
213
  $(fixOutsideWorldLinks);
219
- $(generateTOC);
214
+ $(generateTOC);
@@ -66,11 +66,23 @@
66
66
 
67
67
 
68
68
  <li class="r2 ">
69
+ <span class='object_link'><a href="R509/CertificateAuthority/HTTP/Config.html#load_config-class_method" title="R509::CertificateAuthority::HTTP::Config.load_config (method)">load_config</a></span>
70
+ <small>R509::CertificateAuthority::HTTP::Config</small>
71
+ </li>
72
+
73
+
74
+ <li class="r1 ">
69
75
  <span class='object_link'><a href="R509/CertificateAuthority/HTTP/SubjectParser.html#parse-instance_method" title="R509::CertificateAuthority::HTTP::SubjectParser#parse (method)">#parse</a></span>
70
76
  <small>R509::CertificateAuthority::HTTP::SubjectParser</small>
71
77
  </li>
72
78
 
73
79
 
80
+ <li class="r2 ">
81
+ <span class='object_link'><a href="R509/CertificateAuthority/HTTP/Config.html#print_config-class_method" title="R509::CertificateAuthority::HTTP::Config.print_config (method)">print_config</a></span>
82
+ <small>R509::CertificateAuthority::HTTP::Config</small>
83
+ </li>
84
+
85
+
74
86
  <li class="r1 ">
75
87
  <span class='object_link'><a href="R509/CertificateAuthority/HTTP/SubjectParser.html#unescape-instance_method" title="R509::CertificateAuthority::HTTP::SubjectParser#unescape (method)">#unescape</a></span>
76
88
  <small>R509::CertificateAuthority::HTTP::SubjectParser</small>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.3
9
+ &mdash; Documentation by YARD 0.8.7
10
10
 
11
11
  </title>
12
12
 
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Thu Feb 6 10:33:49 2014 by
106
+ Generated on Tue Apr 15 17:13:51 2014 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.3 (ruby-2.0.0).
108
+ 0.8.7 (ruby-2.1.1).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -0,0 +1,30 @@
1
+ module R509::CertificateAuthority::HTTP
2
+ class Config
3
+ def self.load_config(config_file = "config.yaml")
4
+ config_data = File.read(config_file)
5
+
6
+ Dependo::Registry[:config_pool] = R509::Config::CAConfigPool.from_yaml("certificate_authorities", config_data)
7
+
8
+ Dependo::Registry[:crls] = {}
9
+ Dependo::Registry[:options_builders] = {}
10
+ Dependo::Registry[:certificate_authorities] = {}
11
+ Dependo::Registry[:config_pool].names.each do |name|
12
+ Dependo::Registry[:crls][name] = R509::CRL::Administrator.new(Dependo::Registry[:config_pool][name])
13
+ Dependo::Registry[:options_builders][name] = R509::CertificateAuthority::OptionsBuilder.new(Dependo::Registry[:config_pool][name])
14
+ Dependo::Registry[:certificate_authorities][name] = R509::CertificateAuthority::Signer.new(Dependo::Registry[:config_pool][name])
15
+ end
16
+ end
17
+
18
+ def self.print_config
19
+ Dependo::Registry[:log].warn "Config loaded"
20
+ Dependo::Registry[:config_pool].all.each do |config|
21
+ Dependo::Registry[:log].warn "Config: "
22
+ Dependo::Registry[:log].warn "CA Cert:"+config.ca_cert.subject.to_s
23
+ Dependo::Registry[:log].warn "OCSP Cert (may be the same as above):"+config.ocsp_cert.subject.to_s
24
+ Dependo::Registry[:log].warn "OCSP Validity Hours: "+config.ocsp_validity_hours.to_s
25
+ Dependo::Registry[:log].warn "CRL Validity Hours: "+config.crl_validity_hours.to_s
26
+ Dependo::Registry[:log].warn "\n"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,6 @@
1
1
  require 'sinatra/base'
2
2
  require 'r509'
3
+ require "#{File.dirname(__FILE__)}/config"
3
4
  require "#{File.dirname(__FILE__)}/subjectparser"
4
5
  require "#{File.dirname(__FILE__)}/validityperiodconverter"
5
6
  require "#{File.dirname(__FILE__)}/factory"
@@ -8,6 +9,14 @@ require 'yaml'
8
9
  require 'logger'
9
10
  require 'dependo'
10
11
 
12
+ # Capture USR2 calls so we can reload and print the config
13
+ # I'd rather use HUP, but daemons like thin already capture that
14
+ # so we can't use it.
15
+ Signal.trap("USR2") do
16
+ R509::CertificateAuthority::HTTP::Config.load_config
17
+ R509::CertificateAuthority::HTTP::Config.print_config
18
+ end
19
+
11
20
  module R509
12
21
  module CertificateAuthority
13
22
  module HTTP
@@ -20,18 +29,6 @@ module R509
20
29
  disable :logging
21
30
  set :environment, :production
22
31
 
23
- crls = {}
24
- certificate_authorities = {}
25
- options_builders = {}
26
- config_pool.names.each do |name|
27
- crls[name] = R509::CRL::Administrator.new(config_pool[name])
28
- options_builders[name] = R509::CertificateAuthority::OptionsBuilder.new(config_pool[name])
29
- certificate_authorities[name] = R509::CertificateAuthority::Signer.new(config_pool[name])
30
- end
31
-
32
- set :crls, crls
33
- set :certificate_authorities, certificate_authorities
34
- set :options_builders, options_builders
35
32
  set :subject_parser, R509::CertificateAuthority::HTTP::SubjectParser.new
36
33
  set :validity_period_converter, R509::CertificateAuthority::HTTP::ValidityPeriodConverter.new
37
34
  set :csr_factory, R509::CertificateAuthority::HTTP::Factory::CSRFactory.new
@@ -44,13 +41,13 @@ module R509
44
41
 
45
42
  helpers do
46
43
  def crl(name)
47
- settings.crls[name]
44
+ Dependo::Registry[:crls][name]
48
45
  end
49
46
  def ca(name)
50
- settings.certificate_authorities[name]
47
+ Dependo::Registry[:certificate_authorities][name]
51
48
  end
52
49
  def builder(name)
53
- settings.options_builders[name]
50
+ Dependo::Registry[:options_builders][name]
54
51
  end
55
52
  def subject_parser
56
53
  settings.subject_parser