Files
usernode/config.example.toml

58 lines
2.6 KiB
TOML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ws_usernode 服务器用户管理节点 —— 配置示例
# 复制为 config.toml 后按需修改;敏感项(SMTP 密码)建议通过环境变量覆盖:
# USERNODE_SMTP_PASSWORD=xxx
# 环境变量覆盖规则:USERNODE_<SECTION>_<FIELD>(字段名 camelCase 转大写蛇形;
# 连续大写缩写按一个词处理),例如 USERNODE_DATABASE_DSN、
# USERNODE_POLICY_OTPTTL、USERNODE_POLICY_DEFAULT_TTL。
[app]
name = "ws_usernode"
env = "development" # development / production
base_url = "http://127.0.0.1:8080" # 对外访问地址(邮件重置链接等)
[server]
listen = "127.0.0.1:8080" # 生产建议 0.0.0.0:8080 并置于反向代理后
session_ttl = "24h" # cookie 会话时长
trusted_proxies = ["127.0.0.1", "::1"]
[database]
driver = "sqlite" # sqlite(开发)/ mysql(生产)
dsn = "data/usernode.db" # sqlite 文件路径;mysql 形如
# usernode:pass@tcp(127.0.0.1:3306)/usernode?charset=utf8mb4&parseTime=True&loc=UTC
[log]
level = "info" # debug / info / warn / error
format = "text" # text / json
[policy]
default_ttl = "2160h" # 新账号默认有效期 90 天(可被管理员创建/延期时覆盖)
recycle_period = "720h" # 到期后回收期 30 天,期内可延期恢复
audit_retention = "720h" # 审计保留 30 天,保留前先归档
otp_ttl = "10m" # OTP 验证码有效期
otp_cooldown = "60s" # OTP 发送冷却
[auth]
max_login_failures = 5 # 管理员登录连续失败阈值,达到后锁定
lock_duration = "15m" # 锁定持续时间
captcha_ttl = "5m" # 图形验证码有效期
[smtp]
host = "" # 留空则禁用邮件(OTP 仍可用 CLI 通道获取)
port = 587
username = ""
password = ""
from = "usernode@example.com"
[system]
sudo = false # 生产 true:经 sudo -n 执行白名单命令(账号生命周期 + authorized_keys 同步,需 deploy/sudoers
dry_run = true # 开发演练 true:只打印计划命令不执行;false 且 sudo=false 时直接执行(容器/测试用户验证)
user_prefix = "ext_" # 外部用户系统账号统一前缀
group = "external" # 外部用户统一组
shell = "/bin/sh" # 默认 shell
home_base = "/home" # 家目录基路径
authorized_keys_dir = ".ssh" # authorized_keys 所在目录名
[audit]
archive_dir = "" # 审计每日归档目录(M4):留空 = 不归档也不自动清理(防丢审计);
# 生产建议如 /var/lib/usernode/audit_archive,超期审计先归档再清理