mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-21 10:27:14 +00:00
feat(nodes): opt-in encryption at rest for the outbound node API token (#6186)
* node: encrypt outbound bearer token at rest * fix(nodes): keep bearer tokens encrypted throughout --------- Co-authored-by: n0ctal <293235942+n0ctal@users.noreply.github.com>
This commit is contained in:
@@ -193,6 +193,27 @@ func GetDBDSN() string {
|
||||
return strings.TrimSpace(os.Getenv("XUI_DB_DSN"))
|
||||
}
|
||||
|
||||
// GetNodeTokenEncryptionMode returns off, migration, or required. Explicit
|
||||
// policy prevents a missing key from silently downgrading encrypted storage.
|
||||
func GetNodeTokenEncryptionMode() string {
|
||||
return strings.TrimSpace(os.Getenv("NODE_TOKEN_ENCRYPTION"))
|
||||
}
|
||||
|
||||
// GetNodeTokenKeyFile returns the mode-0600 keyring path, configurable through
|
||||
// XUI_NODE_TOKEN_KEY_FILE.
|
||||
func GetNodeTokenKeyFile() string {
|
||||
if p := strings.TrimSpace(os.Getenv("XUI_NODE_TOKEN_KEY_FILE")); p != "" {
|
||||
return p
|
||||
}
|
||||
return "/etc/x-ui/node_token_key.json"
|
||||
}
|
||||
|
||||
// GetNodeTokenKeyEnv returns the name of the env var holding a single base64
|
||||
// 32-byte node-token key (secondary to the key file). Empty value => unused.
|
||||
func GetNodeTokenKeyEnv() string {
|
||||
return "XUI_NODE_TOKEN_KEY"
|
||||
}
|
||||
|
||||
// GetEnvFilePaths returns the candidate service environment file paths (the file
|
||||
// systemd loads via EnvironmentFile) across the supported distro families.
|
||||
func GetEnvFilePaths() []string {
|
||||
|
||||
Reference in New Issue
Block a user