IBM Liberty服务器 - 隐藏日志文件中的密码

时间:2016-08-29 18:40:06

标签: logging websphere-liberty

product = WebSphere Application Server 8.5.5.9 Liberty Profile

有谁知道如何在IBM WebSpere Liberty日志文件中隐藏密码?我想将当前的日志记录详细信息保留在AUDIT级别,但不希望在日志文件中显示密码值。

以下是我在日志文件中看到的内容。

[8/27/16 8:22:04:581 EDT] 00002603 SystemOut O url参数client_id = ro_app1& validator_id = CorpDirectory& username = user_id& password = my_password& grant_type = password

[8/27/16 8:22:05:299 EDT] 00002603 SystemOut O发布参数:client_id = ro_app1& validator_id = CorpDirectory& username = user_id& password = my_password& grant_type = password

my_password - 表示实际的用户密码。

以下是我记录属性的内容:

com.ibm.ws.logging.max.file.size=5
com.ibm.ws.logging.hideMessage=password
com.ibm.ws.logging.max.files=20
com.ibm.ws.logging.console.log.level=AUDIT
com.ibm.ws.logging.message.file.name=loggingMessages.log

提前感谢您提出任何建议。

2 个答案:

答案 0 :(得分:3)

com.ibm.ws.logging.hideMessage属性只能用于隐藏官方IBM消息密钥(例如SRVE0255E)。这不能用于隐藏日志中的任何字符串,因为这样做会严重影响性能。

此外,这些日志消息来自应用程序代码中的System.out.print语句。如果您不想打印密码,请不要在应用程序代码中打印出整个网址。

此外,在您的日志中显示的密码不是您首先将明文密码作为HTTP GET参数传递的事实

答案 1 :(得分:0)

IIRC(我最近没有尝试过,但我记得在代码上或附近工作),Liberty会在http访问日志中对GET参数中的密码进行模糊处理。我们不会分析所有系统输出调用以清除密码,因为这会对性能产生负面影响。正如@aguibert所说,这应该在应用程序级别进行管理。您可以尝试打开访问日志记录,这将允许您删除system.out。

http://www.ibm.com/support/knowledgecenter/SSD28V_8.5.5/com.ibm.websphere.wlp.core.doc/ae/rwlp_http_accesslogs.html