问题现象
登录 OMS Web 页面时遇到了报错:密码已过期,当前用户角色:{omsUserRole} ,请联系更高权限用户协助修改密码。

问题原因
该 OMS 账号长时间未曾登录使用或未曾修改密码,导致密码过期了。 OMS 默认的账号密码过期策略保存在 OMS 的元数据库中。
[root@oms-server ~]# mysql -h127.0.0.1 -P2881 -uroot@oms_meta -pxxx -A -c
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221551691
Server version: OceanBase 2.2.77 (r20211210235205-46f61a1b0a27dfa2ea1f65366cbedd77e5c4e785) (Built Dec 11 2021 00:24:34)
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> use oms_rm;
Database changed
MySQL [oms_rm]> SELECT id,cfg_name,cfg_value,cfg_type,cfg_status,cfg_desc,gmt_create,gmt_modified FROM oms_normal_config WHERE cfg_name = 'oms.user.password.expiration.date.config'\G
*************************** 1. row ***************************
id: 1643840479629991939
cfg_name: oms.user.password.expiration.date.config
cfg_value: {"rootRolePasswordValidityDays":90,"rootViewerRolePasswordValidityDays":90,"adminRolePasswordValidityDays":90,"adminViewerRolePasswordValidityDays":90,"userRolePasswordValidityDays":90,"userPasswordValidityDaysTipsThreshold":30}
cfg_type: struct
cfg_status: 1
cfg_desc: oms.user.password.expiration.date.config
gmt_create: 2023-04-06 12:58:06
gmt_modified: 2023-04-06 12:58:06
1 row in set (0.003 sec)
rootRolePasswordValidityDays: 用户 ROOT 角色密码有效期(天)【默认 90 天】。
rootViewerRolePasswordValidityDays: 用户 ROOT_VIEWER 角色密码有效期(天)【默认 90 天】。
adminRolePasswordValidityDays: 用户 ADMIN 角色密码有效期(天)【默认 90 天】。
adminViewerRolePasswordValidityDays: 用户 ADMIN_VIEWER 角色密码有效期(天)【默认 90 天】。
userRolePasswordValidityDays: 用户 USER 角色密码有效期(天)【默认 90 天】。
userPasswordValidityDaysTipsThreshold: 用户密码有效期剩余多少天开始提示【默认 30 天】。
问题的风险及影响
OMS 登录失败。
适用版本
OMS 所有版本。
解决方法
登录到 OMS 元数据库(需要系统管理员权限),强制更新对应账号的密码修改时间 gmt_password_modified。
[root@oms-server ~]# mysql -h127.0.0.1 -P2881 -uroot@oms_meta -pxxx -A -c
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221511773
Server version: OceanBase 2.2.77 (r20211210235205-46f61a1b0a27dfa2ea1f65366cbedd77e5c4e785) (Built Dec 11 2021 00:24:34)
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> use oms_rm;
Database changed
MySQL [oms_rm]> desc oms_user;
+-----------------------+--------------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+--------------+------+-----+-------------------+-------+
| id | varchar(512) | NO | PRI | NULL | |
| name | varchar(512) | NO | UNI | NULL | |
| password | varchar(512) | NO | | NULL | |
| role | varchar(64) | NO | | NULL | |
| authority | varchar(512) | YES | | NULL | |
| email | varchar(256) | YES | | NULL | |
| phone | varchar(256) | YES | | NULL | |
| department_id | varchar(32) | NO | MUL | | |
| department | varchar(512) | YES | | NULL | |
| comment | varchar(512) | YES | | NULL | |
| gmt_user_create | timestamp | NO | | CURRENT_TIMESTAMP | |
| gmt_password_modified | timestamp | NO | | CURRENT_TIMESTAMP | |
| gmt_login_success | timestamp | YES | | NULL | |
| gmt_login_failure | timestamp | YES | | NULL | |
| login_failure_times | int(11) | NO | | 0 | |
| is_locked | tinyint(4) | NO | | 0 | |
+-----------------------+--------------+------+-----+-------------------+-------+
16 rows in set (0.004 sec)
MySQL [oms_rm]> select * from oms_user where name='admin'\G
*************************** 1. row ***************************
id: u00001
name: admin
password: ************************
role: ADMIN
authority: NULL
email: NULL
phone: NULL
department_id: 0
department: NULL
comment: NULL
gmt_user_create: 2023-04-06 12:49:06
gmt_password_modified: 2025-01-25 17:07:26
gmt_login_success: 2025-01-25 17:07:02
gmt_login_failure: 2025-01-25 17:06:58
login_failure_times: 0
is_locked: 0
1 row in set (0.002 sec)
MySQL [oms_rm]> update oms_user set gmt_password_modified=current_timestamp where name='admin';
Query OK, 1 row affected (0.002 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MySQL [oms_rm]> select * from oms_user where name='admin'\G
*************************** 1. row ***************************
id: u00001
name: admin
password: ************************
role: ADMIN
authority: NULL
email: NULL
phone: NULL
department_id: 0
department: NULL
comment: NULL
gmt_user_create: 2023-04-06 12:49:06
gmt_password_modified: 2025-07-03 21:02:56
gmt_login_success: 2025-01-25 17:07:02
gmt_login_failure: 2025-01-25 17:06:58
login_failure_times: 0
is_locked: 0
1 row in set (0.001 sec)
MySQL [oms_rm]> Bye
规避方式
无。