File: //usr/share/doc/varnish/html/reference/vmod_proxy.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="Content-Type" content="text/html; charset=utf-8" />
<title>VMOD proxy - Varnish Module to extract TLV attributes from PROXYv2 — Varnish version 6.4.0 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '6.4.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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="top" title="Varnish version 6.4.0 documentation" href="../index.html" />
<link rel="up" title="The Varnish Reference Manual" href="index.html" />
<link rel="next" title="VMOD purge - Varnish Purge Module" href="vmod_purge.html" />
<link rel="prev" title="VMOD directors - Varnish Directors Module" href="vmod_directors.html" />
</head>
<body>
<div class="related">
<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="vmod_purge.html" title="VMOD purge - Varnish Purge Module"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="vmod_directors.html" title="VMOD directors - Varnish Directors Module"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Varnish version 6.4.0 documentation</a> »</li>
<li><a href="index.html" accesskey="U">The Varnish Reference Manual</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="vmod-proxy-varnish-module-to-extract-tlv-attributes-from-proxyv2">
<span id="vmod-proxy-3"></span><h1>VMOD proxy - Varnish Module to extract TLV attributes from PROXYv2<a class="headerlink" href="#vmod-proxy-varnish-module-to-extract-tlv-attributes-from-proxyv2" title="Permalink to this headline">¶</a></h1>
<div class="section" id="synopsis">
<h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline">¶</a></h2>
<pre class="literal-block">
import proxy [as name] [from "path"]
<a class="reference internal" href="#proxy-alpn"><em>STRING alpn()</em></a>
<a class="reference internal" href="#proxy-authority"><em>STRING authority()</em></a>
<a class="reference internal" href="#proxy-is-ssl"><em>BOOL is_ssl()</em></a>
<a class="reference internal" href="#proxy-client-has-cert-sess"><em>BOOL client_has_cert_sess()</em></a>
<a class="reference internal" href="#proxy-client-has-cert-conn"><em>BOOL client_has_cert_conn()</em></a>
<a class="reference internal" href="#proxy-ssl-verify-result"><em>INT ssl_verify_result()</em></a>
<a class="reference internal" href="#proxy-ssl-version"><em>STRING ssl_version()</em></a>
<a class="reference internal" href="#proxy-client-cert-cn"><em>STRING client_cert_cn()</em></a>
<a class="reference internal" href="#proxy-ssl-cipher"><em>STRING ssl_cipher()</em></a>
<a class="reference internal" href="#proxy-cert-sign"><em>STRING cert_sign()</em></a>
<a class="reference internal" href="#proxy-cert-key"><em>STRING cert_key()</em></a>
</pre>
</div>
<div class="section" id="description">
<h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p><em>vmod_proxy</em> contains functions to extract proxy-protocol-v2 TLV
attributes as described in
<a class="reference external" href="https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt">https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt</a>.</p>
<div class="section" id="string-alpn">
<span id="proxy-alpn"></span><h3>STRING alpn()<a class="headerlink" href="#string-alpn" title="Permalink to this headline">¶</a></h3>
<p>Extract ALPN attribute.</p>
<p>Example:</p>
<div class="highlight-python"><pre>set req.http.alpn = proxy.alpn();</pre>
</div>
</div>
<div class="section" id="string-authority">
<span id="proxy-authority"></span><h3>STRING authority()<a class="headerlink" href="#string-authority" title="Permalink to this headline">¶</a></h3>
<p>Extract authority attribute. This corresponds to SNI from a TLS
connection.</p>
<p>Example:</p>
<div class="highlight-python"><pre>set req.http.authority = proxy.authority();</pre>
</div>
</div>
<div class="section" id="bool-is-ssl">
<span id="proxy-is-ssl"></span><h3>BOOL is_ssl()<a class="headerlink" href="#bool-is-ssl" title="Permalink to this headline">¶</a></h3>
<p>Report if proxy-protocol-v2 has SSL TLV.</p>
<p>Example:</p>
<div class="highlight-python"><pre>if (proxy.is_ssl()) {
set req.http.ssl-version = proxy.ssl_version();
}</pre>
</div>
</div>
<div class="section" id="bool-client-has-cert-sess">
<span id="proxy-client-has-cert-sess"></span><h3>BOOL client_has_cert_sess()<a class="headerlink" href="#bool-client-has-cert-sess" title="Permalink to this headline">¶</a></h3>
<p>Report if the client provided a certificate at least once over the TLS
session this connection belongs to.</p>
</div>
<div class="section" id="bool-client-has-cert-conn">
<span id="proxy-client-has-cert-conn"></span><h3>BOOL client_has_cert_conn()<a class="headerlink" href="#bool-client-has-cert-conn" title="Permalink to this headline">¶</a></h3>
<p>Report if the client provided a certificate over the current
connection.</p>
</div>
<div class="section" id="int-ssl-verify-result">
<span id="proxy-ssl-verify-result"></span><h3>INT ssl_verify_result()<a class="headerlink" href="#int-ssl-verify-result" title="Permalink to this headline">¶</a></h3>
<p>Report the SSL_get_verify_result from a TLS session. It only matters
if client_has_cert_sess() is true. Per default, value is set to 0
(X509_V_OK).</p>
<p>Example:</p>
<div class="highlight-python"><pre>if (proxy.client_has_cert_sess() && proxy.ssl_verify_result() == 0) {
set req.http.ssl-verify = "ok";
}</pre>
</div>
</div>
<div class="section" id="string-ssl-version">
<span id="proxy-ssl-version"></span><h3>STRING ssl_version()<a class="headerlink" href="#string-ssl-version" title="Permalink to this headline">¶</a></h3>
<p>Extract SSL version attribute.</p>
<p>Example:</p>
<div class="highlight-python"><pre>set req.http.ssl-version = proxy.ssl_version();</pre>
</div>
</div>
<div class="section" id="string-client-cert-cn">
<span id="proxy-client-cert-cn"></span><h3>STRING client_cert_cn()<a class="headerlink" href="#string-client-cert-cn" title="Permalink to this headline">¶</a></h3>
<p>Extract the common name attribute of the client certificate's.</p>
<dl class="docutils">
<dt>Example::</dt>
<dd>set req.http.cert-cn = proxy.client_cert_cn();</dd>
</dl>
</div>
<div class="section" id="string-ssl-cipher">
<span id="proxy-ssl-cipher"></span><h3>STRING ssl_cipher()<a class="headerlink" href="#string-ssl-cipher" title="Permalink to this headline">¶</a></h3>
<p>Extract the SSL cipher attribute.</p>
<p>Example:</p>
<div class="highlight-python"><pre>set req.http.ssl-cipher = proxy.ssl_cipher();</pre>
</div>
</div>
<div class="section" id="string-cert-sign">
<span id="proxy-cert-sign"></span><h3>STRING cert_sign()<a class="headerlink" href="#string-cert-sign" title="Permalink to this headline">¶</a></h3>
<p>Extract the certificate signature algorithm attribute.</p>
<p>Example:</p>
<div class="highlight-python"><pre>set req.http.cert-sign = proxy.cert_sign();</pre>
</div>
</div>
<div class="section" id="string-cert-key">
<span id="proxy-cert-key"></span><h3>STRING cert_key()<a class="headerlink" href="#string-cert-key" title="Permalink to this headline">¶</a></h3>
<p>Extract the certificate key algorithm attribute.</p>
<p>Example:</p>
<div class="highlight-python"><pre>set req.http.cert-key = proxy.cert_key();</pre>
</div>
</div>
</div>
<div class="section" id="see-also">
<h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference internal" href="varnishd.html#varnishd-1"><em>varnishd</em></a></li>
<li><a class="reference internal" href="vsl.html#vsl-7"><em>VSL</em></a></li>
</ul>
</div>
<div class="section" id="copyright">
<h2>COPYRIGHT<a class="headerlink" href="#copyright" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><pre>Copyright (c) 2018 GANDI SAS
All rights reserved.
Author: Emmanuel Hocdet <manu@gandi.net>
SPDX-License-Identifier: BSD-2-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="vmod_directors.html"
title="previous chapter">VMOD directors - Varnish Directors Module</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="vmod_purge.html"
title="next chapter">VMOD purge - Varnish Purge Module</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/reference/vmod_proxy.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<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>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<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="vmod_purge.html" title="VMOD purge - Varnish Purge Module"
>next</a> |</li>
<li class="right" >
<a href="vmod_directors.html" title="VMOD directors - Varnish Directors Module"
>previous</a> |</li>
<li><a href="../index.html">Varnish version 6.4.0 documentation</a> »</li>
<li><a href="index.html" >The Varnish Reference Manual</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2010-2014, Varnish Software AS.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>