Skip to content

Commit 545ddbb

Browse files
committed
Remove realhostip references from the code
1 parent 93239e0 commit 545ddbb

File tree

18 files changed

+36
-33
lines changed

18 files changed

+36
-33
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ repos:
151151
^server/src/test/resources/certs/rsa_self_signed\.key$|
152152
^services/console-proxy/rdpconsole/src/test/doc/rdp-key\.pem$|
153153
^systemvm/agent/certs/localhost\.key$|
154-
^systemvm/agent/certs/realhostip\.key$|
154+
^systemvm/agent/certs/systemvm\.key$|
155155
^test/integration/smoke/test_ssl_offloading\.py$
156156
- id: end-of-file-fixer
157157
exclude: \.vhd$|\.svg$

engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,14 @@ CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Resource Admin', 'deleteUserKey
114114

115115
-- Add conserve mode for VPC offerings
116116
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','conserve_mode', 'tinyint(1) unsigned NULL DEFAULT 0 COMMENT ''True if the VPC offering is IP conserve mode enabled, allowing public IP services to be used across multiple VPC tiers'' ');
117+
118+
-- Remove stale realhostip.com default values; domain has been dead since ~2015.
119+
UPDATE `cloud`.`configuration`
120+
SET value = NULL
121+
WHERE name IN ('consoleproxy.url.domain', 'secstorage.ssl.cert.domain')
122+
AND value IN ('realhostip.com', '*.realhostip.com');
123+
124+
UPDATE `cloud`.`configuration`
125+
SET value = NULL
126+
WHERE name = 'secstorage.secure.copy.cert'
127+
AND value LIKE '%realhostip%';

server/src/main/java/com/cloud/server/ConfigurationServerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ public void persistDefaultValues() throws InternalErrorException {
222222
_configDao.update(Config.SecStorageEncryptCopy.key(), Config.SecStorageEncryptCopy.getCategory(), "false");
223223
logger.debug("ConfigurationServer made secondary storage copy encrypt set to false.");
224224

225-
_configDao.update("secstorage.secure.copy.cert", "realhostip");
226-
logger.debug("ConfigurationServer made secondary storage copy use realhostip.");
225+
_configDao.update("secstorage.secure.copy.cert", "");
226+
logger.debug("ConfigurationServer cleared legacy secstorage.secure.copy.cert.");
227227

228228
_configDao.update("user.password.encoders.exclude", "MD5,LDAP,PLAINTEXT");
229229
logger.debug("Configuration server excluded insecure encoders");

server/src/main/java/com/cloud/storage/download/DownloadMonitorImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ public boolean configure(String name, Map<String, Object> params) {
8787
final Map<String, String> configs = _configDao.getConfiguration("management-server", params);
8888
_proxy = configs.get(Config.SecStorageProxy.key());
8989

90-
String cert = configs.get("secstorage.ssl.cert.domain");
91-
if (!"realhostip.com".equalsIgnoreCase(cert)) {
92-
logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs");
93-
}
94-
9590
_copyAuthPasswd = configs.get("secstorage.copy.password");
9691

9792
DownloadListener dl = new DownloadListener(this);

server/src/main/java/com/cloud/storage/upload/UploadMonitorImpl.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ public UploadVO createEntityDownloadURL(VMTemplateVO template, TemplateDataStore
231231
UploadVO upload = extractURLList.get(0);
232232
String uploadUrl = extractURLList.get(0).getUploadUrl();
233233
String[] token = uploadUrl.split("/");
234-
// example: uploadUrl = https://10-11-101-112.realhostip.com/userdata/2fdd9a70-9c4a-4a04-b1d5-1e41c221a1f9.iso
235-
// then token[2] = 10-11-101-112.realhostip.com, token[4] = 2fdd9a70-9c4a-4a04-b1d5-1e41c221a1f9.iso
234+
// example: uploadUrl = https://10-11-101-112.example.com/userdata/2fdd9a70-9c4a-4a04-b1d5-1e41c221a1f9.iso
235+
// then token[2] = 10-11-101-112.example.com, token[4] = 2fdd9a70-9c4a-4a04-b1d5-1e41c221a1f9.iso
236236
String hostname = ep.getPublicAddr().replace(".", "-") + ".";
237237
if ((token != null) && (token.length == 5) && (token[2].equals(hostname + _ssvmUrlDomain))) // ssvm publicip and domain suffix not changed
238238
return extractURLList.get(0);
@@ -365,7 +365,9 @@ private String generateCopyUrl(String ipAddress, String uuid) {
365365
if (_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0) {
366366
hostname = hostname + "." + _ssvmUrlDomain;
367367
} else {
368-
hostname = hostname + ".realhostip.com";
368+
logger.warn("SSL copy is enabled but secstorage.ssl.cert.domain is not configured; "
369+
+ "using IP address directly. Configure a wildcard SSL certificate domain for proper HTTPS support.");
370+
hostname = ipAddress;
369371
}
370372
}
371373
return scheme + "://" + hostname + "/userdata/" + uuid;
@@ -376,11 +378,6 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
376378
final Map<String, String> configs = _configDao.getConfiguration("management-server", params);
377379
_sslCopy = Boolean.parseBoolean(configs.get("secstorage.encrypt.copy"));
378380

379-
String cert = configs.get("secstorage.secure.copy.cert");
380-
if ("realhostip.com".equalsIgnoreCase(cert)) {
381-
logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs");
382-
}
383-
384381
_ssvmUrlDomain = configs.get("secstorage.ssl.cert.domain");
385382

386383
_agentMgr.registerForHostEvents(new UploadListener(this), true, false, false);

server/src/test/java/com/cloud/keystore/KeystoreTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,20 @@ public void testKeystoreSave() throws Exception {
7575
ComponentLocator locator = ComponentLocator.getCurrentLocator();
7676
7777
KeystoreDao ksDao = locator.getDao(KeystoreDao.class);
78-
ksDao.save("CPVMCertificate", "CPVMCertificate", "KeyForCertificate", "realhostip.com");
78+
ksDao.save("CPVMCertificate", "CPVMCertificate", "KeyForCertificate", "example.com");
7979
ksVo = ksDao.findByName("CPVMCertificate");
8080
assertTrue(ksVo != null);
8181
assertTrue(ksVo.getCertificate().equals("CPVMCertificate"));
8282
assertTrue(ksVo.getKey().equals("KeyForCertificate"));
83-
assertTrue(ksVo.getDomainSuffix().equals("realhostip.com"));
83+
assertTrue(ksVo.getDomainSuffix().equals("example.com"));
8484
85-
ksDao.save("CPVMCertificate", "CPVMCertificate Again", "KeyForCertificate Again", "again.realhostip.com");
85+
ksDao.save("CPVMCertificate", "CPVMCertificate Again", "KeyForCertificate Again", "again.example.com");
8686
8787
ksVo = ksDao.findByName("CPVMCertificate");
8888
assertTrue(ksVo != null);
8989
assertTrue(ksVo.getCertificate().equals("CPVMCertificate Again"));
9090
assertTrue(ksVo.getKey().equals("KeyForCertificate Again"));
91-
assertTrue(ksVo.getDomainSuffix().equals("again.realhostip.com"));
91+
assertTrue(ksVo.getDomainSuffix().equals("again.example.com"));
9292
9393
ksDao.expunge(ksVo.getId());
9494
}
@@ -112,9 +112,9 @@ public void testKeystoreManager() throws Exception {
112112
assertTrue(ksMgr.configure("TaskManager", new HashMap<String, Object>()));
113113
assertTrue(ksMgr.start());
114114
115-
ksMgr.saveCertificate("CPVMCertificate", certContent, keyContent, "realhostip.com");
115+
ksMgr.saveCertificate("CPVMCertificate", certContent, keyContent, "example.com");
116116
117-
byte[] ksBits = ksMgr.getKeystoreBits("CPVMCertificate", "realhostip", "vmops.com");
117+
byte[] ksBits = ksMgr.getKeystoreBits("CPVMCertificate", "example", "vmops.com");
118118
assertTrue(ksBits != null);
119119
120120
try {

services/console-proxy/server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<resource>
8181
<directory>certs</directory>
8282
<excludes>
83-
<exclude>realhostip.csr</exclude>
83+
<exclude>systemvm.csr</exclude>
8484
</excludes>
8585
</resource>
8686
</resources>

services/secondary-storage/server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<systemProperties>
108108
<systemProperty>
109109
<key>javax.net.ssl.trustStore</key>
110-
<value>certs/realhostip.keystore</value>
110+
<value>certs/systemvm.keystore</value>
111111
<key>log.home</key>
112112
<value>${PWD}/</value>
113113
</systemProperty>

0 commit comments

Comments
 (0)