From d6cf4a165bbbaf808c0d9d218c40e9ec440ea8df Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Fri, 25 Sep 2020 10:47:46 +0200 Subject: [PATCH] testing: Add CA ID mappings to TKM tests Extend the build-certs-chroot script is to fill in the public key fingerprint of the CA certificate in the appropriate strongswan.con files. --- testing/scripts/build-certs-chroot | 27 +++++++++++++++++++ testing/tests/tkm/.gitignore | 1 + .../{strongswan.conf => strongswan.conf.in} | 6 +++++ .../{strongswan.conf => strongswan.conf.in} | 6 +++++ .../{strongswan.conf => strongswan.conf.in} | 6 +++++ .../{strongswan.conf => strongswan.conf.in} | 6 +++++ .../hosts/moon/etc/strongswan.conf | 8 ------ .../hosts/moon/etc/strongswan.conf.in | 14 ++++++++++ .../hosts/moon/etc/strongswan.conf | 8 ------ .../hosts/moon/etc/strongswan.conf.in | 14 ++++++++++ .../{strongswan.conf => strongswan.conf.in} | 6 +++++ .../{strongswan.conf => strongswan.conf.in} | 6 +++++ 12 files changed, 92 insertions(+), 16 deletions(-) rename testing/tests/tkm/host2host-initiator/hosts/moon/etc/{strongswan.conf => strongswan.conf.in} (55%) rename testing/tests/tkm/host2host-responder/hosts/moon/etc/{strongswan.conf => strongswan.conf.in} (55%) rename testing/tests/tkm/host2host-xfrmproxy/hosts/moon/etc/{strongswan.conf => strongswan.conf.in} (55%) rename testing/tests/tkm/multiple-clients/hosts/sun/etc/{strongswan.conf => strongswan.conf.in} (55%) delete mode 100644 testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf create mode 100644 testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf.in delete mode 100644 testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf create mode 100644 testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf.in rename testing/tests/tkm/xfrmproxy-expire/hosts/moon/etc/{strongswan.conf => strongswan.conf.in} (69%) rename testing/tests/tkm/xfrmproxy-rekey/hosts/moon/etc/{strongswan.conf => strongswan.conf.in} (69%) diff --git a/testing/scripts/build-certs-chroot b/testing/scripts/build-certs-chroot index b14e4a973..7d464c368 100755 --- a/testing/scripts/build-certs-chroot +++ b/testing/scripts/build-certs-chroot @@ -1925,3 +1925,30 @@ do -e "s|SUN_PUB_DNS|${SUN_PUB_DNS}|g" \ ${TEST_DATA}.in > ${TEST_DATA} done + +################################################################################ +# TKM CA ID mapping # +################################################################################ + +for t in host2host-initiator host2host-responder host2host-xfrmproxy \ + net2net-initiator net2net-xfrmproxy xfrmproxy-expire xfrmproxy-rekey +do + for h in moon + do + TEST_DATA="${TEST_DIR}/tkm/${t}/hosts/moon/etc/strongswan.conf" + sed -e "s/CA_SPK_HEX/${CA_SPK_HEX}/g" \ + -e "s/CA_SPKI_HEX/${CA_SPKI_HEX}/g" \ + ${TEST_DATA}.in > ${TEST_DATA} + done +done + +for t in multiple-clients +do + for h in sun + do + TEST_DATA="${TEST_DIR}/tkm/${t}/hosts/${h}/etc/strongswan.conf" + sed -e "s/CA_SPK_HEX/${CA_SPK_HEX}/g" \ + -e "s/CA_SPKI_HEX/${CA_SPKI_HEX}/g" \ + ${TEST_DATA}.in > ${TEST_DATA} + done +done diff --git a/testing/tests/tkm/.gitignore b/testing/tests/tkm/.gitignore index fd93a9fff..7fce40b54 100644 --- a/testing/tests/tkm/.gitignore +++ b/testing/tests/tkm/.gitignore @@ -1 +1,2 @@ *.der +strongswan.conf diff --git a/testing/tests/tkm/host2host-initiator/hosts/moon/etc/strongswan.conf b/testing/tests/tkm/host2host-initiator/hosts/moon/etc/strongswan.conf.in similarity index 55% rename from testing/tests/tkm/host2host-initiator/hosts/moon/etc/strongswan.conf rename to testing/tests/tkm/host2host-initiator/hosts/moon/etc/strongswan.conf.in index cc9d6e072..bd076cf84 100644 --- a/testing/tests/tkm/host2host-initiator/hosts/moon/etc/strongswan.conf +++ b/testing/tests/tkm/host2host-initiator/hosts/moon/etc/strongswan.conf.in @@ -5,4 +5,10 @@ charon-tkm { 15 = 1 16 = 2 } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } } diff --git a/testing/tests/tkm/host2host-responder/hosts/moon/etc/strongswan.conf b/testing/tests/tkm/host2host-responder/hosts/moon/etc/strongswan.conf.in similarity index 55% rename from testing/tests/tkm/host2host-responder/hosts/moon/etc/strongswan.conf rename to testing/tests/tkm/host2host-responder/hosts/moon/etc/strongswan.conf.in index cc9d6e072..bd076cf84 100644 --- a/testing/tests/tkm/host2host-responder/hosts/moon/etc/strongswan.conf +++ b/testing/tests/tkm/host2host-responder/hosts/moon/etc/strongswan.conf.in @@ -5,4 +5,10 @@ charon-tkm { 15 = 1 16 = 2 } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } } diff --git a/testing/tests/tkm/host2host-xfrmproxy/hosts/moon/etc/strongswan.conf b/testing/tests/tkm/host2host-xfrmproxy/hosts/moon/etc/strongswan.conf.in similarity index 55% rename from testing/tests/tkm/host2host-xfrmproxy/hosts/moon/etc/strongswan.conf rename to testing/tests/tkm/host2host-xfrmproxy/hosts/moon/etc/strongswan.conf.in index cc9d6e072..bd076cf84 100644 --- a/testing/tests/tkm/host2host-xfrmproxy/hosts/moon/etc/strongswan.conf +++ b/testing/tests/tkm/host2host-xfrmproxy/hosts/moon/etc/strongswan.conf.in @@ -5,4 +5,10 @@ charon-tkm { 15 = 1 16 = 2 } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } } diff --git a/testing/tests/tkm/multiple-clients/hosts/sun/etc/strongswan.conf b/testing/tests/tkm/multiple-clients/hosts/sun/etc/strongswan.conf.in similarity index 55% rename from testing/tests/tkm/multiple-clients/hosts/sun/etc/strongswan.conf rename to testing/tests/tkm/multiple-clients/hosts/sun/etc/strongswan.conf.in index cc9d6e072..bd076cf84 100644 --- a/testing/tests/tkm/multiple-clients/hosts/sun/etc/strongswan.conf +++ b/testing/tests/tkm/multiple-clients/hosts/sun/etc/strongswan.conf.in @@ -5,4 +5,10 @@ charon-tkm { 15 = 1 16 = 2 } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } } diff --git a/testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf b/testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf deleted file mode 100644 index cc9d6e072..000000000 --- a/testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf +++ /dev/null @@ -1,8 +0,0 @@ -# /etc/strongswan.conf - strongSwan configuration file - -charon-tkm { - dh_mapping { - 15 = 1 - 16 = 2 - } -} diff --git a/testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf.in b/testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf.in new file mode 100644 index 000000000..bd076cf84 --- /dev/null +++ b/testing/tests/tkm/net2net-initiator/hosts/moon/etc/strongswan.conf.in @@ -0,0 +1,14 @@ +# /etc/strongswan.conf - strongSwan configuration file + +charon-tkm { + dh_mapping { + 15 = 1 + 16 = 2 + } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } +} diff --git a/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf b/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf deleted file mode 100644 index cc9d6e072..000000000 --- a/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf +++ /dev/null @@ -1,8 +0,0 @@ -# /etc/strongswan.conf - strongSwan configuration file - -charon-tkm { - dh_mapping { - 15 = 1 - 16 = 2 - } -} diff --git a/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf.in b/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf.in new file mode 100644 index 000000000..bd076cf84 --- /dev/null +++ b/testing/tests/tkm/net2net-xfrmproxy/hosts/moon/etc/strongswan.conf.in @@ -0,0 +1,14 @@ +# /etc/strongswan.conf - strongSwan configuration file + +charon-tkm { + dh_mapping { + 15 = 1 + 16 = 2 + } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } +} diff --git a/testing/tests/tkm/xfrmproxy-expire/hosts/moon/etc/strongswan.conf b/testing/tests/tkm/xfrmproxy-expire/hosts/moon/etc/strongswan.conf.in similarity index 69% rename from testing/tests/tkm/xfrmproxy-expire/hosts/moon/etc/strongswan.conf rename to testing/tests/tkm/xfrmproxy-expire/hosts/moon/etc/strongswan.conf.in index 5b79af9f4..e9ab53629 100644 --- a/testing/tests/tkm/xfrmproxy-expire/hosts/moon/etc/strongswan.conf +++ b/testing/tests/tkm/xfrmproxy-expire/hosts/moon/etc/strongswan.conf.in @@ -7,4 +7,10 @@ charon-tkm { 15 = 1 16 = 2 } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } } diff --git a/testing/tests/tkm/xfrmproxy-rekey/hosts/moon/etc/strongswan.conf b/testing/tests/tkm/xfrmproxy-rekey/hosts/moon/etc/strongswan.conf.in similarity index 69% rename from testing/tests/tkm/xfrmproxy-rekey/hosts/moon/etc/strongswan.conf rename to testing/tests/tkm/xfrmproxy-rekey/hosts/moon/etc/strongswan.conf.in index 5b79af9f4..e9ab53629 100644 --- a/testing/tests/tkm/xfrmproxy-rekey/hosts/moon/etc/strongswan.conf +++ b/testing/tests/tkm/xfrmproxy-rekey/hosts/moon/etc/strongswan.conf.in @@ -7,4 +7,10 @@ charon-tkm { 15 = 1 16 = 2 } + ca_mapping { + strongswan_ca { + id = 1 + fingerprint = CA_SPK_HEX + } + } }