Varnish
Common parts of every card (states, backoff, Unit and ExecReload, Test config, manual commands) are described in Monitor window.
| Detected by | systemd units varnish or binaries varnishd |
| Read every | 30 s while the Monitor window shows the tab |
| Active probe | yes, off by default |
| Test config | none |
| Manual commands | 2 |
What the card reads and shows
Section titled “What the card reads and shows”Varnish Cache: backends with their address and probe, directors, ACLs (names and entry counts only), the listen addresses and storage of varnishd, the version; with the active probe the live counters of the shared memory (varnishstat -1): cache hits and misses, objects, LRU nukes, storage use and each backend’s probe results.
Passive: on the host the probe finds the running varnishd manager (/proc/<pid>/comm, real = effective uid of root, the varnish/vcache account or the session’s, the same PID namespace, its trusted exe; from its argv only -a, -b, -f, -n, -s, -S (the path, never the file) and -T, each from a closed alphabet), runs varnishd -V of a trusted binary (with the active probe only) and reads the VCL itself: varnish/reader.sh follows include, varnish/filter.awk is a lexer like VCC’s that prints only backend names, .host, .port, .path, the probe’s .url (no query), .interval, .timeout, .window, .threshold, .initial (never .request, .host_header or anything in a sub but new … = <module>.<object>( and <director>.add_backend(<backend>), ACL names with their entry counts, the number of subs. Unknown syntax (inline C, unterminated strings) ends the reading of that file (fail closed).
Active (off by default): varnishstat -1 -t 2 [-n <instance>] -f … (shared memory, no secret, no log entry) of a trusted binary in a clean environment; on the host only a closed list of counters leaves it. varnishadm (the full administrative channel, needs the -S secret) is never run: only shown for the terminal. The secret file is never read. varnishd -C compiles the VCL with the C compiler, loads VMODs and the result, and prints the generated C with the whole VCL source: also only for the terminal.
Active probe
Section titled “Active probe”Runs: varnishstat -1 -t 2 [-n <instance of the running varnishd>] -f ‘MAIN.’ -f ‘MGT.’ -f ‘SMA.’ -f ‘SMF.’ -f ‘VBE.*.happy’ (and .req, .fail, .conn, .unhealthy, .busy) of a trusted binary in a clean environment (env -i), under timeout 8; reads the shared memory (VSM) of varnishd, no secret and no connection; on the host only listed counters leave it (hits, misses, objects, LRU nukes, threads, storage, each backend’s probe bitmap and request counters), no descriptions. Every 30 s while the Monitor is open. On a root session it reads the VSM of the varnish/vcache accounts (root may read any). Not run when the instance (-n) of the running varnishd is not known. varnishadm (the administrative channel, needs the secret file) is never run
Traces on the host: none in Varnish’s logs (varnishstat only reads shared memory); KryoDesk’s lock file kryodesk/varnish.lock. Without read access to the working directory (usually group varnish) the probe stops until Retry
Test config
Section titled “Test config”None: KryoDesk does not run varnishd -C itself: it compiles the VCL to C, runs the C compiler (cc_command) and loads the result and the VMODs (code of inline C and VMODs runs), and prints the whole generated C, which holds the full VCL source with every string, so its output belongs in the terminal only; the command is below.
Manual commands
Section titled “Manual commands”KryoDesk shows these with Copy / Paste to terminal and never runs them.
| Label | Command | What it does |
|---|---|---|
| Backend health and probe details (varnishadm) | varnishadm [-n <instance>] backend.list -p |
varnishadm is the full administrative channel of varnishd, so KryoDesk never runs it. It reads the secret file <secret> (-S; usually readable by root only) and connects to the management address (-T); varnishd logs every CLI command to syslog or the journal (“CLI telnet … Rd backend.list -p”). Shows each backend’s health as varnishd decides it (also health forced with backend.set_health) and the last probe results |
| Compile the VCL (varnishd -C) | sh -c 'd=$(mktemp -d) || exit 1; chmod 755 "$d"; varnishd -C -n "$d"/n -f <vcl>; s=$?; rm -rf -- "$d"; exit $s' |
compiles <vcl> with its includes as a reload would: runs VCC, the C compiler (cc_command) and loads the result and the VMODs (inline C and VMOD code runs), in a temporary working directory (-n) removed afterwards, so the running varnishd is not touched. On success it prints the whole generated C (with the full VCL source and every string in it) to stderr; on error the VCC message with the failing line. As root it runs code of VCL and VMOD files writable by their owners |