Repository: cloudstack Updated Branches: refs/heads/4.4 28ff60e74 -> 94cad49e0
CLOUDSTACK-8070: during 4.4.2 to 4.4.3 upgrade encrypt config that are hidden In case there is an encryption key/password is provided the value, specifically for router.ram.size will be encrypted otherwise it will remain plain text. Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/94cad49e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/94cad49e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/94cad49e Branch: refs/heads/4.4 Commit: 94cad49e07d45c7e252fbe9f35e4fab8e543c259 Parents: 28ff60e Author: Rohit Yadav <[email protected]> Authored: Fri Dec 12 20:43:02 2014 +0530 Committer: Rohit Yadav <[email protected]> Committed: Fri Dec 12 20:43:53 2014 +0530 ---------------------------------------------------------------------- engine/schema/src/com/cloud/upgrade/dao/Upgrade442to443.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94cad49e/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to443.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to443.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to443.java index 2855538..864c7ae 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to443.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to443.java @@ -18,11 +18,13 @@ package com.cloud.upgrade.dao; import java.io.File; +import java.io.UnsupportedEncodingException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import com.cloud.utils.crypt.DBEncryptionUtil; import org.apache.log4j.Logger; import com.cloud.utils.exception.CloudRuntimeException; @@ -66,10 +68,14 @@ public class Upgrade442to443 implements DbUpgrade { private void updateMaxRouterSizeConfig(Connection conn) { PreparedStatement updatePstmt = null; try { - updatePstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value='256' WHERE name='router.ram.size'"); + String encryptedValue = DBEncryptionUtil.encrypt("256"); + updatePstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value=? WHERE name='router.ram.size' AND category='Hidden'); + updatePstmt.setBytes(1, encryptedValue.getBytes("UTF-8")); updatePstmt.executeUpdate(); } catch (SQLException e) { throw new CloudRuntimeException("Unable to upgrade max ram size of router in config.", e); + } catch (UnsupportedEncodingException e) { + throw new CloudRuntimeException("Unable encrypt configuration values ", e); } finally { try { if (updatePstmt != null) {
