代码之家  ›  专栏  ›  技术社区  ›  SPagadala

在连接数据库的Springboot fat jar应用程序中,PROD数据库密码的标准是什么

  •  2
  • SPagadala  · 技术社区  · 7 年前

    我有一个连接到数据库的springboot应用程序,目前数据库密码在应用程序属性中是纯文本的。

    PROD环境中安全保护密码的标准是什么?

    如果应用程序密码位于作为JAR一部分内置的应用程序属性内,尤其是当应用程序处于活动状态时,如何更改数据库密码?

    1 回复  |  直到 7 年前
        1
  •  2
  •   glytching    7 年前

    jasypt Jasypt's Spring integration 或者这个 Jasypt Spring Boot Starter 将其连接到弹簧中。

    这将允许您定义加密的数据库密码属性,例如在 application.properties 例如

    db.password=ENC(.....)
    

    如果应用程序密码在应用程序属性内,如何更改数据库密码

    -Ddb.password='....'

    @PropertySources({
            @PropertySource(value = "classpath:/**.properties"),
            @PropertySource(value = "file:/some/external/directory/override.properties", ignoreResourceNotFound = true)
    })
    public class Application {
        // ...
    }  
    

    /some/external/directory/override.properties 并用 db.password=... 那个