Product docs

Account Switcher for WebCentral

在 Linux 上安装 Account Switcher

验证 tar 压缩包,安装 systemd 服务,配置 /etc/webcentral-switcher,并通过 nginx 发布这两个主机名。

Archibus 客户管理员Linux 服务器管理员

Last updated

在 Linux 上安装 Account Switcher

本指南介绍如何在使用 systemd 的 Linux 服务器上安装 Account Switcher for WebCentral。开始之前,请让您的 DBA 完成管理指南中的 SQL 步骤。您还需要许可证文件 account-switcher.ismlic 和 ISM 许可证公钥,二者均由 ISM 提供。

1. 检查并解压

从发布页面将 webcentral-switcher-<version>.tar.gz 和 SHA256SUMS 下载到同一个目录中。

sha256sum -c --ignore-missing SHA256SUMS
tar xzf webcentral-switcher-<version>.tar.gz
cd webcentral-switcher-<version>

2. 安装服务

sudo ./packaging/install.sh install

安装程序会将程序放入 /opt/webcentral-switcher-<version>,并让 /opt/webcentral-switcher 链接指向它。它会安装 webcentral-switcher.service systemd 单元(以 webcentral-switcher 用户身份运行),并创建状态目录 /var/lib/webcentral-switcher。它从不创建或覆盖配置。添加 --dry-run 可查看它将执行的操作。

3. 配置

将 config.example.json 复制到 /etc/webcentral-switcher/config.json 并编辑:

配置项用途
listen本地地址,例如 127.0.0.1:8443
tls_cert_file、tls_key_file用于网关连接的服务器证书
client_ca_file、proxy_cert_sha256网关客户端证书 CA 和固定的 SHA-256 值
admin_origin、impersonation_origin两个公开主机名,二者必须不同
admin_group允许使用 Account Switcher 的组
project_idWebCentral 项目,例如 HQ
webcentral_urlWebCentral 的专用地址
username_header、project_headerWebCentral 请求头登录所使用的标头名称
ism.account-switcher.licence.dir存放 account-switcher.ismlic 的目录
license_public_key_file、license_customer许可证验证密钥和客户绑定
policy_file角色允许列表,例如 /var/lib/webcentral-switcher/policy.json
kill_switch_file例如 /etc/webcentral-switcher/KILL-SWITCHING
logout_custody_file、logout_cleanup_grace_minutes上游注销跟踪
max_sessions_per_actor每位管理员的并发会话数

将 switcher_service 登录名的 SQL 连接字符串以 SWITCHER_SQLSERVER_DSN=... 的形式放入 /etc/webcentral-switcher/sql.env,文件权限设为 0600;systemd 单元会读取该文件。Account Switcher 始终会验证 SQL Server 的 TLS 证书。如果 SQL Server 使用的是私有 CA 签发的证书,请将该 CA 添加到系统信任存储中。

先检查,再启动:

/opt/webcentral-switcher/bin/check-setup -switcher-config /etc/webcentral-switcher/config.json -proxy-client-cert <gateway-cert.pem>
/opt/webcentral-switcher/bin/check-license -license /etc/webcentral-switcher/account-switcher.ismlic -public-key /etc/webcentral-switcher/ism-license-public.pem
sudo systemctl enable --now webcentral-switcher
sudo ./packaging/install.sh status

许可证:如果许可证缺失、无法读取、被篡改、已过期、属于其他产品或属于其他客户,服务将拒绝启动。它会记录一条明确的消息并以错误退出;请查看 journalctl -u webcentral-switcher。

健康检查(install.sh status --url https://admin.switcher.example.invalid,使用 switcher-health)要求管理员主机名可以解析,因此请在网关和 DNS 就绪(第 4 步)之后再运行。

4. 通过 nginx 发布

在经过身份验证的网关之后发布两个 HTTPS 主机名。请以 packaging/nginx.oauth2-proxy.example.conf(通过 oauth2-proxy 实现 OIDC)或 packaging/nginx.example.conf 为基础。网关必须移除浏览器发送的身份标头,X-Switcher-Actor、X-Switcher-Groups 和 X-Switcher-Project 各发送且仅发送一个,并使用在 proxy_cert_sha256 中固定的客户端证书进行连接。切勿直接暴露服务端口或 WebCentral 的专用端口。

紧急停止开关、升级与卸载

  • 立即停止切换:sudo touch /etc/webcentral-switcher/KILL-SWITCHING。删除该文件即可恢复。
  • 升级:备份 WebCentral 数据库(包括 switcher.audit),将 Account Switcher 从网关路由中摘除,然后运行较新安装包中的 sudo ./packaging/install.sh install。如需回滚,请让 /opt/webcentral-switcher 指向上一个版本并重启。切勿为撤销一次角色更改而还原整个数据库。
  • 卸载:sudo ./packaging/install.sh uninstall。/etc/webcentral-switcher、状态目录以及所有 SQL 对象(包括 switcher.audit)都会保留。

Done When

  • sha256sum -c 对该压缩包报告 OK。
  • systemctl status webcentral-switcher 显示服务处于 active 状态。
  • 两个主机名都只通过您经过身份验证的网关提供服务。