From bbd5527420f5632a09e401e93a1e1406d37e4f31 Mon Sep 17 00:00:00 2001 From: Shubham Mittal Date: Sat, 12 Oct 2024 19:14:25 -0700 Subject: [PATCH 1/3] integration script --- .../integration/run_cyrus_sasl_integration.sh | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 tests/ci/integration/run_cyrus_sasl_integration.sh diff --git a/tests/ci/integration/run_cyrus_sasl_integration.sh b/tests/ci/integration/run_cyrus_sasl_integration.sh new file mode 100755 index 0000000000..425d05c457 --- /dev/null +++ b/tests/ci/integration/run_cyrus_sasl_integration.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 OR ISC + +set -exu + +source tests/ci/common_posix_setup.sh + +# Set up environment. + +# SYS_ROOT +# - SRC_ROOT(aws-lc) +# - SCRATCH_FOLDER +# - CYRUS_SRC_FOLDER +# - AWS_LC_BUILD_FOLDER +# - AWS_LC_INSTALL_FOLDER + +# Assumes script is executed from the root of aws-lc directory +SCRATCH_FOLDER="${SRC_ROOT}/CYRUS_BUILD_ROOT" +CYRUS_SRC_FOLDER="${SCRATCH_FOLDER}/cyrus" +CYRUS_BUILD_PREFIX="${CYRUS_SRC_FOLDER}/build/install" +CYRUS_BUILD_EPREFIX="${CYRUS_SRC_FOLDER}/build/exec-install" +CYRUS_PATCH_FOLDER="${SRC_ROOT}/tests/ci/integration/cyrus_patch" + +AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build" +AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install" + +mkdir -p ${SCRATCH_FOLDER} +rm -rf "${SCRATCH_FOLDER:?}"/* +cd ${SCRATCH_FOLDER} + +function cyrus_build() { + sh ./autogen.sh \ + --prefix="$CYRUS_BUILD_PREFIX" \ + --exec-prefix="$CYRUS_BUILD_EPREFIX" \ + --with-openssl="$AWS_LC_INSTALL_FOLDER" + + + make -j install +} + +## TODO: Remove this when we make an upstream contribution. +#function nmap_patch_build() { +# for patchfile in $(find -L "${NMAP_PATCH_FOLDER}" -type f -name '*.patch'); do +# echo "Apply patch $patchfile..." +# patch -p1 --quiet -i "$patchfile" +# done +#} + +function cyrus_run_tests() { + make check +} + +git clone --depth 1 https://github.com/cyrusimap/cyrus-sasl.git ${CYRUS_SRC_FOLDER} +cd ${CYRUS_SRC_FOLDER} +mkdir -p ${AWS_LC_BUILD_FOLDER} ${AWS_LC_INSTALL_FOLDER} +ls + +aws_lc_build "$SRC_ROOT" "$AWS_LC_BUILD_FOLDER" "$AWS_LC_INSTALL_FOLDER" -DBUILD_TESTING=OFF -DBUILD_TOOL=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 + +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:${AWS_LC_INSTALL_FOLDER}/lib/" + +# Build cyrus from source. +pushd ${CYRUS_SRC_FOLDER} +#nmap_patch_build +cyrus_build +cyrus_run_tests \ No newline at end of file From 4651f7112150036aaf2d43f76a7879dbb20a99e3 Mon Sep 17 00:00:00 2001 From: Shubham Mittal Date: Tue, 12 Nov 2024 17:37:09 -0800 Subject: [PATCH 2/3] adding cyrus-sasl to our CI --- .github/workflows/integrations.yml | 13 +++++++ .../integration/run_cyrus_sasl_integration.sh | 36 +++++++++---------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml index e37ff625d9..2047da21d5 100644 --- a/.github/workflows/integrations.yml +++ b/.github/workflows/integrations.yml @@ -149,6 +149,19 @@ jobs: - name: Build AWS-LC, build openldap, run tests run: | ./tests/ci/integration/run_openldap_integration.sh master OPENLDAP_REL_ENG_2_5 + cyrus-sasl: + if: github.repository_owner == 'aws' + runs-on: ubuntu-latest + name: Cyrus-SASL + steps: + - name: Install OS Dependencies + run: | + sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none + sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang make + - uses: actions/checkout@v3 + - name: Build AWS-LC, build cyrus, run tests + run: | + ./tests/ci/integration/run_cyrus_sasl_integration.sh bind9: if: github.repository_owner == 'aws' runs-on: ubuntu-latest diff --git a/tests/ci/integration/run_cyrus_sasl_integration.sh b/tests/ci/integration/run_cyrus_sasl_integration.sh index 425d05c457..24d5ddecb5 100755 --- a/tests/ci/integration/run_cyrus_sasl_integration.sh +++ b/tests/ci/integration/run_cyrus_sasl_integration.sh @@ -20,7 +20,6 @@ SCRATCH_FOLDER="${SRC_ROOT}/CYRUS_BUILD_ROOT" CYRUS_SRC_FOLDER="${SCRATCH_FOLDER}/cyrus" CYRUS_BUILD_PREFIX="${CYRUS_SRC_FOLDER}/build/install" CYRUS_BUILD_EPREFIX="${CYRUS_SRC_FOLDER}/build/exec-install" -CYRUS_PATCH_FOLDER="${SRC_ROOT}/tests/ci/integration/cyrus_patch" AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build" AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install" @@ -29,28 +28,27 @@ mkdir -p ${SCRATCH_FOLDER} rm -rf "${SCRATCH_FOLDER:?}"/* cd ${SCRATCH_FOLDER} -function cyrus_build() { - sh ./autogen.sh \ - --prefix="$CYRUS_BUILD_PREFIX" \ - --exec-prefix="$CYRUS_BUILD_EPREFIX" \ - --with-openssl="$AWS_LC_INSTALL_FOLDER" +export CFLAGS="-I$AWS_LC_INSTALL_FOLDER/include ${CFLAGS:=}" +export CPPFLAGS="-I$AWS_LC_INSTALL_FOLDER/include ${CXXFLAGS:=}" +export CXXFLAGS="-I$AWS_LC_INSTALL_FOLDER/include ${CXXFLAGS:=}" +export LDFLAGS="-L$AWS_LC_INSTALL_FOLDER/lib ${LDFLAGS:=}" +function cyrus_build() { + sh ./autogen.sh \ + --prefix="$CYRUS_BUILD_PREFIX" \ + --exec-prefix="$CYRUS_BUILD_EPREFIX" \ + --with-openssl="$AWS_LC_INSTALL_FOLDER" make -j install -} -## TODO: Remove this when we make an upstream contribution. -#function nmap_patch_build() { -# for patchfile in $(find -L "${NMAP_PATCH_FOLDER}" -type f -name '*.patch'); do -# echo "Apply patch $patchfile..." -# patch -p1 --quiet -i "$patchfile" -# done -#} - -function cyrus_run_tests() { - make check + # Assert Cyrus-SASL was built with AWS-LC + local cyrus_executable="${CYRUS_SRC_FOLDER}/build/exec-install/lib/libsasl2.so" + ldd ${cyrus_executable} \ + | grep "${AWS_LC_INSTALL_FOLDER}/lib/libcrypto.so" || exit 1 } +# TO-DO: Setup Kerberos and DB, then use sample client and server programs to test GSSAPI + git clone --depth 1 https://github.com/cyrusimap/cyrus-sasl.git ${CYRUS_SRC_FOLDER} cd ${CYRUS_SRC_FOLDER} mkdir -p ${AWS_LC_BUILD_FOLDER} ${AWS_LC_INSTALL_FOLDER} @@ -58,10 +56,8 @@ ls aws_lc_build "$SRC_ROOT" "$AWS_LC_BUILD_FOLDER" "$AWS_LC_INSTALL_FOLDER" -DBUILD_TESTING=OFF -DBUILD_TOOL=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:${AWS_LC_INSTALL_FOLDER}/lib/" +export LD_LIBRARY_PATH="${AWS_LC_INSTALL_FOLDER}/lib/":${LD_LIBRARY_PATH:-} # Build cyrus from source. pushd ${CYRUS_SRC_FOLDER} -#nmap_patch_build cyrus_build -cyrus_run_tests \ No newline at end of file From 034c1192630219800ef49a9717adb856312817e4 Mon Sep 17 00:00:00 2001 From: Shubham Mittal Date: Tue, 12 Nov 2024 17:41:09 -0800 Subject: [PATCH 3/3] changed text --- .github/workflows/integrations.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml index 2047da21d5..6bf457c77d 100644 --- a/.github/workflows/integrations.yml +++ b/.github/workflows/integrations.yml @@ -159,7 +159,7 @@ jobs: sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang make - uses: actions/checkout@v3 - - name: Build AWS-LC, build cyrus, run tests + - name: Build AWS-LC, build cyrus run: | ./tests/ci/integration/run_cyrus_sasl_integration.sh bind9: