From 3b4b5cfd760bdf8881ba6c65b9d25f090758251b Mon Sep 17 00:00:00 2001 From: Dominic Martinez Date: Fri, 29 Aug 2025 08:10:41 -0700 Subject: [PATCH] TIDO-575 Add support for eduGAIN export aggregation testing (#24) * Add local import with unsigned output test * Add data/test for edugain report * Add testing for signing export aggregate --- build.xml | 41 +++ mdx/incommon/import_local.xml | 305 ++++++++++++++++++ mdx/incommon/report_local.xml | 94 ++++++ mdx/incommon/sign_localkey.xml | 271 ++++++++++++++++ tests/incommon/data/test-edugain-metadata.xml | 88 +++++ tests/incommon/data/test-incommon-export.xml | 81 +++++ ...=> consolidateIncommonAndEdugainSigned.sh} | 6 +- .../consolidateIncommonAndEdugainUnsigned.sh | 54 ++++ tests/incommon/scripts/edugainReport.sh | 16 + tests/incommon/scripts/signIncommonExport.sh | 27 ++ 10 files changed, 978 insertions(+), 5 deletions(-) create mode 100644 mdx/incommon/import_local.xml create mode 100644 mdx/incommon/report_local.xml create mode 100644 mdx/incommon/sign_localkey.xml create mode 100644 tests/incommon/data/test-incommon-export.xml rename tests/incommon/scripts/{consolidateIncommonAndEdugain.sh => consolidateIncommonAndEdugainSigned.sh} (86%) create mode 100755 tests/incommon/scripts/consolidateIncommonAndEdugainUnsigned.sh create mode 100755 tests/incommon/scripts/edugainReport.sh create mode 100755 tests/incommon/scripts/signIncommonExport.sh diff --git a/build.xml b/build.xml index 861a6fb..462a2c3 100644 --- a/build.xml +++ b/build.xml @@ -3056,6 +3056,20 @@ Generation complete. + + + Generating InCommon import aggregate in ${mda.inc.imported.xml} + (IdP-only aggregate in ${mda.inc.imported-idp.xml}) + from production aggregate in ${mda.inc.production.xml} + and selected eduGAIN entities from ${mda.inc.edugain.xml}... + + Generation complete. + + + + + + Generating signed aggregate in ${mda.inc.imported.xml} + from aggregate in ${mda.inc.production.xml} + signed using a local key + + Generation complete. + + + + Looking for errors in eduGAIN entities from ${mda.inc.edugain.xml}... + + Report complete. + + diff --git a/mdx/incommon/import_local.xml b/mdx/incommon/import_local.xml new file mode 100644 index 0000000..1f3356c --- /dev/null +++ b/mdx/incommon/import_local.xml @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mdx/incommon/report_local.xml b/mdx/incommon/report_local.xml new file mode 100644 index 0000000..4017113 --- /dev/null +++ b/mdx/incommon/report_local.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mdx/incommon/sign_localkey.xml b/mdx/incommon/sign_localkey.xml new file mode 100644 index 0000000..a616296 --- /dev/null +++ b/mdx/incommon/sign_localkey.xml @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/incommon/data/test-edugain-metadata.xml b/tests/incommon/data/test-edugain-metadata.xml index 9d501a6..61035d6 100644 --- a/tests/incommon/data/test-edugain-metadata.xml +++ b/tests/incommon/data/test-edugain-metadata.xml @@ -213,4 +213,92 @@ rCQ5wiQlCiUdMUTWlNVfhJR1n5Pp mailto:admin@sp.example.edugain.edu + + + + https://gif.erroneous.edugain.example/pdf/statement.pdf + + + + + + eduGAIN Error Example + eduGAIN Error Example Description + https://learn.erroneous.edugain.example + https://logo.erroneous.edugain.example/images/logo.png + + + + + + +MIIEGjCCAwKgAwIBAgIBADAN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QHHLCy6IsUVuOls7e +89pGroOakOxrD/Vlc/MYCi5/+mhGuBm6s5o+tRnAfZbjdmFyq1yStVJVGyNpDZOR +pa/5yZm7v9ISFIL5Ff/jI1FUyHvbr807KgXsKOb6uQuD5rUU5EvLP/3Dmx3OBMgB +QWnsNfyMBEj210hKHo81xRZiM2OEuNUWKvQ6TXJ7ffRaVKltqSqlzKGp8hQyhcnB +FqYIOBRYOq/RY2Aid/nZSwIDAQABo1MwUTAdBgNVHQ4EFgQUv7X6mRnIyzF0rsEy +mLZbO7m8Kz4wHwYDVR0jBBgwFoAUv7X6mRnIyzF0rsEymLZbO7m8Kz4wDwYDVR0T +AQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAcjxsyzB8OOoLpmfowGBWwtA7 +FDP8EspxAENkB73rsXcGlla2FrWcts5JTM1QaXXV3gp2yHQsf3bnQojMuyOhlEN9 +4g2D3hMIe0ii7D6EySf/0+30eVk2Gm4baTkU4iC6AAG6fCGdbV/S35W/LNoUNa43 +w6VZlf3Bm5Ll1DT4tKakA14LLisEYgrHUXTmaHO6ClgKMQSQ4TMLuMsaF7loS7ic +eOm0U96yXmqMKDqHnI3z1m+nQMSQHALGkRy04ixJTZLaKK6vdUUFMS3RIIYtCIkY +ZpU3r74KB02RD1kzRTCsK2SkD202ZjKQVC970TgiMyRMl4H1lF+H9RQ5PoU3KQ== + + + + + + urn:oasis:names:tc:SAML:2.0:nameid-format:persistent + + + + eduGAIN Error Example + eduGAIN Error Example + https://erroneous.edugain.example + + + mailto:noc@erroneous.edugain.example + + diff --git a/tests/incommon/data/test-incommon-export.xml b/tests/incommon/data/test-incommon-export.xml new file mode 100644 index 0000000..90fdee2 --- /dev/null +++ b/tests/incommon/data/test-incommon-export.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + https://refeds.org/sirtfi + + + http://id.incommon.org/category/registered-by-incommon + + + + + + + + Incommon Export Example + Incommon Export Example Description. + https://incommon.export.example.com/info.html + https://incommon.export.example.com/privacy_statement.html + https://incommon.export.example.com/logo.png + + + + + + + +MIIDqjCCApICCQC+fKsxbkHg7zANBgkqhkiG9w0BAQsFADCBljELMAkGA1UEBhMC +VVMxDTALBgNVBAgMBE9oaW8xETAPBgNVBAcMCENvbHVtYnVzMSEwHwYDVQQKDBhT +cGluZSBSZXNlYXJjaCBJbnN0aXR1dGUxHTAbBgNVBAsMFFNvZnR3YXJlIEVuZ2lu +ZWVyaW5nMSMwIQYDVQQDDBptZmEtYXV0aC5kZXYyLnBoZW5vYXBwLmNvbTAeFw0y +MTA1MjgxODAxNDBaFw0yMjA1MjgxODAxNDBaMIGWMQswCQYDVQQGEwJVUzENMAsG +A1UECAwET2hpbzERMA8GA1UEBwwIQ29sdW1idXMxITAfBgNVBAoMGFNwaW5lIFJl +c2VhcmNoIEluc3RpdHV0ZTEdMBsGA1UECwwUU29mdHdhcmUgRW5naW5lZXJpbmcx +IzAhBgNVBAMMGm1mYS1hdXRoLmRldjIucGhlbm9hcHAuY29tMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy3fRJcWRUu7tAiyNhxV+qAwhWf1UqbqaAygD +pXyyt9evvBLjRzaDV0oRwrxFQBy/BbXw3iqFi7dzCFdApJ6f6YmIoyc7MoO1hXmj +hxGIwQMhYjgC24zHLXZHRPoVER4bKZhhjluFQe1pcSQOIRvn+ddtmHIrjARWdu2H +d3Vq+PsRup2xkhUmOtO0hK3ouBvjKRbmimJczAjBuLPcwpFUcvssska2PSMTuWcR +ngSzkeGALiHvKq0mbGpMlIjmbnPiXi3UORJLKbivtDIoljN6vPibhzC0XBS7QKdW +jwMUqEPgxoAVUkh3w5cFeGEs8cfGps4GImQDRio/HKMWaLe8bQIDAQABMA0GCSqG +SIb3DQEBCwUAA4IBAQDIwxlpxNoL97+/RjjYuBNh2cCwjUgMX8B4hcTnXUJxstla +sVLEzV0f4jAWw9uCxQ7MAZVnVF2qJJr0QO8oa0PUNogAjf2am0iNC9hP4wW35gbX +OUltpjUzuA1uDFaoOaBTJm6K0dnGQPXJu0LHUq3cYP2usTC/Inanpa2Vrg/Yd9/7 +YYCNkyTNk7BZMmoOCQOmxnZ9EIVoagQlLFOioZm6wH3NkJ/ryLA1BzSzzc4aLcHW +llqKDN+r3+7V6EhFHi+mdLL0b2hx+WEAD9OsnpnnEK+G9SYufC8bVRLj7zIvPpMX +H+cY2/VLXuYdr7snyziAlZ6eUgKSeJWDM5axlz/a + + + + + + + + + Incommon Export Example Org + Incommon Export Example Org Display Name + http://incommon.export.example.com/ + + + Example Person1 + mailto:example1@incommon.export.example.com + + + Example Person2 + mailto:example2@incommon.export.example.com + + + Incommon Export Example Security Team + mailto:security@incommon.export.example.com + + + diff --git a/tests/incommon/scripts/consolidateIncommonAndEdugain.sh b/tests/incommon/scripts/consolidateIncommonAndEdugainSigned.sh similarity index 86% rename from tests/incommon/scripts/consolidateIncommonAndEdugain.sh rename to tests/incommon/scripts/consolidateIncommonAndEdugainSigned.sh index 56837ee..a94ac73 100755 --- a/tests/incommon/scripts/consolidateIncommonAndEdugain.sh +++ b/tests/incommon/scripts/consolidateIncommonAndEdugainSigned.sh @@ -34,7 +34,7 @@ info "Starting at $(date)" debug "Using local key" # The inc.generate.import_sign_localkey target erroneously depends on sign.uk.keyPassword -# The mda.inc.imported-idp.xml is the parameter for the unsigned idp-only aggregate output file +# The mda.inc.imported-idp.xml is the parameter for the unsigned idp-only aggregate output file # The mda.inc.imported.xml is the parameter for the unsigned aggregate output file ANT_OPTS=(inc.generate.import_sign_localkey \ "-Dedugain.dir=/mda/inc/inc-meta/mdx/int_edugain" \ @@ -46,10 +46,6 @@ ANT_OPTS=(inc.generate.import_sign_localkey \ "-Dshared.ws.dir=/mda/inc/inc-meta" \ "-Dsign.uk.keyPassword=dummypassword") -# Set source for signed InCommon metadata aggregate -MD_SOURCE_FILE=$MDQ_HOME/tests/incommon/data/test-metadata.xml -MD_SOURCE_CERT=/$MDQ_HOME/tests/incommon/data/test-cert.pem - # Create temp local signing key/cert SGNPWD=dummypassword export SGNPWD diff --git a/tests/incommon/scripts/consolidateIncommonAndEdugainUnsigned.sh b/tests/incommon/scripts/consolidateIncommonAndEdugainUnsigned.sh new file mode 100755 index 0000000..22aec1b --- /dev/null +++ b/tests/incommon/scripts/consolidateIncommonAndEdugainUnsigned.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Generate metadata files required for the MDQ service + +# TODO: +# * Wrap mda output in debug function +# * Count files + +set -euo pipefail + +# Get script name +PROG=`basename $0` + +# Get metadata validation funtions +source /$MDQ_HOME/tests/incommon/scripts/metadataValidation.sh + +# Print debug output +function debug { + echo [DEBUG] $PROG: "$@" +} + +# Print error output +function error { + echo [ERROR] $PROG: "$@" +} + +# Print informational output +function info { + echo [INFO] $PROG: "$@" +} + +info "Starting at $(date)" + +# Use local key +debug "Using local key" + +# The inc.generate.import_sign_localkey target erroneously depends on sign.uk.keyPassword +# The mda.inc.imported-idp.xml is the parameter for the unsigned idp-only aggregate output file +# The mda.inc.imported.xml is the parameter for the unsigned aggregate output file +ANT_OPTS=(inc.generate.import_local \ + "-Dedugain.dir=/mda/inc/inc-meta/mdx/int_edugain" \ + "-Dmda.inc.edugain.xml=tests/incommon/data/test-edugain-metadata.xml" \ + "-Dmda.inc.imported.xml=/tmp/incommon-and-edugain-metadata.xml" \ + "-Dmda.inc.imported-idp.xml=/tmp/incommon-and-edugain-idp-metadata.xml" \ + "-Dmda.inc.production.xml=tests/incommon/data/test-metadata.xml" \ + "-Dshared.ws.dir=/mda/inc/inc-meta") + +# Generate all required metadata for the MDQ service +debug "Generating metadata" +cd "$MDQ_HOME" || exit 1 +if ! /usr/bin/ant "${ANT_OPTS[@]}" +then + error "Metadata generation failed" + exit 1 +fi diff --git a/tests/incommon/scripts/edugainReport.sh b/tests/incommon/scripts/edugainReport.sh new file mode 100755 index 0000000..d50aa43 --- /dev/null +++ b/tests/incommon/scripts/edugainReport.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Report on the eduGAIN entities filtered out because of errors detected. + +ANT_OPTS=(inc.edugain.report_local \ + "-Dshared.ws.dir=/mda/inc/inc-meta" \ + "-Dedugain.dir=/mda/inc/inc-meta/mdx/int_edugain" \ + "-Dmda.inc.edugain.xml=tests/incommon/data/test-edugain-metadata.xml") + +# Download eduGAIN metadata for the MDQ service +echo "Running ant to report on the eduGAIN metadata file." +cd "$MDQ_HOME" || exit 1 +if ! /usr/bin/ant "${ANT_OPTS[@]}" +then + echo "Download failed" + exit 1 +fi diff --git a/tests/incommon/scripts/signIncommonExport.sh b/tests/incommon/scripts/signIncommonExport.sh new file mode 100755 index 0000000..03a51bb --- /dev/null +++ b/tests/incommon/scripts/signIncommonExport.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Sign an input aggregate (e.g. Incommon or eduGAIN) +# but this specifically will test signing the Incommon Export aggregate + +ANT_OPTS=(inc.generate.sign_localkey \ + "-Dedugain.dir=/mda/inc/inc-meta/mdx/int_edugain" \ + "-Dmda.inc.imported.xml=/tmp/incommon-export-signed-metadata.xml" \ + "-Dmda.inc.production.xml=tests/incommon/data/test-incommon-export.xml" \ + "-Dmda.sign.keyResource=file:///keys/mda-signing.key" \ + "-Dshared.ws.dir=/mda/inc/inc-meta" \ + "-Dsign.uk.keyPassword=dummypassword") + +# Create temp local signing key/cert +SGNPWD=dummypassword +export SGNPWD +mkdir -p /keys +[ ! -L /keys/mda-signing.crt ] && ln -s /$MDQ_HOME/tests/incommon/data/mda-signing.crt /keys/mda-signing.crt +[ ! -L /keys/mda-signing.key ] && ln -s /$MDQ_HOME/tests/incommon/data/mda-signing.key /keys/mda-signing.key + +# Download eduGAIN metadata for the MDQ service +echo "Running ant to sign the input metadata file." +cd "$MDQ_HOME" || exit 1 +if ! /usr/bin/ant "${ANT_OPTS[@]}" +then + echo "Download failed" + exit 1 +fi