@Override protected Map<String, Object> getBindings(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { Map<String, Object> bindings = new HashMap<>(); ApacheSsl ssl = deploymentConfiguration.getSecurity().getUiSecurity().getSsl(); bindings.put("passphrase", ssl.getSslCertificatePassphrase()); return bindings; }
@Override protected Map<String, Object> getBindings(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { Map<String, Object> bindings = new HashMap<>(); ApacheSsl ssl = deploymentConfiguration.getSecurity().getUiSecurity().getSsl(); bindings.put("passphrase", ssl.getSslCertificatePassphrase()); return bindings; }
@Override protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { super.setProfile(profile, deploymentConfiguration, endpoints); ServiceSettings deckSettings = endpoints.getServiceSettings(Type.DECK); ServiceSettings gateSettings = endpoints.getServiceSettings(Type.GATE); ApacheSsl apacheSsl= deploymentConfiguration.getSecurity().getUiSecurity().getSsl(); Map<String, String> env = profile.getEnv(); if (apacheSsl.isEnabled()) { env.put("DECK_HOST", deckSettings.getHost()); env.put("DECK_PORT", deckSettings.getPort() + ""); env.put("API_HOST", gateSettings.getBaseUrl()); env.put("DECK_CERT", apacheSsl.getSslCertificateFile()); env.put("DECK_KEY", apacheSsl.getSslCertificateKeyFile()); env.put("PASSPHRASE", apacheSsl.getSslCertificatePassphrase()); } env.put("AUTH_ENABLED", Boolean.toString(deploymentConfiguration.getSecurity().getAuthn().isEnabled())); env.put("FIAT_ENABLED", Boolean.toString(deploymentConfiguration.getSecurity().getAuthz().isEnabled())); } }
@Override protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { super.setProfile(profile, deploymentConfiguration, endpoints); ServiceSettings deckSettings = endpoints.getServiceSettings(Type.DECK); ServiceSettings gateSettings = endpoints.getServiceSettings(Type.GATE); ApacheSsl apacheSsl= deploymentConfiguration.getSecurity().getUiSecurity().getSsl(); Map<String, String> env = profile.getEnv(); if (apacheSsl.isEnabled()) { env.put("DECK_HOST", deckSettings.getHost()); env.put("DECK_PORT", deckSettings.getPort() + ""); env.put("API_HOST", gateSettings.getBaseUrl()); env.put("DECK_CERT", apacheSsl.getSslCertificateFile()); env.put("DECK_KEY", apacheSsl.getSslCertificateKeyFile()); env.put("PASSPHRASE", apacheSsl.getSslCertificatePassphrase()); } env.put("AUTH_ENABLED", Boolean.toString(deploymentConfiguration.getSecurity().getAuthn().isEnabled())); env.put("FIAT_ENABLED", Boolean.toString(deploymentConfiguration.getSecurity().getAuthz().isEnabled())); } }
@Override protected void executeThis() { String currentDeployment = getCurrentDeployment(); ApacheSsl apacheSsl = new OperationHandler<ApacheSsl>() .setOperation(Daemon.getApacheSsl(currentDeployment, false)) .setFailureMesssage("Failed to load SSL settings.") .get(); int originalHash = apacheSsl.hashCode(); apacheSsl.setSslCertificateFile(isSet(sslCertificateFile) ? sslCertificateFile : apacheSsl.getSslCertificateFile()); apacheSsl.setSslCertificateKeyFile(isSet(sslCertificateKeyFile) ? sslCertificateKeyFile : apacheSsl.getSslCertificateKeyFile()); apacheSsl.setSslCertificatePassphrase(isSet(sslCertificatePassphrase) ? sslCertificatePassphrase : apacheSsl.getSslCertificatePassphrase()); apacheSsl.setSslCACertificateFile(isSet(sslCACertificateFile) ? sslCACertificateFile : apacheSsl.getSslCACertificateFile()); if (originalHash == apacheSsl.hashCode()) { AnsiUi.failure("No changes supplied."); return; } new OperationHandler<Void>() .setOperation(Daemon.setApacheSsl(currentDeployment, !noValidate, apacheSsl)) .setFailureMesssage("Failed to edit SSL settings.") .setSuccessMessage("Successfully updated SSL settings.") .get(); } }
@Override protected void executeThis() { String currentDeployment = getCurrentDeployment(); ApacheSsl apacheSsl = new OperationHandler<ApacheSsl>() .setOperation(Daemon.getApacheSsl(currentDeployment, false)) .setFailureMesssage("Failed to load SSL settings.") .get(); int originalHash = apacheSsl.hashCode(); apacheSsl.setSslCertificateFile(isSet(sslCertificateFile) ? sslCertificateFile : apacheSsl.getSslCertificateFile()); apacheSsl.setSslCertificateKeyFile(isSet(sslCertificateKeyFile) ? sslCertificateKeyFile : apacheSsl.getSslCertificateKeyFile()); apacheSsl.setSslCertificatePassphrase(isSet(sslCertificatePassphrase) ? sslCertificatePassphrase : apacheSsl.getSslCertificatePassphrase()); apacheSsl.setSslCACertificateFile(isSet(sslCACertificateFile) ? sslCACertificateFile : apacheSsl.getSslCACertificateFile()); if (originalHash == apacheSsl.hashCode()) { AnsiUi.failure("No changes supplied."); return; } new OperationHandler<Void>() .setOperation(Daemon.setApacheSsl(currentDeployment, !noValidate, apacheSsl)) .setFailureMesssage("Failed to edit SSL settings.") .setSuccessMessage("Successfully updated SSL settings.") .get(); } }