summaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-ssl/src
diff options
context:
space:
mode:
Diffstat (limited to 'sources/hv-collector-ssl/src')
-rw-r--r--sources/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/utils.kt73
-rw-r--r--sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt76
-rw-r--r--sources/hv-collector-ssl/src/test/resources/ssl/ca.crt21
-rw-r--r--sources/hv-collector-ssl/src/test/resources/ssl/password1
-rw-r--r--sources/hv-collector-ssl/src/test/resources/ssl/server.crt19
-rw-r--r--sources/hv-collector-ssl/src/test/resources/ssl/server.key28
-rw-r--r--sources/hv-collector-ssl/src/test/resources/ssl/server.ks.pkcs12bin2389 -> 0 bytes
-rw-r--r--sources/hv-collector-ssl/src/test/resources/ssl/trust.pkcs12bin1096 -> 0 bytes
8 files changed, 0 insertions, 218 deletions
diff --git a/sources/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/utils.kt b/sources/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/utils.kt
deleted file mode 100644
index 5981d9d4..00000000
--- a/sources/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/utils.kt
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2018 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.ssl.boundary
-
-import arrow.core.None
-import arrow.core.Some
-import arrow.core.Try
-import org.apache.commons.cli.CommandLine
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption
-import org.onap.dcae.collectors.veshv.commandline.hasOption
-import org.onap.dcae.collectors.veshv.commandline.stringValue
-import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeys
-import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeysStore
-import org.onap.dcaegen2.services.sdk.security.ssl.Passwords
-import java.nio.file.Paths
-
-/**
- * @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
- * @since September 2018
- */
-
-const val KEY_STORE_FILE = "/etc/ves-hv/server.p12"
-const val KEY_STORE_PASSWORD_FILE = "/etc/ves-hv/server.pass"
-const val TRUST_STORE_FILE = "/etc/ves-hv/trust.p12"
-const val TRUST_STORE_PASSWORD_FILE = "/etc/ves-hv/trust.pass"
-
-fun createSecurityConfiguration(cmdLine: CommandLine): Try<SecurityConfiguration> =
- createSecurityConfigurationProvider(cmdLine).map { it() }
-
-fun createSecurityConfigurationProvider(cmdLine: CommandLine): Try<() -> SecurityConfiguration> =
- if (shouldDisableSsl(cmdLine))
- Try { { disabledSecurityConfiguration() } }
- else
- Try { { enabledSecurityConfiguration(cmdLine) } }
-
-private fun shouldDisableSsl(cmdLine: CommandLine) = cmdLine.hasOption(CommandLineOption.SSL_DISABLE)
-
-private fun disabledSecurityConfiguration() = SecurityConfiguration(None)
-
-private fun enabledSecurityConfiguration(cmdLine: CommandLine): SecurityConfiguration {
- val ksFile = cmdLine.stringValue(CommandLineOption.KEY_STORE_FILE, KEY_STORE_FILE)
- val ksPass = cmdLine.stringValue(CommandLineOption.KEY_STORE_PASSWORD_FILE, KEY_STORE_PASSWORD_FILE)
- val tsFile = cmdLine.stringValue(CommandLineOption.TRUST_STORE_FILE, TRUST_STORE_FILE)
- val tsPass = cmdLine.stringValue(CommandLineOption.TRUST_STORE_PASSWORD_FILE, TRUST_STORE_PASSWORD_FILE)
-
- val keys = ImmutableSecurityKeys.builder()
- .keyStore(ImmutableSecurityKeysStore.of(pathFromFile(ksFile)))
- .keyStorePassword(Passwords.fromPath(pathFromFile(ksPass)))
- .trustStore(ImmutableSecurityKeysStore.of(pathFromFile(tsFile)))
- .trustStorePassword(Passwords.fromPath(pathFromFile(tsPass)))
- .build()
-
- return SecurityConfiguration(Some(keys))
-}
-
-private fun pathFromFile(file: String) = Paths.get(file)
diff --git a/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt b/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt
deleted file mode 100644
index c7c414f8..00000000
--- a/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt
+++ /dev/null
@@ -1,76 +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.ssl.boundary
-
-import com.nhaarman.mockitokotlin2.doReturn
-import com.nhaarman.mockitokotlin2.eq
-import com.nhaarman.mockitokotlin2.mock
-import com.nhaarman.mockitokotlin2.verify
-import com.nhaarman.mockitokotlin2.whenever
-import org.apache.commons.cli.CommandLine
-import org.assertj.core.api.Assertions.assertThat
-import org.jetbrains.spek.api.Spek
-import org.jetbrains.spek.api.dsl.describe
-import org.jetbrains.spek.api.dsl.it
-import org.jetbrains.spek.api.dsl.on
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption
-import org.onap.dcae.collectors.veshv.commandline.hasOption
-import org.onap.dcae.collectors.veshv.commandline.stringValue
-import java.nio.file.Paths
-
-
-internal object UtilsKtTest : Spek({
-
- describe("creating securty configuration provider") {
-
- on("command line without ssl disable") {
- val passwordFile = resourcePathAsString("/ssl/password")
- val commandLine: CommandLine = mock()
- whenever(commandLine.hasOption(CommandLineOption.SSL_DISABLE)).doReturn(false)
- whenever(commandLine.stringValue(CommandLineOption.TRUST_STORE_PASSWORD_FILE, TRUST_STORE_PASSWORD_FILE))
- .doReturn(passwordFile)
- whenever(commandLine.stringValue(CommandLineOption.KEY_STORE_PASSWORD_FILE, KEY_STORE_PASSWORD_FILE))
- .doReturn(passwordFile)
-
- it("should create configuration with some keys") {
- val configuration = createSecurityConfiguration(commandLine)
-
- verify(commandLine).hasOption(CommandLineOption.SSL_DISABLE)
- assertThat(configuration.isSuccess()).isTrue()
- configuration.map { assertThat(it.keys.isDefined()).isTrue() }
- }
- }
- on("command line with ssl disabled") {
- val commandLine: CommandLine = mock()
- whenever(commandLine.hasOption(CommandLineOption.SSL_DISABLE)).doReturn(true)
-
- it("should create configuration without keys") {
- val configuration = createSecurityConfiguration(commandLine)
-
- verify(commandLine).hasOption(CommandLineOption.SSL_DISABLE)
- assertThat(configuration.isSuccess()).isTrue()
- configuration.map { assertThat(it.keys.isEmpty()).isTrue() }
- }
- }
- }
-})
-
-private fun resourcePathAsString(resource: String) =
- Paths.get(UtilsKtTest::class.java.getResource(resource).toURI()).toString()
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/ca.crt b/sources/hv-collector-ssl/src/test/resources/ssl/ca.crt
deleted file mode 100644
index f9a05b90..00000000
--- a/sources/hv-collector-ssl/src/test/resources/ssl/ca.crt
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDbDCCAlSgAwIBAgIJAMsh09jY3jSBMA0GCSqGSIb3DQEBCw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xp/Xg8j+wcAK/dVy1Q3xQQZCW84rv0TBHbdaAPamBLUzHeW3W
-F7BpnVhn1NfYVOKx5W0NfA==
------END CERTIFICATE-----
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/password b/sources/hv-collector-ssl/src/test/resources/ssl/password
deleted file mode 100644
index e69c2de9..00000000
--- a/sources/hv-collector-ssl/src/test/resources/ssl/password
+++ /dev/null
@@ -1 +0,0 @@
-onaponap \ No newline at end of file
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/server.crt b/sources/hv-collector-ssl/src/test/resources/ssl/server.crt
deleted file mode 100644
index 2b06108b..00000000
--- a/sources/hv-collector-ssl/src/test/resources/ssl/server.crt
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDEjCCAfoCCQCId29lGbm5LjANBgkqhkiG9w0BAQsFADBLMQswCQYDVQQGEwJQ
-TDELMAkGA1UECAwCREwxEDAOBgNVBAcMB1dyb2NsYXcxDjAMBgNVBAoMBU5va2lh
-MQ0wCwYDVQQLDARNQU5PMB4XDTE4MDgxMzEyMDAyNFoXDTE5MDgwODEyMDAyNFow
-SzELMAkGA1UEBhMCUEwxCzAJBgNVBAgMAkRMMRAwDgYDVQQHDAdXcm9jbGF3MQ4w
-DAYDVQQKDAVOb2tpYTENMAsGA1UECwwETUFOTzCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBALbblOyqeJayotBiY6aZnGWnMHCHNTileJF8hkFS5P5qM9BU
-XH7NW/p5wSNcQWBB81HrRVneHpm6zfZtUPtcqXC4vpTk/sy3WT8rlEU+uv1YYVP8
-r0jxXr1WZ8sGcxOjhiMMRpMqImoALRak3ombtktfMc2Yeab4J25941wpDSQoUjT8
-LlXhfyjbBijum0LY+cqsuV5qk2qrzo0ZLD6m51aaWEyeysQ/3JanYKvPZDKdvAYN
-+98ud6d/rjdWIJXwxEGp1fpW0p+fHOUhjMB1a5gkPDIpU68ME6BZJ3xJZb1qqXLS
-pkUitMIWZSWx5xNhcifsnxWyhZfnhd8GnxU3Lf8CAwEAATANBgkqhkiG9w0BAQsF
-AAOCAQEAJCrPdc8R7kBOmeIPyVX8QBOsrVTBBDzhskpi51nMsAKvcGjtYdXknYPj
-bw3YVASE2efrq5QWHC0maIxDAHzI/kmWGH8F0s8S6QRH/7fstvxaNaSArzQB/thW
-qIWs7AufUSsLMwtcXQ6KdYNbnaMwTynuuK+ANilcLvV8GxRAzXgFdoWZ2OuJRyzu
-BWQZS49WanyqX1kDLMsrLtdJyl/yVEfsmDcUyhapuuGwtconkWK/CVrJlV1vh1Z+
-Svh9IfvAF7WPPpGsM/y9+hGNtK6sPVUKl4acBzIAv6aN1QS5H4zRvtbwv7xpUp4M
-P84PY3lv1X3NJCGrfVByh2lFWParKA==
------END CERTIFICATE-----
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/server.key b/sources/hv-collector-ssl/src/test/resources/ssl/server.key
deleted file mode 100644
index 40e25932..00000000
--- a/sources/hv-collector-ssl/src/test/resources/ssl/server.key
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PRIVATE KEY-----
-MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC225TsqniWsqLQ
-YmOmmZxlpzBwhzU4pXiRfIZBUuT+ajPQVFx+zVv6ecEjXEFgQfNR60VZ3h6Zus32
-bVD7XKlwuL6U5P7Mt1k/K5RFPrr9WGFT/K9I8V69VmfLBnMTo4YjDEaTKiJqAC0W
-pN6Jm7ZLXzHNmHmm+CdufeNcKQ0kKFI0/C5V4X8o2wYo7ptC2PnKrLleapNqq86N
-GSw+pudWmlhMnsrEP9yWp2Crz2QynbwGDfvfLnenf643ViCV8MRBqdX6VtKfnxzl
-IYzAdWuYJDwyKVOvDBOgWSd8SWW9aqly0qZFIrTCFmUlsecTYXIn7J8VsoWX54Xf
-Bp8VNy3/AgMBAAECggEATzN4o7GKnast/hg/lU9/gEAUKQlHMgvp1woalHy1FsUl
-QBz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Jlg6oHHfYKriv2r9793jETRVwjSNPlKZb
-vqm9yhnbXuahYBZSgdo2W+NbhP6IbJ0vrF4t9g6byjancQptaCjNIr9St9g+Ugly
-8m0n3gIT/+Lr+it63cgk8SA=
------END PRIVATE KEY-----
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/server.ks.pkcs12 b/sources/hv-collector-ssl/src/test/resources/ssl/server.ks.pkcs12
deleted file mode 100644
index a97eb65a..00000000
--- a/sources/hv-collector-ssl/src/test/resources/ssl/server.ks.pkcs12
+++ /dev/null
Binary files differ
diff --git a/sources/hv-collector-ssl/src/test/resources/ssl/trust.pkcs12 b/sources/hv-collector-ssl/src/test/resources/ssl/trust.pkcs12
deleted file mode 100644
index 01b61373..00000000
--- a/sources/hv-collector-ssl/src/test/resources/ssl/trust.pkcs12
+++ /dev/null
Binary files differ