doc/file.README.html in r509-ocsp-responder-0.3.1 vs doc/file.README.html in r509-ocsp-responder-0.3.2
- old
+ new
@@ -1,20 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
<title>
File: README
- — Documentation by YARD 0.8.2.1
+ — Documentation by YARD 0.8.6.1
</title>
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '';
framesUrl = "frames.html#!" + escape(window.location.href);
@@ -65,55 +65,149 @@
<p>r509-ocsp-responder is an OCSP responder written using <a href="https://github.com/reaperhulk/r509">r509</a> and Sinatra to conform to RFC <a href="http://www.ietf.org/rfc/rfc2560.txt">2560</a> and <a href="http://www.ietf.org/rfc/rfc5019.txt">5019</a>.</p>
<h2>Requirements</h2>
-<p>r509-ocsp-responder depends on <a href="https://github.com/reaperhulk/r509">r509</a>, <a href="http://redis.io">redis</a>, <a href="https://github.com/sirsean/r509-validity-redis">r509-validity-redis</a> (or another library that implements R509::Validity), <a href="http://sinatrarb.com">sinatra</a>, <a href="https://github.com/sirsean/r509-ocsp-stats">r509-ocsp-stats</a>, and <a href="https://github.com/sirsean/dependo">dependo</a>. These must be installed as gems.</p>
+<p>r509-ocsp-responder depends on <a href="https://github.com/reaperhulk/r509">r509</a>, <a href="http://redis.io">redis</a>, <a href="https://github.com/sirsean/r509-validity-redis">r509-validity-redis</a> (or another library that implements R509::Validity), <a href="http://sinatrarb.com">sinatra</a>, and <a href="https://github.com/sirsean/dependo">dependo</a>. Optionally, you can install <a href="https://github.com/sirsean/r509-ocsp-stats">r509-ocsp-stats</a> for stats collection. These must be installed as gems.</p>
<h2>Basic Usage</h2>
-<ol>
-<li>Build the gem. If you have cloned the repo you can build the gem with <code>rake gem:build</code>. You will need</li>
-<li>Install the gem. <code>rake gem:install</code></li>
-<li>Set up your config.ru and config.yaml. At this time you'll need to copy the config.ru from the gem install to another dir with your config.yaml. You should also copy (and modify) the config.yaml.example file from the gem. You'll need to alter the config.ru's require line from <code>require './lib/r509/ocsp/responder/server'</code> to <code>require 'r509/ocsp/responder/server'</code> if you have it installed as a gem.</li>
-</ol>
+<h3>Build/Install</h3>
-<p>Once you've done that you can set up your rack server. The example below is an example yaml config for thin. You will want to have as many servers as you have cores.</p>
+<p>If you have cloned the repo you can build the gem with <code>rake gem:build</code> and install with <code>rake gem:install</code> . Alternately you can use a prebuilt gem by typing <code>gem install r509-ocsp-responder</code> .</p>
-<pre class="code yaml"><code>chdir: /var/www/r509-ocsp-responder
+<h3>Set Up config.ru</h3>
+
+<p>Save the below into a config.ru (or rackup) file</p>
+
+<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>r509</span><span class='tstring_end'>"</span></span>
+<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dependo</span><span class='tstring_end'>"</span></span>
+<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>r509/ocsp/responder/server</span><span class='tstring_end'>'</span></span>
+
+<span class='const'>Dependo</span><span class='op'>::</span><span class='const'>Registry</span><span class='lbracket'>[</span><span class='symbol'>:log</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>STDOUT</span><span class='rparen'>)</span>
+
+<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>r509/validity/redis</span><span class='tstring_end'>"</span></span>
+<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>redis</span><span class='tstring_end'>'</span></span>
+<span class='kw'>begin</span>
+ <span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>hiredis</span><span class='tstring_end'>"</span></span>
+ <span class='const'>Dependo</span><span class='op'>::</span><span class='const'>Registry</span><span class='lbracket'>[</span><span class='symbol'>:log</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Loading redis with hiredis driver</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_redis'>redis</span> <span class='op'>=</span> <span class='const'>Redis</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:driver</span> <span class='op'>=></span> <span class='symbol'>:hiredis</span><span class='rparen'>)</span>
+<span class='kw'>rescue</span> <span class='const'>Gem</span><span class='op'>::</span><span class='const'>LoadError</span>
+ <span class='const'>Dependo</span><span class='op'>::</span><span class='const'>Registry</span><span class='lbracket'>[</span><span class='symbol'>:log</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Loading redis with standard ruby driver</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_redis'>redis</span> <span class='op'>=</span> <span class='const'>Redis</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
+<span class='kw'>end</span>
+<span class='const'>Dependo</span><span class='op'>::</span><span class='const'>Registry</span><span class='lbracket'>[</span><span class='symbol'>:validity_checker</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Validity</span><span class='op'>::</span><span class='const'>Redis</span><span class='op'>::</span><span class='const'>Checker</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_redis'>redis</span><span class='rparen'>)</span>
+
+
+<span class='const'>R509</span><span class='op'>::</span><span class='const'>OCSP</span><span class='op'>::</span><span class='const'>Responder</span><span class='op'>::</span><span class='const'>OCSPConfig</span><span class='period'>.</span><span class='id identifier rubyid_load_config'>load_config</span>
+
+<span class='const'>R509</span><span class='op'>::</span><span class='const'>OCSP</span><span class='op'>::</span><span class='const'>Responder</span><span class='op'>::</span><span class='const'>OCSPConfig</span><span class='period'>.</span><span class='id identifier rubyid_print_config'>print_config</span>
+
+<span class='comment'># Uncomment the next two lines if you want to collect stats via r509-ocsp-stats
+</span><span class='comment'># require "r509/ocsp/stats/redis"
+</span><span class='comment'># Dependo::Registry[:stats] = R509::OCSP::Stats::Redis.new
+</span>
+<span class='id identifier rubyid_responder'>responder</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>OCSP</span><span class='op'>::</span><span class='const'>Responder</span><span class='op'>::</span><span class='const'>Server</span>
+<span class='id identifier rubyid_run'>run</span> <span class='id identifier rubyid_responder'>responder</span>
+</code></pre>
+
+<h3>Configure config.yaml</h3>
+
+<p>The config.yaml contains certificate authority nodes as well as options like copy_nonce (documented below). Each CA node has an arbitrary name like test_ca and contains a ca_cert and (optional) ocsp_cert node. If you want to sign OCSP responses directly from your root you'll set your config up like this:</p>
+
+<pre class="code yaml"><code class="yaml">copy_nonce: true
+cache_headers: true
+max_cache_age: 60
+certificate_authorities: {
+ second_ca: {
+ ca_cert: {
+ cert: "spec/fixtures/second_ca.cer",
+ key: "spec/fixtures/second_ca.key"
+ }
+ }
+}
+</code></pre>
+
+<p>If you want to use an OCSP delegate</p>
+
+<pre class="code yaml"><code class="yaml">copy_nonce: true
+cache_headers: true
+max_cache_age: 60
+certificate_authorities: {
+ test_ca: {
+ ca_cert: {
+ cert: "spec/fixtures/test_ca.cer"
+ },
+ ocsp_cert: {
+ cert: "spec/fixtures/test_ca_ocsp.cer",
+ key: "spec/fixtures/test_ca_ocsp.key"
+ }
+ }
+}
+</code></pre>
+
+<p>Finally, if you're responding for multiple roots you specify them like so:</p>
+
+<pre class="code yaml"><code class="yaml">copy_nonce: true
+cache_headers: true
+max_cache_age: 60
+certificate_authorities: {
+ test_ca: {
+ ca_cert: {
+ cert: "spec/fixtures/test_ca.cer"
+ },
+ ocsp_cert: {
+ cert: "spec/fixtures/test_ca_ocsp.cer",
+ key: "spec/fixtures/test_ca_ocsp.key"
+ }
+ },
+ second_ca: {
+ ca_cert: {
+ cert: "spec/fixtures/second_ca.cer",
+ key: "spec/fixtures/second_ca.key"
+ }
+ }
+}
+</code></pre>
+
+<h3>Configure Thin & nginx</h3>
+
+<p>The example below is an example yaml config for thin. You will want to have as many servers as you have cores.</p>
+
+<pre class="code yaml"><code class="yaml">chdir: /var/www/r509-ocsp-responder
rackup: /var/www/r509-ocsp-responder/config.ru
socket: /var/run/r509-ocsp-responder.sock
pid: /var/run/r509-ocsp-responder.pid
servers: 2
daemonize: true
log: /var/log/r509-ocsp-responder.log
</code></pre>
<p>Since this config is just using sockets let's set up nginx as a reverse proxy for the thin instances. We can also use this as a caching layer if we choose to enable cache_headers.</p>
-<pre class="code ruby"><code>proxy_cache_path /var/www/cache levels=1:2 keys_zone=ocsp:8m max_size=16m inactive=64m;
+<pre class="code ruby"><code class="ruby">proxy_cache_path /var/www/cache levels=1:2 keys_zone=ocsp:8m max_size=16m inactive=64m;
proxy_temp_path /var/www/cache/tmp;
upstream thin_ocsp_responder{
- server unix:/var/run/r509-ocsp-responder.0.sock fail_timeout=0;
- server unix:/var/run/r509-ocsp-responder.1.sock fail_timeout=0;
+ server unix:/var/run/r509-ocsp-responder.0.sock fail_timeout=0;
+ server unix:/var/run/r509-ocsp-responder.1.sock fail_timeout=0;
}
server {
- listen 80;
- server_name ocsp.r509.org;
+ listen 80;
+ server_name ocsp.r509.org;
- location / {
- proxy_pass http://thin_ocsp_responder;
- proxy_cache ocsp;
- proxy_cache_use_stale updating;
- }
+ location / {
+ proxy_pass http://thin_ocsp_responder;
+ proxy_cache ocsp;
+ proxy_cache_use_stale updating;
+ }
}
</code></pre>
<p>Within the location block you may also choose to add these directives:</p>
-<pre class="code ruby"><code>proxy_cache_methods GET POST;
+<pre class="code ruby"><code class="ruby">proxy_cache_methods GET POST;
proxy_cache_valid 200 302 1m;
</code></pre>
<p>If present, these lines will cause 200 and 302 responses to POST and GET to be cached for 1 minute. This allows you to cache POST requests (Note: Per the HTTP RFC POST requests should not be cached) in addition to the GET requests normally supported by the ruby layer. <strong>NOTE:</strong> The proxy_cache_valid values are lower priority than caching headers sent by the thin instances so if you do not keep the value here in sync with the max_cache_age config (or turn off cache_headers entirely and solely control it through nginx) you will have mismatched cache times. Additionally, this will cache nonced responses, which wastes RAM since they will not be re-used.</p>
@@ -127,12 +221,10 @@
<li><p><strong>copy_nonce</strong> - (true/false) Sets whether to copy the nonce from request to response (if present)</p></li>
<li><p><strong>cache_headers</strong> - (true/false) Sets whether to set HTTP headers for caching GET responses. Coupled with a reverse proxy you can cache responses for a finite period and vastly speed up the response time of your server (at the cost of response freshness). Nonced requests will not be cached. The performance benefit of caching can vary drastically depending on the mix of clients connecting to the OCSP responder.</p></li>
<li><p><strong>max_cache_age</strong> - (integer) Sets the maximum age in <strong>seconds</strong> a response can be cached. At this time r509-ocsp-responder does not support cache invalidation so it is recommended to set this to a low value to reduce the time you may serve stale responses in the event of a revocation.</p></li>
</ul>
-<p>See the config.yaml.example for an example configuration.</p>
-
<h2>Signals</h2>
<p>You can send a kill -USR2 signal to any running r509-ocsp-responder process to cause it to reload and print its config to the logs (provided your app server isn't trapping USR2 first).</p>
<h2>Running Tests</h2>
@@ -145,12 +237,12 @@
<li>Devise a mechanism for doing automated OCSP delegate certificate renewal</li>
</ul>
</div></div>
<div id="footer">
- Generated on Thu Nov 8 14:33:52 2012 by
+ Generated on Tue Apr 16 13:57:16 2013 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
- 0.8.2.1 (ruby-1.9.3).
+ 0.8.6.1 (ruby-1.9.3).
</div>
</body>
</html>
\ No newline at end of file