HEX
Server: Apache
System: Linux vpshost0650.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User: bandeirantesbomb3 (10068)
PHP: 8.0.7
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //usr/share/doc/varnish-6.0.3/html/phk/ssl.html
<!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">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Why no SSL ? &#8212; Varnish version 6.0.3 documentation</title>
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="How GZIP, and GZIP+ESI works in Varnish" href="gzip.html" />
    <link rel="prev" title="Thoughts on the eve of Varnish 3.0" href="three-zero.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="gzip.html" title="How GZIP, and GZIP+ESI works in Varnish"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="three-zero.html" title="Thoughts on the eve of Varnish 3.0"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 6.0.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Poul-Hennings random outbursts</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="why-no-ssl">
<span id="phk-ssl"></span><h1>Why no SSL ?<a class="headerlink" href="#why-no-ssl" title="Permalink to this headline">¶</a></h1>
<p>This is turning into a bit of a FAQ, but the answer is too big to fit
in the margin we use for those.</p>
<p>There are a number of reasons why there are no plans in sight that will
grow SSL support in Varnish.</p>
<p>First, I have yet to see a SSL library where the source code is not
a nightmare.</p>
<p>As I am writing this, the varnish source-code tree contains 82.595
lines of .c and .h files, including JEmalloc (12.236 lines) and
Zlib (12.344 lines).</p>
<p>OpenSSL, as imported into FreeBSD, is 340.722 lines of code, nine
times larger than the Varnish source code, 27 times larger than
each of Zlib or JEmalloc.</p>
<p>This should give you some indication of how insanely complex
the canonical implementation of SSL is.</p>
<p>Second, it is not exactly the best source-code in the world.  Even
if I have no idea what it does, there are many aspect of it that
scares me.</p>
<p>Take this example in a comment, randomly found in s3-srvr.c:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">/*</span> <span class="n">Throw</span> <span class="n">away</span> <span class="n">what</span> <span class="n">we</span> <span class="n">have</span> <span class="n">done</span> <span class="n">so</span> <span class="n">far</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">current</span> <span class="n">handshake</span><span class="p">,</span>
 <span class="o">*</span> <span class="n">which</span> <span class="n">will</span> <span class="n">now</span> <span class="n">be</span> <span class="n">aborted</span><span class="o">.</span> <span class="p">(</span><span class="n">A</span> <span class="n">full</span> <span class="n">SSL_clear</span> <span class="n">would</span> <span class="n">be</span> <span class="n">too</span> <span class="n">much</span><span class="o">.</span><span class="p">)</span>
 <span class="o">*</span> <span class="n">I</span> <span class="n">hope</span> <span class="n">that</span> <span class="n">tmp</span><span class="o">.</span><span class="n">dh</span> <span class="ow">is</span> <span class="n">the</span> <span class="n">only</span> <span class="n">thing</span> <span class="n">that</span> <span class="n">may</span> <span class="n">need</span> <span class="n">to</span> <span class="n">be</span> <span class="n">cleared</span>
 <span class="o">*</span> <span class="n">when</span> <span class="n">a</span> <span class="n">handshake</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">completed</span> <span class="o">...</span> <span class="o">*/</span>
</pre></div>
</div>
<p>I hope they know what they are doing, but this comment doesn’t exactly
carry that point home, does it ?</p>
<p>But let us assume that a good SSL library can be found, what would
Varnish do with it ?</p>
<p>We would terminate SSL sessions, and we would burn CPU cycles doing
that.  You can kiss the highly optimized delivery path in Varnish
goodbye for SSL, we cannot simply tell the kernel to put the bytes
on the socket, rather, we have to corkscrew the data through
the SSL library and then write it to the socket.</p>
<p>Will that be significantly different, performance wise, from running
a SSL proxy in separate process ?</p>
<p>No, it will not, because the way varnish would have to do it would
be to … start a separate process to do the SSL handling.</p>
<p>There is no other way we can guarantee that secret krypto-bits do
not leak anywhere they should not, than by fencing in the code that
deals with them in a child process, so the bulk of varnish never
gets anywhere near the certificates, not even during a core-dump.</p>
<p>Would I be able to write a better stand-alone SSL proxy process
than the many which already exists ?</p>
<p>Probably not, unless I also write my own SSL implementation library,
including support for hardware crypto engines and the works.</p>
<p>That is not one of the things I dreamt about doing as a kid and
if I dream about it now I call it a nightmare.</p>
<p>So the balance sheet, as far as I can see it, lists “It would be
a bit easier to configure” on the plus side, and everything else
piles up on the minus side, making it a huge waste of time
and effort to even think about it..</p>
<p>Poul-Henning, 2011-02-15</p>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="three-zero.html"
                        title="previous chapter">Thoughts on the eve of Varnish 3.0</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="gzip.html"
                        title="next chapter">How GZIP, and GZIP+ESI works in Varnish</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/phk/ssl.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="gzip.html" title="How GZIP, and GZIP+ESI works in Varnish"
             >next</a> |</li>
        <li class="right" >
          <a href="three-zero.html" title="Thoughts on the eve of Varnish 3.0"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 6.0.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >Poul-Hennings random outbursts</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2010-2014, Varnish Software AS.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.6.
    </div>
  </body>
</html>