Skip to content

Commit 468b7e4

Browse files
authored
docs: harden secret-handling and service exposure guidance (#3)
Security-doc pass across setup, LightRAG, Telegram, custom models, and gateway recovery docs. Replaces shell-history-leaking secret setup examples with editor/hermes auth guidance, reinforces chmod 600 on .env files, strengthens LightRAG localhost-only warning, avoids printing full Telegram tokens, and clarifies localhost-only gateway health checks. Verified config.yaml \ expansion against Hermes config loader _expand_env_vars().
1 parent 03a7eee commit 468b7e4

6 files changed

Lines changed: 32 additions & 13 deletions

File tree

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,13 @@ hermes auth
367367
368368
This opens an interactive menu to add API keys for each provider. Keys are stored in `~/.hermes/.env` — never committed to git.
369369
370-
> **Tip:** You can also set keys manually:
370+
> **Tip:** You can also set keys manually using a text editor:
371371
> ```bash
372-
> echo "ANTHROPIC_API_KEY=<your-key-here>" >> ~/.hermes/.env
372+
> nano ~/.hermes/.env # Add: ANTHROPIC_API_KEY=<your-key-here>
373373
> chmod 600 ~/.hermes/.env # Restrict access to your user only
374374
> ```
375375
>
376-
> **Important:** Always run `chmod 600 ~/.hermes/.env` to prevent other users on the system from reading your API keys.
376+
> **Avoid using `echo` to append secrets** — the command (including the key) is saved in your shell history (`~/.bash_history`). Use an editor or `hermes auth` instead. Always run `chmod 600 ~/.hermes/.env` to prevent other users on the system from reading your API keys.
377377
378378
### 3. Configure Toolsets
379379
@@ -524,6 +524,11 @@ Everything lives under `~/.hermes/`:
524524
525525
> **Important:** `SOUL.md` is injected into every message. Keep it under 1 KB. Every byte costs latency and tokens.
526526
527+
> **Security:** The `.env` file contains your API keys. Restrict its permissions so only you can read it:
528+
> ```bash
529+
> chmod 600 ~/.hermes/.env
530+
> ```
531+
527532
---
528533
529534
## Verify Your Setup
@@ -856,7 +861,7 @@ The server starts on `http://localhost:9623` with:
856861
- **Web UI** at `http://localhost:9623/webui` for browsing the knowledge graph
857862
- **Health check** at `http://localhost:9623/health`
858863
859-
> **Security warning:** The LightRAG REST API has **no built-in authentication**. Always bind to `127.0.0.1` (localhost only) — never `0.0.0.0`. If you need remote access, put it behind a reverse proxy (nginx, Caddy) with authentication, or use SSH tunneling. Anyone who can reach this port can query, ingest, or delete your knowledge graph data.
864+
> **Security warning:** The LightRAG REST API has **no built-in authentication**. Always bind to `127.0.0.1` (localhost only) — never `0.0.0.0`. If you need remote access, put it behind a reverse proxy (nginx, Caddy) with authentication, or use SSH tunneling / Tailscale / WireGuard. Anyone who can reach this port can query, ingest, or delete your entire knowledge graph.
860865
861866
### Run as a Background Service
862867
@@ -1402,7 +1407,7 @@ Each user gets their own conversation session. The bot tracks sessions per user
14021407
14031408
### Bot not responding
14041409
1405-
1. Check the token is correct: `echo $TELEGRAM_BOT_TOKEN`
1410+
1. Check the token is set (without printing it in full): `echo ${TELEGRAM_BOT_TOKEN:0:10}...`
14061411
2. Verify the gateway is running: `hermes gateway status`
14071412
3. Check logs: `hermes gateway logs`
14081413

part1-setup.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ hermes auth
8282

8383
This opens an interactive menu to add API keys for each provider. Keys are stored in `~/.hermes/.env` — never committed to git.
8484

85-
> **Tip:** You can also set keys manually:
85+
> **Tip:** You can also set keys manually using a text editor:
8686
> ```bash
87-
> echo "ANTHROPIC_API_KEY=<your-key-here>" >> ~/.hermes/.env
87+
> nano ~/.hermes/.env # Add: ANTHROPIC_API_KEY=<your-key-here>
8888
> chmod 600 ~/.hermes/.env # Restrict access to your user only
8989
> ```
9090
>
91-
> **Important:** Always run `chmod 600 ~/.hermes/.env` to prevent other users on the system from reading your API keys.
91+
> **Avoid using `echo` to append secrets** — the command (including the key) is saved in your shell history (`~/.bash_history`). Use an editor or `hermes auth` instead. Always run `chmod 600 ~/.hermes/.env` to prevent other users on the system from reading your API keys.
9292
9393
### 3. Configure Toolsets
9494
@@ -168,6 +168,11 @@ Everything lives under `~/.hermes/`:
168168

169169
> **Important:** `SOUL.md` is injected into every message. Keep it under 1 KB. Every byte costs latency and tokens.
170170
171+
> **Security:** The `.env` file contains your API keys. Restrict its permissions so only you can read it:
172+
> ```bash
173+
> chmod 600 ~/.hermes/.env
174+
> ```
175+
171176
---
172177
173178
## Verify Your Setup

part11-gateway-recovery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ if ! pgrep -f "hermes.*gateway" > /dev/null; then
180180
exit 1
181181
fi
182182

183-
# Can we reach the API?
183+
# Can we reach the API? (gateway should only listen on localhost)
184184
if ! curl -s http://localhost:8642/health > /dev/null 2>&1; then
185185
echo "CRITICAL: Gateway not responding"
186186
exit 1

part3-lightrag-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ The server starts on `http://localhost:9623` with:
110110
- **Web UI** at `http://localhost:9623/webui` for browsing the knowledge graph
111111
- **Health check** at `http://localhost:9623/health`
112112

113-
> **Security warning:** The LightRAG REST API has **no built-in authentication**. Always bind to `127.0.0.1` (localhost only) — never `0.0.0.0`. If you need remote access, put it behind a reverse proxy (nginx, Caddy) with authentication, or use SSH tunneling. Anyone who can reach this port can query, ingest, or delete your knowledge graph data.
113+
> **Security warning:** The LightRAG REST API has **no built-in authentication**. Always bind to `127.0.0.1` (localhost only) — never `0.0.0.0`. If you need remote access, put it behind a reverse proxy (nginx, Caddy) with authentication, or use SSH tunneling / Tailscale / WireGuard. Anyone who can reach this port can query, ingest, or delete your entire knowledge graph.
114114
115115
### Run as a Background Service
116116

part4-telegram-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Each user gets their own conversation session. The bot tracks sessions per user
254254

255255
### Bot not responding
256256

257-
1. Check the token is correct: `echo $TELEGRAM_BOT_TOKEN`
257+
1. Check the token is set (without printing it in full): `echo ${TELEGRAM_BOT_TOKEN:0:10}...`
258258
2. Verify the gateway is running: `hermes gateway status`
259259
3. Check logs: `hermes gateway logs`
260260

part9-custom-models.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,20 @@ tts:
154154

155155
Models are configured in `~/.hermes/config.yaml`:
156156

157-
> **Security note:** Never put real API keys directly in `config.yaml`. Use environment variable references so keys stay in `~/.hermes/.env` (which should be `chmod 600` and never committed to git).
158-
157+
> **Security note:** Never put real API keys directly in `config.yaml`. Use environment variable references so keys stay in `~/.hermes/.env` (which should be `chmod 600` and never committed to git). You can also use `hermes auth` to set them securely.
159158
```yaml
160159
# Default model
161160
model: claude-sonnet-5
162161
provider: anthropic
163162
164163
# Provider configurations
164+
# API keys are loaded from ~/.hermes/.env automatically.
165+
# Set them with: hermes auth
166+
# Or add to ~/.hermes/.env:
167+
# ANTHROPIC_API_KEY=sk-ant-...
168+
# OPENAI_API_KEY=sk-...
169+
# CEREBRAS_API_KEY=csk-...
170+
# FIREWORKS_API_KEY=fw_...
165171
providers:
166172
anthropic:
167173
api_key: ${ANTHROPIC_API_KEY}
@@ -226,6 +232,8 @@ providers:
226232
Any provider that implements the OpenAI chat completions API works:
227233

228234
```yaml
235+
# Add your API key to ~/.hermes/.env:
236+
# MY_CUSTOM_API_KEY=your-key-here
229237
providers:
230238
my-custom:
231239
api_key: ${MY_CUSTOM_API_KEY}
@@ -312,6 +320,7 @@ Cerebras is fast but has quirks:
312320
Config:
313321

314322
```yaml
323+
# Set CEREBRAS_API_KEY in ~/.hermes/.env
315324
providers:
316325
cerebras:
317326
api_key: ${CEREBRAS_API_KEY}

0 commit comments

Comments
 (0)