File tree Expand file tree Collapse file tree
framework/config/src/org/apache/cloudstack Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,4 +81,10 @@ public interface Configuration {
8181 * parameter is no longer used and can be deleted.
8282 */
8383 Date getUpdated ();
84+
85+ /**
86+ *
87+ * @return returns true if the configuration is encrypted else false.
88+ */
89+ boolean isEncrypted ();
8490}
Original file line number Diff line number Diff line change @@ -122,22 +122,23 @@ public void setName(String name) {
122122
123123 @ Override
124124 public String getValue () {
125- if (isEncryptedConfig ()) {
125+ if (isEncrypted ()) {
126126 return DBEncryptionUtil .decrypt (value );
127127 } else {
128128 return value ;
129129 }
130130 }
131131
132132 public void setValue (String value ) {
133- if (isEncryptedConfig ()) {
133+ if (isEncrypted ()) {
134134 this .value = DBEncryptionUtil .encrypt (value );
135135 } else {
136136 this .value = value ;
137137 }
138138 }
139139
140- private boolean isEncryptedConfig () {
140+ @ Override
141+ public boolean isEncrypted () {
141142 return "Hidden" .equals (getCategory ()) || "Secure" .equals (getCategory ());
142143 }
143144
Original file line number Diff line number Diff line change 1616// under the License.
1717package com .cloud .api ;
1818
19+ import com .cloud .utils .crypt .DBEncryptionUtil ;
1920import com .cloud .agent .api .VgpuTypesInfo ;
2021import com .cloud .api .query .ViewResponseHelper ;
2122import com .cloud .api .query .vo .AccountJoinVO ;
@@ -455,7 +456,11 @@ public ConfigurationResponse createConfigurationResponse(Configuration cfg) {
455456 cfgResponse .setCategory (cfg .getCategory ());
456457 cfgResponse .setDescription (cfg .getDescription ());
457458 cfgResponse .setName (cfg .getName ());
458- cfgResponse .setValue (cfg .getValue ());
459+ if (cfg .isEncrypted ()) {
460+ cfgResponse .setValue (DBEncryptionUtil .encrypt (cfg .getValue ()));
461+ } else {
462+ cfgResponse .setValue (cfg .getValue ());
463+ }
459464 cfgResponse .setObjectName ("configuration" );
460465
461466 return cfgResponse ;
Original file line number Diff line number Diff line change @@ -705,8 +705,12 @@ def get_lb_stats_settings(self):
705705 self .apiclient , name = "network.loadbalancer.haproxy.stats.port" )[0 ].value
706706 settings ["stats_uri" ] = Configurations .list (
707707 self .apiclient , name = "network.loadbalancer.haproxy.stats.uri" )[0 ].value
708- settings ["username" ], settings ["password" ] = Configurations .list (
709- self .apiclient , name = "network.loadbalancer.haproxy.stats.auth" )[0 ].value .split (":" )
708+ # Update global setting network.loadbalancer.haproxy.stats.auth to a known value
709+ haproxy_auth = "admin:password"
710+ Configurations .update (self .apiclient , "network.loadbalancer.haproxy.stats.auth" , haproxy_auth )
711+ self .logger .debug (
712+ "Updated global setting stats network.loadbalancer.haproxy.stats.auth to %s" % (haproxy_auth ))
713+ settings ["username" ], settings ["password" ] = haproxy_auth .split (":" )
710714 settings ["visibility" ] = Configurations .list (
711715 self .apiclient , name = "network.loadbalancer.haproxy.stats.visibility" )[0 ].value
712716 self .logger .debug (settings )
You can’t perform that action at this time.
0 commit comments