Top Banner
Verschlüsselte Properties für Liquibase JUG Saxony Happy Hour 06. Dezember 2012 Montag, 10. Dezember 12
18

Verschlüsselte Properties in Liquibase

Jun 27, 2015

Download

Documents

Dominik Hirt
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Verschlüsselte Properties in Liquibase

Verschlüsselte Propertiesfür Liquibase

JUG Saxony Happy Hour 06. Dezember 2012

Montag, 10. Dezember 12

Page 2: Verschlüsselte Properties in Liquibase

Dominik Hirt

Montag, 10. Dezember 12

Page 3: Verschlüsselte Properties in Liquibase

http://www.efinia.de

Montag, 10. Dezember 12

Page 4: Verschlüsselte Properties in Liquibase

Personal Finance Management

Montag, 10. Dezember 12

Page 5: Verschlüsselte Properties in Liquibase

Montag, 10. Dezember 12

Page 6: Verschlüsselte Properties in Liquibase

Problem

driver: org.postgresql.Driverurl: jdbc:postgresql://localhost:5432/efiniausername: dbUserpassword: superGeheim42!

liquibase.properties | defaultsFile

Montag, 10. Dezember 12

Page 7: Verschlüsselte Properties in Liquibase

#epicfail

Montag, 10. Dezember 12

Page 8: Verschlüsselte Properties in Liquibase

Ursache

property member

liquibase.integration.commandline.Main.parsePropertiesFile

Montag, 10. Dezember 12

Page 9: Verschlüsselte Properties in Liquibase

Lösung

+

Montag, 10. Dezember 12

Page 10: Verschlüsselte Properties in Liquibase

+

Encrypting application

configurationfiles

Advanced configuration

Lösung

Montag, 10. Dezember 12

Page 11: Verschlüsselte Properties in Liquibase

+

Encrypting application

configurationfiles

Advanced configuration

Montag, 10. Dezember 12

Page 12: Verschlüsselte Properties in Liquibase

enc. property decrypt member

password

Montag, 10. Dezember 12

Page 13: Verschlüsselte Properties in Liquibase

Lösung

EnvironmentStringPBEConfig pbeConfig = new EnvironmentStringPBEConfig();pbeConfig.setPasswordEnvName(pbeVariable);

StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();encryptor.setConfig(pbeConfig);

EncryptableProperties props = new EncryptableProperties(encryptor);props.load(propertiesInputStream);

if (value.startsWith("ENC")) { String env = System.getenv(pbeVariable); if (env == null || env.equals("")) { throw new RuntimeException("Unknown " + pbeVariable); } else { value = props.getProperty((String)entry.getKey()); }}

Montag, 10. Dezember 12

Page 14: Verschlüsselte Properties in Liquibase

Vorher

Nachher

driver: org.postgresql.Driverurl: jdbc:postgresql://localhost:5432/efiniausername: dbUserpassword: superGeheim42!

driver: org.postgresql.Driverurl: jdbc:postgresql://localhost:5432/efiniausername: dbUserpassword: ENC(23cdFlcaHt54dZHP1o1TBw6aqTVw4)

Montag, 10. Dezember 12

Page 15: Verschlüsselte Properties in Liquibase

Don‘t repeat yourself

liquibase-core

liquibase.integration.commandline.Main.parsePropertiesFile

liquibase-maven-plugin

org.liquibase.maven.plugins.AbstractLiquibaseMojo.parsePropertiesFile

Montag, 10. Dezember 12

Page 16: Verschlüsselte Properties in Liquibase

https://github.com/dominik42/liquibase

Montag, 10. Dezember 12

Page 18: Verschlüsselte Properties in Liquibase

Montag, 10. Dezember 12