summaryrefslogtreecommitdiffstats
path: root/src/bin/agent
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2021-02-24 10:16:17 +0100
committerFrancis Dupont <fdupont@isc.org>2021-03-26 15:39:56 +0100
commit7bcb80785a538f602253d1db8fe5b244d74a2f51 (patch)
tree6b5ce287f848ae92f22e546c882c157ccceff536 /src/bin/agent
parent[#1662] Added system test (diff)
downloadkea-7bcb80785a538f602253d1db8fe5b244d74a2f51.tar.xz
kea-7bcb80785a538f602253d1db8fe5b244d74a2f51.zip
[#1662] Completed new system test
Diffstat (limited to 'src/bin/agent')
-rw-r--r--src/bin/agent/tests/tls_ca_process_tests.sh.in65
1 files changed, 59 insertions, 6 deletions
diff --git a/src/bin/agent/tests/tls_ca_process_tests.sh.in b/src/bin/agent/tests/tls_ca_process_tests.sh.in
index 04398b539b..a3fac6c491 100644
--- a/src/bin/agent/tests/tls_ca_process_tests.sh.in
+++ b/src/bin/agent/tests/tls_ca_process_tests.sh.in
@@ -30,6 +30,52 @@ TEST_CA_DIR="@abs_top_builddir@/src/lib/asiolink/testutils/ca"
# Control Agent configuration to be stored in the configuration file.
# todo: use actual configuration once we support it.
+
+# Configuration without TLS.
+CONFIG_NONE="{
+ \"Control-agent\":
+ {
+ \"http-host\": \"127.0.0.1\",
+ \"http-port\": 8443,
+ \"loggers\": [
+ {
+ \"name\": \"kea-ctrl-agent\",
+ \"output_options\": [
+ {
+ \"output\": \"${LOG_FILE}\"
+ }
+ ],
+ \"severity\": \"DEBUG\"
+ }
+ ]
+ }
+}"
+
+# Configuration without mutual authentication i.e. only channel protection.
+CONFIG_NOCR="{
+ \"Control-agent\":
+ {
+ \"http-host\": \"127.0.0.1\",
+ \"http-port\": 8443,
+ \"trust-anchor\": \"${TEST_CA_DIR}/kea-ca.crt\",
+ \"cert-file\": \"${TEST_CA_DIR}/kea-server-addr.crt\",
+ \"key-file\": \"${TEST_CA_DIR}/kea-server.key\",
+ \"cert-required\": false,
+ \"loggers\": [
+ {
+ \"name\": \"kea-ctrl-agent\",
+ \"output_options\": [
+ {
+ \"output\": \"${LOG_FILE}\"
+ }
+ ],
+ \"severity\": \"DEBUG\"
+ }
+ ]
+ }
+}"
+
+# Configuration with mutual authentication.
CONFIG="{
\"Control-agent\":
{
@@ -38,6 +84,7 @@ CONFIG="{
\"trust-anchor\": \"${TEST_CA_DIR}/kea-ca.crt\",
\"cert-file\": \"${TEST_CA_DIR}/kea-server-addr.crt\",
\"key-file\": \"${TEST_CA_DIR}/kea-server.key\",
+ \"cert-required\": true,
\"loggers\": [
{
\"name\": \"kea-ctrl-agent\",
@@ -69,7 +116,8 @@ tmpfile_path="@abs_top_builddir@/src/bin/agent/tests"
list_commands_test() {
local test_name="${1}"
local config="${2}"
- local expected_response="${3}"
+ local arguments="${3}"
+ local expected_response="${4}"
# Setup phase: start CA.
@@ -116,13 +164,11 @@ list_commands_test() {
# Main test phase: send command, check response.
tmp="echo | ${shell_bin_path}/${shell_bin} --port 8443 \
- --ca ${TEST_CA_DIR}/kea-ca.crt --cert ${TEST_CA_DIR}/kea-client.crt \
- --key ${TEST_CA_DIR}/kea-client.key > ${tmpfile_path}/shell-stdout.txt"
+ ${arguments} > ${tmpfile_path}/shell-stdout.txt"
echo "Executing kea-shell ($tmp)"
echo | ${shell_bin_path}/${shell_bin} --port 8443 \
- --ca ${TEST_CA_DIR}/kea-ca.crt --cert ${TEST_CA_DIR}/kea-client.crt \
- --key ${TEST_CA_DIR}/kea-client.key > ${tmpfile_path}/shell-stdout.txt
+ ${arguments} > ${tmpfile_path}/shell-stdout.txt
EXIT_CODE=$?
# Check the exit code
@@ -172,4 +218,11 @@ list_commands_test() {
test_finish 0
}
-list_commands_test "list-commands" "${CONFIG}" "[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"
+list_commands_test "No TLS" "${CONFIG_NONE}" "" \
+"[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"
+list_commands_test "Encrypted" "${CONFIG_NOCR}" \
+"--ca ${TEST_CA_DIR}/kea-ca.crt" \
+"[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"
+list_commands_test "Authenticated" "${CONFIG}" \
+"--ca ${TEST_CA_DIR}/kea-ca.crt --cert ${TEST_CA_DIR}/kea-client.crt --key ${TEST_CA_DIR}/kea-client.key" \
+"[ { \"arguments\": [ \"build-report\", \"config-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"list-commands\", \"shutdown\", \"status-get\", \"version-get\" ], \"result\": 0 } ]"