AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
docs(air-gapped): stop handing off through a filesystem path — verify and install in one block
xerj-org68ee99fd3727
diff --git a/docs/recipes/air-gapped-deployment.md b/docs/recipes/air-gapped-deployment.mdindex 2c2839b51..37968fb91 100644--- a/docs/recipes/air-gapped-deployment.md+++ b/docs/recipes/air-gapped-deployment.md@@ -119,9 +119,14 @@ ASSET="${STAGE}.tar.gz"tar -xzf "$ASSET" -C "$work"test -x "$work/$STAGE/xerj"- rm -rf "$STAGE.verified.$want"- mv -T "$work/$STAGE" "$STAGE.verified.$want"- echo "verified $ASSET -> $STAGE.verified.$want"+ if ! getent passwd xerj >/dev/null; then+ sudo useradd --system --user-group --home-dir /var/lib/xerj \+ --shell /sbin/nologin xerj+ fi+ sudo install -d -m 0755 /opt/xerj/bin /etc/xerj+ sudo install -d -o xerj -g xerj -m 0750 /var/lib/xerj+ sudo install -m 0755 "$work/$STAGE/xerj" /opt/xerj/bin/xerj+ echo "installed $ASSET ($want)")```@@ -162,27 +167,12 @@ directory — survived and was installed. Clearing the install path beforeanything else is what makes "nothing to install" the default rather than aconsequence.-## 2. Install the base lexical node--The account and directories below are an example of the required ownership;-use the equivalent account-management command on the target Linux image. No-model directory is created for the lexical deployment.+## 2. Configure the base lexical node-```bash-set -eu--: "${STAGE:?run section 1 in this shell first}"-: "${ASSET:?run section 1 in this shell first}"-if ! getent passwd xerj >/dev/null; then- sudo useradd --system --user-group --home-dir /var/lib/xerj --shell /sbin/nologin xerj-fi-sudo install -d -m 0755 /opt/xerj/bin /etc/xerj-sudo install -d -o xerj -g xerj -m 0750 /var/lib/xerj-sudo install -m 0755 \- "/opt/xerj-staging/release/${STAGE}.verified.$(cd /opt/xerj-staging/release \- && sha256sum "$ASSET" | cut -d ' ' -f 1)/xerj" \- /opt/xerj/bin/xerj-```+The account and directories are created by the block above, alongside the+install; the ownership shown there is an example, so use the equivalent+account-management command on the target Linux image. No model directory is+created for the lexical deployment.Create `/etc/xerj/xerj.toml` with the complete base configuration. Explicitlyselecting lexical mode and an empty endpoint prevents an accidental proxy or@@ -240,16 +230,28 @@ installing anything — the same fail-closed rule as section 1, and the reasonthe check is a command here rather than a sentence:```bash-set -eu-(+ set -eucd /opt/xerj-staging/model/all-MiniLM-L6-v2- sha256sum -c ../model.sha256++ for f in config.json tokenizer.json model.safetensors; do+ want="$(sha256sum "$f" | cut -d ' ' -f 1)"+ if [[ ! "$want" =~ ^[0-9a-f]{64}$ ]]; then+ echo "could not compute a digest for $f" >&2+ exit 1+ fi+ LC_ALL=C grep -qxF -e "$want $f" -e "$want *$f" \+ < <(tr -d '\r' < ../model.sha256)+ done)```-`model.sha256` names all three files, so a transfer that dropped or truncated-one fails this check rather than installing a partial model. Then install the+The same shape as section 1, and for the same reason: `model.sha256` crossed the+airgap on the same medium as the files it describes, so `sha256sum -c` reading+filenames out of it would verify whatever it happened to name. Each digest is+computed here and the file is searched for that exact line, and every one of the+three must be found — a transfer that dropped or truncated one fails rather than+installing a partial model. Then install thefiles and change only the embedding block:```bashdiff --git a/landing/docs/recipes/air-gapped-deployment.html b/landing/docs/recipes/air-gapped-deployment.htmlindex 009f60819..400b92e19 100644--- a/landing/docs/recipes/air-gapped-deployment.html+++ b/landing/docs/recipes/air-gapped-deployment.html@@ -122,27 +122,19 @@ ASSET="${STAGE}.tar.gz"tar -xzf "$ASSET" -C "$work"test -x "$work/$STAGE/xerj"- rm -rf "$STAGE.verified.$want"- mv -T "$work/$STAGE" "$STAGE.verified.$want"- echo "verified $ASSET -> $STAGE.verified.$want"+ if ! getent passwd xerj >/dev/null; then+ sudo useradd --system --user-group --home-dir /var/lib/xerj \+ --shell /sbin/nologin xerj+ fi+ sudo install -d -m 0755 /opt/xerj/bin /etc/xerj+ sudo install -d -o xerj -g xerj -m 0750 /var/lib/xerj+ sudo install -m 0755 "$work/$STAGE/xerj" /opt/xerj/bin/xerj+ echo "installed $ASSET ($want)")</pre><p>Three details are load-bearing, and each replaces something that looked right and was not. <strong>The digest is computed here and the file is searched for it, not the other way round</strong> — <code class="inline">sha256sum -c</code> reads the filename out of the <code class="inline">.sha256</code>, a file that crossed the airgap on the same medium as the archive, skips <code class="inline">#</code> comments silently, and exits <code class="inline">0</code> if any one line verified, so a decoy digest plus a comment naming the archive passes while the archive is never hashed. Filtering that file first does not fix it: <code class="inline">awk '$2 == asset'</code> compares one token while <code class="inline">sha256sum</code> takes the whole rest of the line as the filename, so a line naming <code class="inline">$ASSET decoy</code> satisfies the filter and hashes a decoy. Building the expected line in the shell and demanding it with <code class="inline">grep -qxF</code> removes the disagreement. The two patterns accept GNU text mode and <code class="inline">-b</code> binary mode; <code class="inline">tr -d '\r'</code> accepts a checksum file written on Windows. <strong><code class="inline">set -eu</code> is inside the subshell</strong> — at the top of the block it kills the operator’s login shell on a bad digest, and the natural recovery is to re-paste without it, which is the fail-open form. <strong>Section 2 installs from <code class="inline">$STAGE.verified</code></strong>, which <code class="inline">mv</code> creates only after the digest, the extraction and <code class="inline">test -x</code> have all succeeded — so the block is safe even when its exit status is ignored, because on any failure there is nothing at the install path. That last part is only true because <code class="inline">rm -rf</code> runs <strong>first</strong>: placed after the digest check it is unreachable on exactly the failure that matters, and a <code class="inline">$STAGE.verified</code> left by an earlier run — or planted by anyone who can write to the staging directory — would survive and be installed.</p>- <h2>2. Install the base lexical node</h2>+ <h2>2. Configure the base lexical node</h2><p>Create the service account first, then install only the staged binary. No model directory is needed for lexical mode:</p>-<pre class="code">set -eu--: "${STAGE:?run section 1 in this shell first}"-: "${ASSET:?run section 1 in this shell first}"-if ! getent passwd xerj >/dev/null; then- sudo useradd --system --user-group --home-dir /var/lib/xerj --shell /sbin/nologin xerj-fi-sudo install -d -m 0755 /opt/xerj/bin /etc/xerj-sudo install -d -o xerj -g xerj -m 0750 /var/lib/xerj-sudo install -m 0755 \- "/opt/xerj-staging/release/${STAGE}.verified.$(cd /opt/xerj-staging/release \- && sha256sum "$ASSET" | cut -d ' ' -f 1)/xerj" \- /opt/xerj/bin/xerj</pre><p>Create <code class="inline">/etc/xerj/xerj.toml</code> with the complete base configuration. Explicit lexical mode and an empty endpoint keep this path model-free:</p><pre class="code">[server]bind_address = "127.0.0.1"@@ -175,11 +167,19 @@ donesha256sum config.json tokenizer.json model.safetensors > ../model.sha256)</pre><p>Transfer <code class="inline">OUT/model</code> with the release. Verify it inside the enclave before installing anything — the same fail-closed rule as section 1, and the reason the check is a command here rather than a sentence:</p>-<pre class="code">set -eu--(+<pre class="code">(+ set -eucd /opt/xerj-staging/model/all-MiniLM-L6-v2- sha256sum -c ../model.sha256++ for f in config.json tokenizer.json model.safetensors; do+ want="$(sha256sum "$f" | cut -d ' ' -f 1)"+ if [[ ! "$want" =~ ^[0-9a-f]{64}$ ]]; then+ echo "could not compute a digest for $f" >&2+ exit 1+ fi+ LC_ALL=C grep -qxF -e "$want $f" -e "$want *$f" \+ < <(tr -d '\r' < ../model.sha256)+ done)</pre><p><code class="inline">model.sha256</code> names all three files, so a transfer that dropped or truncated one fails this check rather than installing a partial model. Then install the files:</p><pre class="code">set -eu