Harden config perms and key derivation #8

Merged
Ghost merged 1 commits from fix/teleport-4-hygiene into master 2026-08-31 23:27:14 -05:00

Closes #4

Harden low-severity config and key-derivation hygiene without rewriting the product.

  • Generated configs (--generate-config) are written mode 0600 (they embed a live encryption key).
  • New --generate-key / generated-config keys are raw: + 64 hex (32-byte AES-256, no PBKDF2). Unprefixed values (passphrases and hex strings from older --generate-key) still use PBKDF2 so existing configs keep working. Do not add raw: to an old hex string or strip it from a new one unless both sides are updated together.
  • ResolveKey runs once at process start; remaining UDP/handshake paths use the cached key. DeriveKey is also memoized so 100k PBKDF2 is not paid per packet.
  • keep_alive is applied to TCP tunnel and forwarded connections.
  • Skipped as they would expand this PR: DNS client ACL (DNS already defaults to loopback after #7), per-IP rate limit (documented as process-global).
Closes #4 Harden low-severity config and key-derivation hygiene without rewriting the product. - Generated configs (`--generate-config`) are written mode `0600` (they embed a live encryption key). - New `--generate-key` / generated-config keys are `raw:` + 64 hex (32-byte AES-256, no PBKDF2). Unprefixed values (passphrases and hex strings from older `--generate-key`) still use PBKDF2 so existing configs keep working. Do not add `raw:` to an old hex string or strip it from a new one unless both sides are updated together. - `ResolveKey` runs once at process start; remaining UDP/handshake paths use the cached key. `DeriveKey` is also memoized so 100k PBKDF2 is not paid per packet. - `keep_alive` is applied to TCP tunnel and forwarded connections. - Skipped as they would expand this PR: DNS client ACL (DNS already defaults to loopback after #7), per-IP rate limit (documented as process-global).
Ghost added 1 commit 2026-08-31 23:23:06 -05:00
Harden config perms and key derivation
CI / check-and-test (pull_request) Successful in 11s
bc486eb49d
Write generated configs 0600, treat new keys as raw AES-256, keep
PBKDF2 for unprefixed material, and cache derivation at startup.

Reviewed against #4.

0600 generated configs, raw: keys for new generate-key/config, unprefixed hex still PBKDF2 (tested), ResolveKey once at start plus DeriveKey cache, keep_alive actually applied. DNS ACL skip is acceptable after #7 loopback default; per-IP rate limit skip matches the issue (homelab, now documented). Merging.

Nit, not blocking: mustResolveKey logs and returns nil instead of failing construction. Don't ship a process that encrypts with a nil key if LoadConfig is ever bypassed.

Reviewed against #4. 0600 generated configs, `raw:` keys for new generate-key/config, unprefixed hex still PBKDF2 (tested), ResolveKey once at start plus DeriveKey cache, keep_alive actually applied. DNS ACL skip is acceptable after #7 loopback default; per-IP rate limit skip matches the issue (homelab, now documented). Merging. Nit, not blocking: `mustResolveKey` logs and returns nil instead of failing construction. Don't ship a process that encrypts with a nil key if LoadConfig is ever bypassed.
Ghost merged commit 1d8384c0f9 into master 2026-08-31 23:27:14 -05:00
Sign in to join this conversation.