{"id":381,"date":"2009-08-18T23:13:01","date_gmt":"2009-08-19T06:13:01","guid":{"rendered":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/2009\/08\/18\/encrypted-variables-in-pdi\/"},"modified":"2009-08-18T23:13:01","modified_gmt":"2009-08-19T06:13:01","slug":"encrypted-variables-in-pdi","status":"publish","type":"post","link":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/2009\/08\/18\/encrypted-variables-in-pdi\/","title":{"rendered":"Encrypted Variables in PDI"},"content":{"rendered":"<p>Every once in a while, I get to sound like a royal arse in front of a customer by saying something &#8220;I know&#8221; to be true about Pentaho that isn&#8217;t.&nbsp; Usually, this is a REALLY good thing because it&#8217;s usually some limitation, or Gotcha that existed in the product that has magically disappeared with the latest release.&nbsp; The danger of open source is that these things can change underneath you quickly, without any official fan fare and leave you looking like a total dolt at a customer site.&nbsp; Bad for consultants like me who are constantly having to keep up with <i>extraordinarily fast product development.<\/i>&nbsp; Good for customers because they get <i>extraordinarily fast product development.<br \/><\/i><br \/>One of these experiences, which I was absolutely THRILLED to look like a dolt about, was <\/p>\n<blockquote><p>&#8220;If you use variables for database connection information, the password will be clear text in kettle.properties.&#8221;&nbsp; <\/p><\/blockquote>\n<p>A huge issue for many security conscious institutions.&nbsp; Customers were faced with a choice: use variables which centrally manages the connection information to a database (good thing) but then the password is clear text (bad thing).&nbsp; No longer!<\/p>\n<p>Our good friend Sven quietly committed this little <a href=\"http:\/\/jira.pentaho.com\/browse\/PDI-665\">gem<\/a> nearly 18 months ago. It&#8217;s been in the product since 3.0.2!&nbsp; It allows encrypted variables to be decrypted in the password field for database connections. <\/p>\n<p>Let&#8217;s test it out&#8230; our goal here is to make sure we can get a string &#8220;Encrypted jasiodfjasodifjaosdifjaodfj&#8221; which is a simple encrypted version of the password to be set as a regular ole variable but then be used as the &#8220;password&#8221; of a database connection.<\/p>\n<p>We have a transformation that will set the variables, and then we&#8217;ll use that variable in the next transformation.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-content\/uploads\/2009\/08\/moz-screenshot-6.png\" alt=\"\" \/><\/p>\n<p>The first one sets the variable ${ENCRYPTED_PASSWORD} from a text file.&nbsp; This string would be &#8220;lifted&#8221; from a .ktr after having been saved that represents the encrypted password.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-content\/uploads\/2009\/08\/moz-screenshot-7.png\" alt=\"\" \/><\/p>\n<p>Then we use it in the next transformation and select from a database, and outputs the list of tables in the database to a text file.<br \/><img decoding=\"async\" src=\"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-content\/uploads\/2009\/08\/moz-screenshot-8.png\" alt=\"\" \/><\/p>\n<p>Output &#8211; works like a charm!&nbsp; <\/p>\n<p>Customers can now have the best of both worlds.&nbsp;&nbsp; Centralize their variables for host\/user\/password using variables (including, kettle.properties) and keep those passwords away from casual hackers.&nbsp; I say casual because PDI is open source so in order for someone to decrypted a password they only need know Java, and know where to find PDI SVN.&nbsp; \ud83d\ude42<\/p>\n<p>As always, example attached: <a href=\"\/entry_images\/encrypted_variables.zip\">encrypted_variables.zip<\/a><\/p>\n<p><\/p>\n<div class=\"zemanta-pixie\"><img decoding=\"async\" class=\"zemanta-pixie-img\" alt=\"\" src=\"http:\/\/img.zemanta.com\/pixy.gif?x-id=365405bf-198e-89c9-b389-5324d9ae8e79\" \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Every once in a while, I get to sound like a royal arse in front of a customer by saying something &#8220;I know&#8221; to be true about Pentaho that isn&#8217;t.&nbsp; Usually, this is a REALLY good thing because it&#8217;s usually some limitation, or Gotcha that existed in the product that has magically disappeared with the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/posts\/381"}],"collection":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/comments?post=381"}],"version-history":[{"count":0,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/posts\/381\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/media?parent=381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/categories?post=381"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/tags?post=381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}