简体   繁体   English

Tomcat JDBC(数据源)密码加解密

[英]Tomcat JDBC (Datasource) password encryption and decryption

I have some concerns on Tomcat JDBC password encryption and decryption.我对Tomcat JDBC密码加解密有些顾虑。

As I know, normally, we set datasource on tomcat like below.据我所知,通常情况下,我们在 tomcat 上设置数据源,如下所示。

<Resource name="jdbc/MyDB"
      factory="nl.wimvanhaaren.tomcat.secured.EncryptedDataSourceFactory"
      secretKey="secretKeyId"
      auth="Container"
      type="javax.sql.DataSource"
      maxActive="100"
      maxIdle="30"
      maxWait="10000"
      username="databaseUser"
      password="dd30b6e87a972be1999fda04f657eca0"
      driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
      url="jdbc:sqlserver://localhost:1433;databaseName=MyDB"/>

Or we set secretKey on DataSourceFactory jar file.或者我们在 DataSourceFactory jar 文件上设置 secretKey。

In my understanding, in those cases, people who can access to the server can extract the actual password through:据我了解,在这些情况下,可以访问服务器的人可以通过以下方式提取实际密码:

  1. decrypting using jar file with the "secretkey" from the tomcat config file, or使用 jar 文件和 tomcat 配置文件中的“密钥”进行解密,或
  2. decrypting using jar file which already includes "secretkey" inside the jar file.使用 jar 文件进行解密,该文件已在 jar 文件中包含“密钥”。

IBM WebSphere has masking feature when inserting DB password, so no-one can see the password after insert by Security Team. IBM WebSphere 在插入数据库密码时具有屏蔽功能,因此安全团队插入后没有人可以看到密码。 Is there any way to do this on Tomcat?有什么办法可以在 Tomcat 上做到这一点? I need to use tomcat on Azure instead of on-prem WebSphere from now on(Migration) but couldn't find and answers or contents related to this on google.从现在开始(迁移),我需要在 Azure 上使用 tomcat 而不是本地 WebSphere(迁移),但在谷歌上找不到与此相关的答案或内容。 Please help~!请帮忙~!

Thanks in advance.提前致谢。

IBM WebSphere has masking feature when inserting DB password, so no-one can see the password after insert by Security Team IBM WebSphere在插入数据库密码时具有屏蔽功能,因此安全团队插入后没有人可以看到密码

It principially works the same way as in Tomcat, just WS has less documented how is the password encrypted.它的工作原理与 Tomcat 中的工作方式相同,只是 WS 很少记录密码是如何加密的。 If you take the stored db password, library used to encrypt /decrypt the password and the master password/key (all stored in the filesystem), then someone having access to the server could as well decrypt the DB password on WS too.如果您使用存储的数据库密码、用于加密/解密密码的库和主密码/密钥(都存储在文件系统中),那么有权访问服务器的人也可以解密 WS 上的数据库密码。 The process is just less trasparent.这个过程只是不那么透明。

It is principally so, as soons as some system needs to decrypt and use some data, the key needs to be at hand (or credentials and parameters to get the key).原则上是这样,一旦某个系统需要解密和使用某些数据,就需要手头有密钥(或获取密钥的凭证和参数)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM