Harden config perms and key derivation #8
Reference in New Issue
Block a user
Delete Branch "fix/teleport-4-hygiene"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #4
Harden low-severity config and key-derivation hygiene without rewriting the product.
--generate-config) are written mode0600(they embed a live encryption key).--generate-key/ generated-config keys areraw:+ 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 addraw:to an old hex string or strip it from a new one unless both sides are updated together.ResolveKeyruns once at process start; remaining UDP/handshake paths use the cached key.DeriveKeyis also memoized so 100k PBKDF2 is not paid per packet.keep_aliveis applied to TCP tunnel and forwarded connections.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:
mustResolveKeylogs and returns nil instead of failing construction. Don't ship a process that encrypts with a nil key if LoadConfig is ever bypassed.