Skip to content

Commit 89c567a

Browse files
authored
security: increase keystore setup/import timeout (#3076)
This increases and uses a default 15mins timeout for VR scripts and for KVM agent increases timeout from 60s to 5mins. The timeout can specifically occur when keystore does not get enough entropy from CPU and script gets killed due to timeout. This is a very specific corner case and generally should not happen on baremetal/prod environment, but sometimes seen in nested/test environments. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 1709792 commit 89c567a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

agent/src/com/cloud/agent/Agent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ public Answer setupAgentKeystore(final SetupKeyStoreCommand cmd) {
729729
_shell.setPersistentProperty(null, KeyStoreUtils.KS_PASSPHRASE_PROPERTY, storedPassword);
730730
}
731731

732-
Script script = new Script(_keystoreSetupPath, 60000, s_logger);
732+
Script script = new Script(_keystoreSetupPath, 300000, s_logger);
733733
script.add(agentFile.getAbsolutePath());
734734
script.add(keyStoreFile);
735735
script.add(storedPassword);
@@ -773,7 +773,7 @@ private Answer setupAgentCertificate(final SetupCertificateCommand cmd) {
773773
throw new CloudRuntimeException("Unable to save received agent client and ca certificates", e);
774774
}
775775

776-
Script script = new Script(_keystoreCertImportPath, 60000, s_logger);
776+
Script script = new Script(_keystoreCertImportPath, 300000, s_logger);
777777
script.add(agentFile.getAbsolutePath());
778778
script.add(keyStoreFile);
779779
script.add(KeyStoreUtils.AGENT_MODE);

core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private Answer execute(final SetupKeyStoreCommand cmd) {
161161
cmd.getKeystorePassword(),
162162
cmd.getValidityDays(),
163163
KeyStoreUtils.CSR_FILENAME);
164-
ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), KeyStoreUtils.KS_SETUP_SCRIPT, args);
164+
ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), KeyStoreUtils.KS_SETUP_SCRIPT, args, Duration.standardMinutes(15));
165165
return new SetupKeystoreAnswer(result.getDetails());
166166
}
167167

@@ -179,7 +179,7 @@ private Answer execute(final SetupCertificateCommand cmd) {
179179
cmd.getEncodedCaCertificates(),
180180
KeyStoreUtils.PKEY_FILENAME,
181181
cmd.getEncodedPrivateKey());
182-
ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), KeyStoreUtils.KS_IMPORT_SCRIPT, args);
182+
ExecutionResult result = _vrDeployer.executeInVR(cmd.getRouterAccessIp(), KeyStoreUtils.KS_IMPORT_SCRIPT, args, Duration.standardMinutes(15));
183183
return new SetupCertificateAnswer(result.isSuccess());
184184
}
185185

0 commit comments

Comments
 (0)