From c138b700030d22ae0bdbd6992fb4a4d8a3431798 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Wed, 10 Apr 2019 10:32:00 +0200 Subject: Read passwords from files Key- and trust-store passwords should be read from files in order to work with DCAE tls-init-container. Change-Id: Ibe454663328268f33f8be25ef9ec129f1ce1d396 Issue-ID: DCAEGEN2-1412 Signed-off-by: Piotr Jaszczyk --- .../veshv/config/impl/ConfigurationMerger.kt | 4 +- .../veshv/config/impl/ConfigurationValidator.kt | 12 ++--- .../veshv/config/impl/PartialConfiguration.kt | 59 ++++++++++++++++++++++ .../veshv/config/impl/partial_configuration.kt | 59 ---------------------- 4 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt delete mode 100644 sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt (limited to 'sources/hv-collector-configuration/src/main/kotlin/org/onap') diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt index 56e48038..e6707825 100644 --- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt +++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt @@ -39,9 +39,9 @@ internal class ConfigurationMerger { sslDisable = base.sslDisable.updateToGivenOrNone(update.sslDisable), keyStoreFile = base.keyStoreFile.updateToGivenOrNone(update.keyStoreFile), - keyStorePassword = base.keyStorePassword.updateToGivenOrNone(update.keyStorePassword), + keyStorePasswordFile = base.keyStorePasswordFile.updateToGivenOrNone(update.keyStorePasswordFile), trustStoreFile = base.trustStoreFile.updateToGivenOrNone(update.trustStoreFile), - trustStorePassword = base.trustStorePassword.updateToGivenOrNone(update.trustStorePassword), + trustStorePasswordFile = base.trustStorePasswordFile.updateToGivenOrNone(update.trustStorePasswordFile), streamPublishers = base.streamPublishers.updateToGivenOrNone(update.streamPublishers), diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt index 613ae302..f4ce592f 100644 --- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt +++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt @@ -120,22 +120,22 @@ internal class ConfigurationValidator { SecurityConfiguration( createSecurityKeys( File(it.keyStoreFile.bind()).toPath(), - it.keyStorePassword.bind(), + File(it.keyStorePasswordFile.bind()).toPath(), File(it.trustStoreFile.bind()).toPath(), - it.trustStorePassword.bind() + File(it.trustStorePasswordFile.bind()).toPath() ).toOption() ) } private fun createSecurityKeys(keyStorePath: Path, - keyStorePassword: String, + keyStorePasswordPath: Path, trustStorePath: Path, - trustStorePassword: String) = + trustStorePasswordPath: Path) = ImmutableSecurityKeys.builder() .keyStore(ImmutableSecurityKeysStore.of(keyStorePath)) - .keyStorePassword(Passwords.fromString(keyStorePassword)) + .keyStorePassword(Passwords.fromPath(keyStorePasswordPath)) .trustStore(ImmutableSecurityKeysStore.of(trustStorePath)) - .trustStorePassword(Passwords.fromString(trustStorePassword)) + .trustStorePassword(Passwords.fromPath(trustStorePasswordPath)) .build() private fun validatedCollectorConfig(partial: PartialConfiguration) = diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt new file mode 100644 index 00000000..51f6a665 --- /dev/null +++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START======================================================= + * dcaegen2-collectors-veshv + * ================================================================================ + * Copyright (C) 2019 NOKIA + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.collectors.veshv.config.impl + +import arrow.core.None +import arrow.core.Option +import com.google.gson.annotations.SerializedName +import org.onap.dcae.collectors.veshv.utils.logging.LogLevel +import org.onap.dcaegen2.services.sdk.model.streams.dmaap.KafkaSink + +/** + * @author Pawel Biniek + * @since February 2019 + */ +internal data class PartialConfiguration( + @SerializedName("server.listenPort") + val listenPort: Option = None, + @SerializedName("server.idleTimeoutSec") + val idleTimeoutSec: Option = None, + + @SerializedName("cbs.firstRequestDelaySec") + val firstRequestDelaySec: Option = None, + @SerializedName("cbs.requestIntervalSec") + val requestIntervalSec: Option = None, + + @SerializedName("security.sslDisable") + val sslDisable: Option = None, + @SerializedName("security.keys.keyStoreFile") + val keyStoreFile: Option = None, + @SerializedName("security.keys.keyStorePasswordFile") + val keyStorePasswordFile: Option = None, + @SerializedName("security.keys.trustStoreFile") + val trustStoreFile: Option = None, + @SerializedName("security.keys.trustStorePasswordFile") + val trustStorePasswordFile: Option = None, + + @SerializedName("logLevel") + val logLevel: Option = None, + + @Transient + var streamPublishers: Option> = None +) diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt deleted file mode 100644 index d09a52e4..00000000 --- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * dcaegen2-collectors-veshv - * ================================================================================ - * Copyright (C) 2019 NOKIA - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.dcae.collectors.veshv.config.impl - -import arrow.core.None -import arrow.core.Option -import com.google.gson.annotations.SerializedName -import org.onap.dcae.collectors.veshv.utils.logging.LogLevel -import org.onap.dcaegen2.services.sdk.model.streams.dmaap.KafkaSink - -/** - * @author Pawel Biniek - * @since February 2019 - */ -internal data class PartialConfiguration( - @SerializedName("server.listenPort") - val listenPort: Option = None, - @SerializedName("server.idleTimeoutSec") - val idleTimeoutSec: Option = None, - - @SerializedName("cbs.firstRequestDelaySec") - val firstRequestDelaySec: Option = None, - @SerializedName("cbs.requestIntervalSec") - val requestIntervalSec: Option = None, - - @SerializedName("security.sslDisable") - val sslDisable: Option = None, - @SerializedName("security.keys.keyStoreFile") - val keyStoreFile: Option = None, - @SerializedName("security.keys.keyStorePassword") - val keyStorePassword: Option = None, - @SerializedName("security.keys.trustStoreFile") - val trustStoreFile: Option = None, - @SerializedName("security.keys.trustStorePassword") - val trustStorePassword: Option = None, - - @SerializedName("logLevel") - val logLevel: Option = None, - - @Transient - var streamPublishers: Option> = None -) -- cgit 1.2.3-korg