Linux server.kiran-academy.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
: 194.233.91.196 | : 216.73.216.172
Cant Read [ /etc/named.conf ]
7.4.32
finalho
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
varnish-5.2.1 /
html /
reference /
[ HOME SHELL ]
Name
Size
Permission
Action
directors.html
17.15
KB
-rw-r--r--
index.html
11.66
KB
-rw-r--r--
states.html
6.61
KB
-rw-r--r--
varnish-cli.html
42.86
KB
-rw-r--r--
varnish-counters.html
47.32
KB
-rw-r--r--
varnishadm.html
11.39
KB
-rw-r--r--
varnishd.html
97.37
KB
-rw-r--r--
varnishhist.html
13.74
KB
-rw-r--r--
varnishlog.html
14.57
KB
-rw-r--r--
varnishncsa.html
20.51
KB
-rw-r--r--
varnishstat.html
15.77
KB
-rw-r--r--
varnishtest.html
20.91
KB
-rw-r--r--
varnishtop.html
14.9
KB
-rw-r--r--
vcl.html
60.01
KB
-rw-r--r--
vmod.html
38.09
KB
-rw-r--r--
vmod_blob.generated.html
60.21
KB
-rw-r--r--
vmod_directors.generated.html
47.28
KB
-rw-r--r--
vmod_purge.generated.html
11.75
KB
-rw-r--r--
vmod_std.generated.html
36.32
KB
-rw-r--r--
vmod_vtc.generated.html
21.55
KB
-rw-r--r--
vsl-query.html
23.18
KB
-rw-r--r--
vsl.html
57.59
KB
-rw-r--r--
vsm.html
10.09
KB
-rw-r--r--
vtc.html
57.21
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : varnish-cli.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>varnish-cli — Varnish version 5.2.1 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"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '5.2.1', 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="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="top" title="Varnish version 5.2.1 documentation" href="../index.html" /> <link rel="up" title="The Varnish Reference Manual" href="index.html" /> <link rel="next" title="varnishadm" href="varnishadm.html" /> <link rel="prev" title="Varnish Processing States" href="states.html" /> </head> <body role="document"> <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="varnishadm.html" title="varnishadm" accesskey="N">next</a> |</li> <li class="right" > <a href="states.html" title="Varnish Processing States" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 5.2.1 documentation</a> »</li> <li class="nav-item nav-item-1"><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" role="main"> <div class="section" id="varnish-cli"> <span id="varnish-cli-7"></span><h1>varnish-cli<a class="headerlink" href="#varnish-cli" title="Permalink to this headline">¶</a></h1> <div class="section" id="varnish-command-line-interface"> <h2>Varnish Command Line Interface<a class="headerlink" href="#varnish-command-line-interface" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Manual section:</th><td class="field-body">7</td> </tr> </tbody> </table> <div class="section" id="description"> <h3>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h3> <p>Varnish has a command line interface (CLI) which can control and change most of the operational parameters and the configuration of Varnish, without interrupting the running service.</p> <p>The CLI can be used for the following tasks:</p> <dl class="docutils"> <dt>configuration</dt> <dd>You can upload, change and delete VCL files from the CLI.</dd> <dt>parameters</dt> <dd>You can inspect and change the various parameters Varnish has available through the CLI. The individual parameters are documented in the varnishd(1) man page.</dd> <dt>bans</dt> <dd>Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any <em>banned</em> object from cache, but rather re-fetch it from its backend servers.</dd> <dt>process management</dt> <dd>You can stop and start the cache (child) process though the CLI. You can also retrieve the latest stack trace if the child process has crashed.</dd> </dl> <p>If you invoke varnishd(1) with -T, -M or -d the CLI will be available. In debug mode (-d) the CLI will be in the foreground, with -T you can connect to it with varnishadm or telnet and with -M varnishd will connect back to a listening service <em>pushing</em> the CLI to that service. Please see <a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a> for details.</p> <div class="section" id="syntax"> <span id="ref-syntax"></span><h4>Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h4> <p>The Varnish CLI is similar to another command line interface, the Bourne Shell. Commands are usually terminated with a newline, and they may take arguments. The command and its arguments are <em>tokenized</em> before parsing, and as such arguments containing spaces must be enclosed in double quotes.</p> <p>It means that command parsing of</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">help</span> <span class="n">banner</span> </pre></div> </div> <p>is equivalent to</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="s2">"help"</span> <span class="n">banner</span> </pre></div> </div> <p>because the double quotes only indicate the boundaries of the <code class="docutils literal"><span class="pre">help</span></code> token.</p> <p>Within double quotes you can escape characters with \ (backslash). The \n, \r, and \t get translated to newlines, carriage returns, an tabs. Double quotes and backslashes themselves can be escaped with \" and \\ respectively.</p> <p>To enter characters in octals use the \nnn syntax. Hexadecimals can be entered with the \xnn syntax.</p> <p>Commands may not end with a newline when a shell-style <em>here document</em> (here-document or heredoc) is used. The format of a here document is:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="o"><<</span> <span class="n">word</span> <span class="n">here</span> <span class="n">document</span> <span class="n">word</span> </pre></div> </div> <p><em>word</em> can be any continuous string chosen to make sure it doesn't appear naturally in the following <em>here document</em>. Traditionally EOF or END is used.</p> <p>When using the here document style of input there are no restrictions on length. When using newline-terminated commands maximum length is limited by the varnishd parameter <em>cli_buffer</em>.</p> </div> <div class="section" id="quoting-pitfalls"> <h4>Quoting pitfalls<a class="headerlink" href="#quoting-pitfalls" title="Permalink to this headline">¶</a></h4> <p>Integrating with the Varnish CLI can be sometimes surprising when quoting is involved. For instance in Bourne Shell the delimiter used with here documents may or may not be separated by spaces from the <code class="docutils literal"><span class="pre"><<</span></code> token:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cat</span> <span class="o"><<</span><span class="n">EOF</span> <span class="n">hello</span> <span class="n">world</span> <span class="n">EOF</span> <span class="n">hello</span> <span class="n">world</span> </pre></div> </div> <p>With the Varnish CLI, the <code class="docutils literal"><span class="pre"><<</span></code> and <code class="docutils literal"><span class="pre">EOF</span></code> tokens must be separated by at least one blank:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">boot</span> <span class="o"><<</span><span class="n">EOF</span> <span class="mi">106</span> <span class="mi">258</span> <span class="n">Message</span> <span class="kn">from</span> <span class="nn">VCC</span><span class="o">-</span><span class="n">compiler</span><span class="p">:</span> <span class="n">VCL</span> <span class="n">version</span> <span class="n">declaration</span> <span class="n">missing</span> <span class="n">Update</span> <span class="n">your</span> <span class="n">VCL</span> <span class="n">to</span> <span class="n">Version</span> <span class="mi">4</span> <span class="n">syntax</span><span class="p">,</span> <span class="ow">and</span> <span class="n">add</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">on</span> <span class="n">the</span> <span class="n">first</span> <span class="n">line</span> <span class="n">of</span> <span class="n">the</span> <span class="n">VCL</span> <span class="n">files</span><span class="o">.</span> <span class="p">(</span><span class="s1">'<vcl.inline>'</span> <span class="n">Line</span> <span class="mi">1</span> <span class="n">Pos</span> <span class="mi">1</span><span class="p">)</span> <span class="o"><<</span><span class="n">EOF</span> <span class="c1">##---</span> <span class="n">Running</span> <span class="n">VCC</span><span class="o">-</span><span class="n">compiler</span> <span class="n">failed</span><span class="p">,</span> <span class="n">exited</span> <span class="k">with</span> <span class="mi">2</span> <span class="n">VCL</span> <span class="n">compilation</span> <span class="n">failed</span> </pre></div> </div> <p>With the missing space, the here document can be added and the actual VCL can be loaded:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">test</span> <span class="o"><<</span> <span class="n">EOF</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">backend</span> <span class="n">be</span> <span class="p">{</span> <span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="s2">"localhost"</span><span class="p">;</span> <span class="p">}</span> <span class="n">EOF</span> <span class="mi">200</span> <span class="mi">14</span> <span class="n">VCL</span> <span class="n">compiled</span><span class="o">.</span> </pre></div> </div> <p>When using a front-end to the Varnish-CLI like <code class="docutils literal"><span class="pre">varnishadm</span></code>, one must take into account the double expansion happening. First in the shell launching the <code class="docutils literal"><span class="pre">varnishadm</span></code> command and then in the Varnish CLI itself. When a command's parameter require spaces, you need to ensure that the Varnish CLI will see the double quotes:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">varnishadm</span> <span class="n">param</span><span class="o">.</span><span class="n">set</span> <span class="n">cc_command</span> <span class="s1">'"my alternate cc command"'</span> <span class="n">Change</span> <span class="n">will</span> <span class="n">take</span> <span class="n">effect</span> <span class="n">when</span> <span class="n">VCL</span> <span class="n">script</span> <span class="ow">is</span> <span class="n">reloaded</span> </pre></div> </div> <p>Otherwise if you don't quote the quotes, you may get a seemingly unrelated error message:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">varnishadm</span> <span class="n">param</span><span class="o">.</span><span class="n">set</span> <span class="n">cc_command</span> <span class="s2">"my alternate cc command"</span> <span class="n">Unknown</span> <span class="n">request</span><span class="o">.</span> <span class="n">Type</span> <span class="s1">'help'</span> <span class="k">for</span> <span class="n">more</span> <span class="n">info</span><span class="o">.</span> <span class="n">Too</span> <span class="n">many</span> <span class="n">parameters</span> <span class="n">Command</span> <span class="n">failed</span> <span class="k">with</span> <span class="n">error</span> <span class="n">code</span> <span class="mi">105</span> </pre></div> </div> <p>If you are quoting with a here document, you must wrap it inside a shell multi-line argument:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">varnishadm</span> <span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">test</span> <span class="s1">'<< EOF</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">backend</span> <span class="n">be</span> <span class="p">{</span> <span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="s2">"localhost"</span><span class="p">;</span> <span class="p">}</span> <span class="n">EOF</span><span class="s1">'</span> <span class="n">VCL</span> <span class="n">compiled</span><span class="o">.</span> </pre></div> </div> <p>Other pitfalls include variable expansion of the shell invoking <code class="docutils literal"><span class="pre">varnishadm</span></code> but this is not directly related to the Varnish CLI. If you get the quoting right you should be fine even with complex commands.</p> </div> <div class="section" id="commands"> <h4>Commands<a class="headerlink" href="#commands" title="Permalink to this headline">¶</a></h4> <div class="section" id="auth-response"> <span id="ref-cli-auth-response"></span><h5>auth <response><a class="headerlink" href="#auth-response" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Authenticate.</div></blockquote> </div> <div class="section" id="backend-list-p-backend-pattern"> <span id="ref-cli-backend-list-p-backend-pattern"></span><h5>backend.list [-p] [<backend_pattern>]<a class="headerlink" href="#backend-list-p-backend-pattern" title="Permalink to this headline">¶</a></h5> <blockquote> <div>List backends. -p also shows probe status.</div></blockquote> </div> <div class="section" id="backend-set-health-backend-pattern-auto-healthy-sick"> <span id="ref-cli-backend-set-health-backend-pattern-auto-healthy-sick"></span><h5>backend.set_health <backend_pattern> [auto|healthy|sick]<a class="headerlink" href="#backend-set-health-backend-pattern-auto-healthy-sick" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Set health status on the backends.</div></blockquote> </div> <div class="section" id="ban-field-operator-arg-field-oper-arg"> <span id="ref-cli-ban-field-operator-arg-field-oper-arg"></span><h5>ban <field> <operator> <arg> [&& <field> <oper> <arg> ...]<a class="headerlink" href="#ban-field-operator-arg-field-oper-arg" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Mark obsolete all objects where all the conditions match.</div></blockquote> <p>See <a class="reference internal" href="vcl.html#vcl-7-ban"><span class="std std-ref">ban(STRING)</span></a> for details</p> </div> <div class="section" id="ban-list"> <span id="ref-cli-ban-list"></span><h5>ban.list<a class="headerlink" href="#ban-list" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>List the active bans.</p> <p>The output format is:</p> <ul class="simple"> <li>Time the ban was issued.</li> <li>Objects referencing this ban.</li> <li><code class="docutils literal"><span class="pre">C</span></code> if ban is completed = no further testing against it.</li> <li>if <code class="docutils literal"><span class="pre">lurker</span></code> debugging is enabled:<ul> <li><code class="docutils literal"><span class="pre">R</span></code> for req.* tests</li> <li><code class="docutils literal"><span class="pre">O</span></code> for obj.* tests</li> <li>Pointer to ban object</li> </ul> </li> <li>Ban specification</li> </ul> </div></blockquote> </div> <div class="section" id="banner"> <span id="ref-cli-banner"></span><h5>banner<a class="headerlink" href="#banner" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Print welcome banner.</div></blockquote> </div> <div class="section" id="help-command"> <span id="ref-cli-help-command"></span><h5>help [<command>]<a class="headerlink" href="#help-command" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Show command/protocol help.</div></blockquote> </div> <div class="section" id="panic-clear-z"> <span id="ref-cli-panic-clear-z"></span><h5>panic.clear [-z]<a class="headerlink" href="#panic-clear-z" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Clear the last panic, if any, -z will clear related varnishstat counter(s)</div></blockquote> </div> <div class="section" id="panic-show"> <span id="ref-cli-panic-show"></span><h5>panic.show<a class="headerlink" href="#panic-show" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Return the last panic, if any.</div></blockquote> </div> <div class="section" id="param-set-param-value"> <span id="ref-cli-param-set-param-value"></span><h5>param.set <param> <value><a class="headerlink" href="#param-set-param-value" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Set parameter value.</div></blockquote> </div> <div class="section" id="param-show-l-param"> <span id="ref-cli-param-show-l-param"></span><h5>param.show [-l] [<param>]<a class="headerlink" href="#param-show-l-param" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Show parameters and their values.</div></blockquote> </div> <div class="section" id="ping-timestamp"> <span id="ref-cli-ping-timestamp"></span><h5>ping [<timestamp>]<a class="headerlink" href="#ping-timestamp" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Keep connection alive.</div></blockquote> </div> <div class="section" id="quit"> <span id="ref-cli-quit"></span><h5>quit<a class="headerlink" href="#quit" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Close connection.</div></blockquote> </div> <div class="section" id="start"> <span id="ref-cli-start"></span><h5>start<a class="headerlink" href="#start" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Start the Varnish cache process.</div></blockquote> </div> <div class="section" id="status"> <span id="ref-cli-status"></span><h5>status<a class="headerlink" href="#status" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Check status of Varnish cache process.</div></blockquote> </div> <div class="section" id="stop"> <span id="ref-cli-stop"></span><h5>stop<a class="headerlink" href="#stop" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Stop the Varnish cache process.</div></blockquote> </div> <div class="section" id="storage-list"> <span id="ref-cli-storage-list"></span><h5>storage.list<a class="headerlink" href="#storage-list" title="Permalink to this headline">¶</a></h5> <blockquote> <div>List storage devices.</div></blockquote> </div> <div class="section" id="vcl-discard-configname-label"> <span id="ref-cli-vcl-discard-configname-label"></span><h5>vcl.discard <configname|label><a class="headerlink" href="#vcl-discard-configname-label" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Unload the named configuration (when possible).</div></blockquote> </div> <div class="section" id="vcl-inline-configname-quoted-vclstring-auto-cold-warm"> <span id="ref-cli-vcl-inline-configname-quoted-vclstring-auto-cold-warm"></span><h5>vcl.inline <configname> <quoted_VCLstring> [auto|cold|warm]<a class="headerlink" href="#vcl-inline-configname-quoted-vclstring-auto-cold-warm" title="Permalink to this headline">¶</a></h5> <blockquote> <div><p>Compile and load the VCL data under the name provided.</p> <p>Multi-line VCL can be input using the here document <a class="reference internal" href="#ref-syntax"><span class="std std-ref">Syntax</span></a>.</p> </div></blockquote> </div> <div class="section" id="vcl-label-label-configname"> <span id="ref-cli-vcl-label-label-configname"></span><h5>vcl.label <label> <configname><a class="headerlink" href="#vcl-label-label-configname" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Apply label to configuration.</div></blockquote> </div> <div class="section" id="vcl-list"> <span id="ref-cli-vcl-list"></span><h5>vcl.list<a class="headerlink" href="#vcl-list" title="Permalink to this headline">¶</a></h5> <blockquote> <div>List all loaded configuration.</div></blockquote> </div> <div class="section" id="vcl-load-configname-filename-auto-cold-warm"> <span id="ref-cli-vcl-load-configname-filename-auto-cold-warm"></span><h5>vcl.load <configname> <filename> [auto|cold|warm]<a class="headerlink" href="#vcl-load-configname-filename-auto-cold-warm" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Compile and load the VCL file under the name provided.</div></blockquote> </div> <div class="section" id="vcl-show-v-configname"> <span id="ref-cli-vcl-show-v-configname"></span><h5>vcl.show [-v] <configname><a class="headerlink" href="#vcl-show-v-configname" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Display the source code for the specified configuration.</div></blockquote> </div> <div class="section" id="vcl-state-configname-auto-cold-warm"> <span id="ref-cli-vcl-state-configname-auto-cold-warm"></span><h5>vcl.state <configname> [auto|cold|warm]<a class="headerlink" href="#vcl-state-configname-auto-cold-warm" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Force the state of the named configuration.</div></blockquote> </div> <div class="section" id="vcl-use-configname-label"> <span id="ref-cli-vcl-use-configname-label"></span><h5>vcl.use <configname|label><a class="headerlink" href="#vcl-use-configname-label" title="Permalink to this headline">¶</a></h5> <blockquote> <div>Switch to the named configuration immediately.</div></blockquote> </div> </div> <div class="section" id="backend-pattern"> <h4>Backend Pattern<a class="headerlink" href="#backend-pattern" title="Permalink to this headline">¶</a></h4> <p>A backend pattern can be a backend name or a combination of a VCL name and backend name in "VCL.backend" format. If the VCL name is omitted, the active VCL is assumed. Partial matching on the backend and VCL names is supported using shell-style wilcards, e.g. asterisk (*).</p> <p>Examples:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">backend</span><span class="o">.</span><span class="n">list</span> <span class="n">def</span><span class="o">*</span> <span class="n">backend</span><span class="o">.</span><span class="n">list</span> <span class="n">b</span><span class="o">*.</span><span class="n">def</span><span class="o">*</span> <span class="n">backend</span><span class="o">.</span><span class="n">set_health</span> <span class="n">default</span> <span class="n">sick</span> <span class="n">backend</span><span class="o">.</span><span class="n">set_health</span> <span class="n">def</span><span class="o">*</span> <span class="n">healthy</span> <span class="n">backend</span><span class="o">.</span><span class="n">set_health</span> <span class="o">*</span> <span class="n">auto</span> </pre></div> </div> </div> <div class="section" id="ban-expressions"> <h4>Ban Expressions<a class="headerlink" href="#ban-expressions" title="Permalink to this headline">¶</a></h4> <p>A ban expression consists of one or more conditions. A condition consists of a field, an operator, and an argument. Conditions can be ANDed together with "&&".</p> <p>A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie.</p> <p>Operators are "==" for direct comparison, "~" for a regular expression match, and ">" or "<" for size comparisons. Prepending an operator with "!" negates the expression.</p> <p>The argument could be a quoted string, a regexp, or an integer. Integers can have "KB", "MB", "GB" or "TB" appended for size related fields.</p> </div> <div class="section" id="vcl-temperature"> <span id="ref-vcl-temperature"></span><h4>VCL Temperature<a class="headerlink" href="#vcl-temperature" title="Permalink to this headline">¶</a></h4> <p>A VCL program goes through several states related to the different commands: it can be loaded, used, and later discarded. You can load several VCL programs and switch at any time from one to another. There is only one active VCL, but the previous active VCL will be maintained active until all its transactions are over.</p> <p>Over time, if you often refresh your VCL and keep the previous versions around, resource consumption will increase, you can't escape that. However, most of the time you want only one to pay the price only for the active VCL and keep older VCLs in case you'd need to rollback to a previous version.</p> <p>The VCL temperature allows you to minimize the footprint of inactive VCLs. Once a VCL becomes cold, Varnish will release all the resources that can be be later reacquired. You can manually set the temperature of a VCL or let varnish automatically handle it.</p> </div> <div class="section" id="scripting"> <h4>Scripting<a class="headerlink" href="#scripting" title="Permalink to this headline">¶</a></h4> <p>If you are going to write a script that talks CLI to varnishd, the include/cli.h contains the relevant magic numbers.</p> <p>One particular magic number to know, is that the line with the status code and length field always is exactly 13 characters long, including the NL character.</p> <p>The varnishapi library contains functions to implement the basics of the CLI protocol, see the <cite>vcli.h</cite> include file.</p> </div> <div class="section" id="authentication-with-s"> <span id="ref-psk-auth"></span><h4>Authentication with -S<a class="headerlink" href="#authentication-with-s" title="Permalink to this headline">¶</a></h4> <p>If the -S secret-file is given as argument to varnishd, all network CLI connections must authenticate, by proving they know the contents of that file.</p> <p>The file is read at the time the auth command is issued and the contents is not cached in varnishd, so it is possible to update the file on the fly.</p> <p>Use the unix file permissions to control access to the file.</p> <p>An authenticated session looks like this:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">critter</span> <span class="n">phk</span><span class="o">></span> <span class="n">telnet</span> <span class="n">localhost</span> <span class="mi">1234</span> <span class="n">Trying</span> <span class="p">::</span><span class="mf">1.</span><span class="o">..</span> <span class="n">Trying</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="o">...</span> <span class="n">Connected</span> <span class="n">to</span> <span class="n">localhost</span><span class="o">.</span> <span class="n">Escape</span> <span class="n">character</span> <span class="ow">is</span> <span class="s1">'^]'</span><span class="o">.</span> <span class="mi">107</span> <span class="mi">59</span> <span class="n">ixslvvxrgkjptxmcgnnsdxsvdmvfympg</span> <span class="n">Authentication</span> <span class="n">required</span><span class="o">.</span> <span class="n">auth</span> <span class="mi">455</span><span class="n">ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a</span> <span class="mi">200</span> <span class="mi">279</span> <span class="o">-----------------------------</span> <span class="n">Varnish</span> <span class="n">Cache</span> <span class="n">CLI</span> <span class="mf">1.0</span> <span class="o">-----------------------------</span> <span class="n">Linux</span><span class="p">,</span><span class="mf">4.4</span><span class="o">.</span><span class="mi">0</span><span class="o">-</span><span class="mi">1</span><span class="o">-</span><span class="n">amd64</span><span class="p">,</span><span class="n">x86_64</span><span class="p">,</span><span class="o">-</span><span class="n">jnone</span><span class="p">,</span><span class="o">-</span><span class="n">smalloc</span><span class="p">,</span><span class="o">-</span><span class="n">smalloc</span><span class="p">,</span><span class="o">-</span><span class="n">hcritbit</span> <span class="n">varnish</span><span class="o">-</span><span class="n">trunk</span> <span class="n">revision</span> <span class="n">dc360a4</span> <span class="n">Type</span> <span class="s1">'help'</span> <span class="k">for</span> <span class="n">command</span> <span class="nb">list</span><span class="o">.</span> <span class="n">Type</span> <span class="s1">'quit'</span> <span class="n">to</span> <span class="n">close</span> <span class="n">CLI</span> <span class="n">session</span><span class="o">.</span> <span class="n">Type</span> <span class="s1">'start'</span> <span class="n">to</span> <span class="n">launch</span> <span class="n">worker</span> <span class="n">process</span><span class="o">.</span> </pre></div> </div> <p>The CLI status of 107 indicates that authentication is necessary. The first 32 characters of the response text is the challenge "ixsl...mpg". The challenge is randomly generated for each CLI connection, and changes each time a 107 is emitted.</p> <p>The most recently emitted challenge must be used for calculating the authenticator "455c...c89a".</p> <p>The authenticator is calculated by applying the SHA256 function to the following byte sequence:</p> <ul class="simple"> <li>Challenge string</li> <li>Newline (0x0a) character.</li> <li>Contents of the secret file</li> <li>Challenge string</li> <li>Newline (0x0a) character.</li> </ul> <p>and dumping the resulting digest in lower-case hex.</p> <p>In the above example, the secret file contained foon and thus:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">critter</span> <span class="n">phk</span><span class="o">></span> <span class="n">cat</span> <span class="o">></span> <span class="n">_</span> <span class="n">ixslvvxrgkjptxmcgnnsdxsvdmvfympg</span> <span class="n">foo</span> <span class="n">ixslvvxrgkjptxmcgnnsdxsvdmvfympg</span> <span class="o">^</span><span class="n">D</span> <span class="n">critter</span> <span class="n">phk</span><span class="o">></span> <span class="n">hexdump</span> <span class="o">-</span><span class="n">C</span> <span class="n">_</span> <span class="mi">00000000</span> <span class="mi">69</span> <span class="mi">78</span> <span class="mi">73</span> <span class="mi">6</span><span class="n">c</span> <span class="mi">76</span> <span class="mi">76</span> <span class="mi">78</span> <span class="mi">72</span> <span class="mi">67</span> <span class="mi">6</span><span class="n">b</span> <span class="mi">6</span><span class="n">a</span> <span class="mi">70</span> <span class="mi">74</span> <span class="mi">78</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">63</span> <span class="o">|</span><span class="n">ixslvvxrgkjptxmc</span><span class="o">|</span> <span class="mi">00000010</span> <span class="mi">67</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">73</span> <span class="mi">64</span> <span class="mi">78</span> <span class="mi">73</span> <span class="mi">76</span> <span class="mi">64</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">76</span> <span class="mi">66</span> <span class="mi">79</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">70</span> <span class="mi">67</span> <span class="o">|</span><span class="n">gnnsdxsvdmvfympg</span><span class="o">|</span> <span class="mi">00000020</span> <span class="mi">0</span><span class="n">a</span> <span class="mi">66</span> <span class="mi">6</span><span class="n">f</span> <span class="mi">6</span><span class="n">f</span> <span class="mi">0</span><span class="n">a</span> <span class="mi">69</span> <span class="mi">78</span> <span class="mi">73</span> <span class="mi">6</span><span class="n">c</span> <span class="mi">76</span> <span class="mi">76</span> <span class="mi">78</span> <span class="mi">72</span> <span class="mi">67</span> <span class="mi">6</span><span class="n">b</span> <span class="mi">6</span><span class="n">a</span> <span class="o">|.</span><span class="n">foo</span><span class="o">.</span><span class="n">ixslvvxrgkj</span><span class="o">|</span> <span class="mi">00000030</span> <span class="mi">70</span> <span class="mi">74</span> <span class="mi">78</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">63</span> <span class="mi">67</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">6</span><span class="n">e</span> <span class="mi">73</span> <span class="mi">64</span> <span class="mi">78</span> <span class="mi">73</span> <span class="mi">76</span> <span class="mi">64</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">76</span> <span class="o">|</span><span class="n">ptxmcgnnsdxsvdmv</span><span class="o">|</span> <span class="mi">00000040</span> <span class="mi">66</span> <span class="mi">79</span> <span class="mi">6</span><span class="n">d</span> <span class="mi">70</span> <span class="mi">67</span> <span class="mi">0</span><span class="n">a</span> <span class="o">|</span><span class="n">fympg</span><span class="o">.|</span> <span class="mi">00000046</span> <span class="n">critter</span> <span class="n">phk</span><span class="o">></span> <span class="n">sha256</span> <span class="n">_</span> <span class="n">SHA256</span> <span class="p">(</span><span class="n">_</span><span class="p">)</span> <span class="o">=</span> <span class="mi">455</span><span class="n">ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a</span> <span class="n">critter</span> <span class="n">phk</span><span class="o">></span> <span class="n">openssl</span> <span class="n">dgst</span> <span class="o">-</span><span class="n">sha256</span> <span class="o"><</span> <span class="n">_</span> <span class="mi">455</span><span class="n">ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a</span> </pre></div> </div> <p>The sourcefile lib/libvarnish/cli_auth.c contains a useful function which calculates the response, given an open filedescriptor to the secret file, and the challenge string.</p> </div> </div> <div class="section" id="examples"> <h3>EXAMPLES<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h3> <p>Load a multi-line VCL using shell-style <em>here document</em>:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">vcl</span><span class="o">.</span><span class="n">inline</span> <span class="n">example</span> <span class="o"><<</span> <span class="n">EOF</span> <span class="n">vcl</span> <span class="mf">4.0</span><span class="p">;</span> <span class="n">backend</span> <span class="n">www</span> <span class="p">{</span> <span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="s2">"127.0.0.1"</span><span class="p">;</span> <span class="o">.</span><span class="n">port</span> <span class="o">=</span> <span class="s2">"8080"</span><span class="p">;</span> <span class="p">}</span> <span class="n">EOF</span> </pre></div> </div> <p>Ban all requests where req.url exactly matches the string /news:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">ban</span> <span class="n">req</span><span class="o">.</span><span class="n">url</span> <span class="o">==</span> <span class="s2">"/news"</span> </pre></div> </div> <p>Ban all documents where the serving host is "example.com" or "www.example.com", and where the Set-Cookie header received from the backend contains "USERID=1663":</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">ban</span> <span class="n">req</span><span class="o">.</span><span class="n">http</span><span class="o">.</span><span class="n">host</span> <span class="o">~</span> <span class="s2">"^(?i)(www</span><span class="se">\\</span><span class="s2">.)?example</span><span class="se">\\</span><span class="s2">.com$"</span> <span class="o">&&</span> <span class="n">obj</span><span class="o">.</span><span class="n">http</span><span class="o">.</span><span class="n">set</span><span class="o">-</span><span class="n">cookie</span> <span class="o">~</span> <span class="s2">"USERID=1663"</span> </pre></div> </div> </div> <div class="section" id="authors"> <h3>AUTHORS<a class="headerlink" href="#authors" title="Permalink to this headline">¶</a></h3> <p>This manual page was originally written by Per Buer and later modified by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul-Henning Kamp.</p> </div> <div class="section" id="see-also"> <h3>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="varnishadm.html#varnishadm-1"><span class="std std-ref">varnishadm</span></a></li> <li><a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></li> <li><a class="reference internal" href="vcl.html#vcl-7"><span class="std std-ref">VCL</span></a></li> </ul> </div> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">varnish-cli</a><ul> <li><a class="reference internal" href="#varnish-command-line-interface">Varnish Command Line Interface</a><ul> <li><a class="reference internal" href="#description">DESCRIPTION</a><ul> <li><a class="reference internal" href="#syntax">Syntax</a></li> <li><a class="reference internal" href="#quoting-pitfalls">Quoting pitfalls</a></li> <li><a class="reference internal" href="#commands">Commands</a><ul> <li><a class="reference internal" href="#auth-response">auth <response></a></li> <li><a class="reference internal" href="#backend-list-p-backend-pattern">backend.list [-p] [<backend_pattern>]</a></li> <li><a class="reference internal" href="#backend-set-health-backend-pattern-auto-healthy-sick">backend.set_health <backend_pattern> [auto|healthy|sick]</a></li> <li><a class="reference internal" href="#ban-field-operator-arg-field-oper-arg">ban <field> <operator> <arg> [&& <field> <oper> <arg> ...]</a></li> <li><a class="reference internal" href="#ban-list">ban.list</a></li> <li><a class="reference internal" href="#banner">banner</a></li> <li><a class="reference internal" href="#help-command">help [<command>]</a></li> <li><a class="reference internal" href="#panic-clear-z">panic.clear [-z]</a></li> <li><a class="reference internal" href="#panic-show">panic.show</a></li> <li><a class="reference internal" href="#param-set-param-value">param.set <param> <value></a></li> <li><a class="reference internal" href="#param-show-l-param">param.show [-l] [<param>]</a></li> <li><a class="reference internal" href="#ping-timestamp">ping [<timestamp>]</a></li> <li><a class="reference internal" href="#quit">quit</a></li> <li><a class="reference internal" href="#start">start</a></li> <li><a class="reference internal" href="#status">status</a></li> <li><a class="reference internal" href="#stop">stop</a></li> <li><a class="reference internal" href="#storage-list">storage.list</a></li> <li><a class="reference internal" href="#vcl-discard-configname-label">vcl.discard <configname|label></a></li> <li><a class="reference internal" href="#vcl-inline-configname-quoted-vclstring-auto-cold-warm">vcl.inline <configname> <quoted_VCLstring> [auto|cold|warm]</a></li> <li><a class="reference internal" href="#vcl-label-label-configname">vcl.label <label> <configname></a></li> <li><a class="reference internal" href="#vcl-list">vcl.list</a></li> <li><a class="reference internal" href="#vcl-load-configname-filename-auto-cold-warm">vcl.load <configname> <filename> [auto|cold|warm]</a></li> <li><a class="reference internal" href="#vcl-show-v-configname">vcl.show [-v] <configname></a></li> <li><a class="reference internal" href="#vcl-state-configname-auto-cold-warm">vcl.state <configname> [auto|cold|warm]</a></li> <li><a class="reference internal" href="#vcl-use-configname-label">vcl.use <configname|label></a></li> </ul> </li> <li><a class="reference internal" href="#backend-pattern">Backend Pattern</a></li> <li><a class="reference internal" href="#ban-expressions">Ban Expressions</a></li> <li><a class="reference internal" href="#vcl-temperature">VCL Temperature</a></li> <li><a class="reference internal" href="#scripting">Scripting</a></li> <li><a class="reference internal" href="#authentication-with-s">Authentication with -S</a></li> </ul> </li> <li><a class="reference internal" href="#examples">EXAMPLES</a></li> <li><a class="reference internal" href="#authors">AUTHORS</a></li> <li><a class="reference internal" href="#see-also">SEE ALSO</a></li> </ul> </li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="states.html" title="previous chapter">Varnish Processing States</a></p> <h4>Next topic</h4> <p class="topless"><a href="varnishadm.html" title="next chapter">varnishadm</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/varnish-cli.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </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="varnishadm.html" title="varnishadm" >next</a> |</li> <li class="right" > <a href="states.html" title="Varnish Processing States" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 5.2.1 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" >The Varnish Reference Manual</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2010-2014, Varnish Software AS. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9. </div> </body> </html>
Close