mirror of https://github.com/apache/cloudstack.git
only create new sshkey if user is cloud
This commit is contained in:
parent
312df2ffac
commit
80f971ef33
|
|
@ -533,12 +533,15 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
|||
protected void updateKeyPairs() {
|
||||
// Grab the SSH key pair and insert it into the database, if it is not present
|
||||
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Processing updateKeyPairs");
|
||||
String userid = System.getProperty("user.name");
|
||||
if (!userid.startsWith("cloud")){
|
||||
return;
|
||||
}
|
||||
String already = _configDao.getValue("ssh.privatekey");
|
||||
String homeDir = Script.runSimpleBashScript("echo ~");
|
||||
String userid = System.getProperty("user.name");
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Processing updateKeyPairs");
|
||||
}
|
||||
if (homeDir != null && homeDir.equalsIgnoreCase("~")) {
|
||||
s_logger.error("No home directory was detected. Set the HOME environment variable to point to your user profile or home directory.");
|
||||
throw new CloudRuntimeException("No home directory was detected. Set the HOME environment variable to point to your user profile or home directory.");
|
||||
|
|
@ -610,14 +613,8 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
|||
s_logger.info("Keypairs already in database, skip updating local copy (not running as cloud user)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (userid.startsWith("cloud")){
|
||||
s_logger.info("Going to update systemvm iso with generated keypairs if needed");
|
||||
injectSshKeysIntoSystemVmIsoPatch(pubkeyfile.getAbsolutePath(), privkeyfile.getAbsolutePath());
|
||||
} else {
|
||||
s_logger.info("Skip updating keypairs on systemvm iso (not running as cloud user)");
|
||||
}
|
||||
s_logger.info("Going to update systemvm iso with generated keypairs if needed");
|
||||
injectSshKeysIntoSystemVmIsoPatch(pubkeyfile.getAbsolutePath(), privkeyfile.getAbsolutePath());
|
||||
}
|
||||
|
||||
private void writeKeyToDisk(String key, String keyPath) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue