Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Openssh integration tests to CI #942

Merged
merged 27 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a078b91
CI script for openssh integration
justsmth Apr 11, 2023
56b677b
Add run_openssh_integration.sh to CI
justsmth Apr 11, 2023
c205c1f
Test openssh default and v8.9 branches
justsmth Apr 11, 2023
fa715b1
Add openssh_integration to omnibus
justsmth Apr 11, 2023
548595a
Openssh build requires autoconf
justsmth Apr 11, 2023
717d355
Fix shell script formatting
justsmth Apr 11, 2023
4bffc28
No zlib
justsmth Apr 11, 2023
3281e17
Update script to run on image
justsmth Apr 11, 2023
e320718
Test on amazonlinux-2022_clang-14x_latest
justsmth Apr 12, 2023
919f8f6
Test openssh with aws-lc as system's libcrypto
justsmth Apr 12, 2023
fa25561
Skip agent-subprocess
justsmth Apr 12, 2023
92dc923
Skip test forwarding
justsmth Apr 13, 2023
fa432f1
Skip test multiplex
justsmth Apr 13, 2023
41d5e28
Skip test forward-control
justsmth Apr 13, 2023
68522dd
Skip test agent-restrict
justsmth Apr 13, 2023
d58b699
Skip test connection-timeout
justsmth Apr 13, 2023
201090b
Use privileged mode
justsmth Apr 13, 2023
0f0fdc1
Revert "Use privileged mode"
justsmth Apr 13, 2023
f81da87
Merge branch 'main' into openssh-ci
justsmth May 9, 2023
a06cbcf
Per PR comments
justsmth May 9, 2023
fdf0fff
Add comment about RSA_meth_xxx functions
justsmth May 9, 2023
f19b6f1
Merge branch 'main' into openssh-ci
justsmth May 9, 2023
25c5499
Use sanitizer image
justsmth May 9, 2023
d458dee
Merge branch 'main' into openssh-ci
justsmth May 9, 2023
dd22e5a
Merge branch 'main' into openssh-ci
justsmth May 10, 2023
ecdc469
Standard AWS-LC build
justsmth May 10, 2023
6a8b52d
Merge branch 'main' into openssh-ci
justsmth May 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/ci/cdk/cdk/codebuild/github_ci_linux_x86_omnibus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ batch:
compute-type: BUILD_GENERAL1_LARGE
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_clang-9x_latest

- identifier: openssh_integration
buildspec: ./tests/ci/codebuild/linux-x86/openssh_integration.yml
env:
type: LINUX_CONTAINER
privileged-mode: false
compute-type: BUILD_GENERAL1_LARGE
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:amazonlinux-2022_clang-14x_latest
andrewhop marked this conversation as resolved.
Show resolved Hide resolved

- identifier: postgres_integration
buildspec: ./tests/ci/codebuild/linux-x86/postgres_integration.yml
env:
Expand Down
9 changes: 9 additions & 0 deletions tests/ci/codebuild/linux-x86/openssh_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC

version: 0.2

phases:
build:
commands:
- ./tests/ci/run_openssh_integration.sh
113 changes: 113 additions & 0 deletions tests/ci/run_openssh_integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/bash -exu
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC

source tests/ci/common_posix_setup.sh

# Set up environment.

# ROOT
# |
# - AWS_LC_DIR
# |
# - aws-lc
# |
# - SCRATCH_FOLDER
# |
# - openssh-portable
# - AWS_LC_BUILD_FOLDER
# - AWS_LC_INSTALL_FOLDER
# - OPENSSH_INSTALL_FOLDER

# Assumes script is executed from the root of aws-lc directory
AWS_LC_DIR=$(pwd)
pushd ..
ROOT=$(pwd)
popd

SCRATCH_FOLDER="${ROOT}/SCRATCH_AWSLC_OPENSSH_INTERN_TEST"
AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build"
AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install"
OPENSSH_WORKSPACE_FOLDER="${SCRATCH_FOLDER}/openssh-portable"
OPENSSH_INSTALL_FOLDER="${SCRATCH_FOLDER}/openssh-install"

NINJA_COMMAND=ninja
if ! ${NINJA_COMMAND} --version; then
NINJA_COMMAND=ninja-build
fi

# Make script execution idempotent.
rm -rf "${SCRATCH_FOLDER}"
mkdir -p "${SCRATCH_FOLDER}"
pushd "${SCRATCH_FOLDER}"

# Test helper functions.

function aws_lc_build() {
export GOPROXY=direct
${CMAKE_COMMAND} "${AWS_LC_DIR}" -GNinja "-B${AWS_LC_BUILD_FOLDER}" "-DCMAKE_INSTALL_PREFIX=${AWS_LC_INSTALL_FOLDER}" "$@"
${NINJA_COMMAND} -C "${AWS_LC_BUILD_FOLDER}" install
ls -R "${AWS_LC_INSTALL_FOLDER}"
rm -rf "${AWS_LC_BUILD_FOLDER:?}"/*
}

function install_aws_lc() {
AWS_LC_LIB_FOLDER=$(readlink -f "${AWS_LC_INSTALL_FOLDER}"/lib*)
echo "${AWS_LC_LIB_FOLDER}" > /etc/ld.so.conf.d/aws-lc.conf
rm -f /etc/ld.so.cache
ldconfig
andrewhop marked this conversation as resolved.
Show resolved Hide resolved
}

function openssh_build() {
pushd "${OPENSSH_WORKSPACE_FOLDER}"
autoreconf
export CFLAGS="-DAWS_LC_INTERNAL_IGNORE_BN_SET_FLAGS=1 -DHAVE_RSA_METH_FREE=1 -DHAVE_RSA_METH_DUP=1 -DHAVE_RSA_METH_SET1_NAME=1 -DHAVE_RSA_METH_SET_PRIV_ENC=1 -DHAVE_RSA_METH_SET_PRIV_DEC=1"
andrewhop marked this conversation as resolved.
Show resolved Hide resolved
./configure --with-ssl-dir="${AWS_LC_INSTALL_FOLDER}" --prefix="${OPENSSH_INSTALL_FOLDER}" --disable-pkcs11
make install
ls -R "${OPENSSH_INSTALL_FOLDER}"
popd
}

function checkout_openssh_branch() {
pushd "${OPENSSH_WORKSPACE_FOLDER}"
make clean
git clean -f -d
git checkout --track origin/"$1"
popd
}

function openssh_run_tests() {
pushd "${OPENSSH_WORKSPACE_FOLDER}"
if ! id -u sshd; then
useradd sshd
fi
export TEST_SSH_UNSAFE_PERMISSIONS=1
export SKIP_LTESTS="$@"
make tests
andrewhop marked this conversation as resolved.
Show resolved Hide resolved
popd
}

mkdir -p "${AWS_LC_BUILD_FOLDER}" "${AWS_LC_INSTALL_FOLDER}" "${OPENSSH_INSTALL_FOLDER}"

# Get latest OpenSSH version.
git clone https://github.com/openssh/openssh-portable.git
ls

# Buld AWS-LC as a shared library
aws_lc_build -DBUILD_SHARED_LIBS=1
install_aws_lc

CODEBUILD_SKIPPED_TESTS="agent-subprocess forwarding multiplex forward-control agent-restrict connection-timeout"

# Using default branch. Build openssh and run tests.
openssh_build
openssh_run_tests "${CODEBUILD_SKIPPED_TESTS}"

# Using branch V_8_9
checkout_openssh_branch V_8_9
openssh_build
# In v8.9, the "percent" test requires the 'openssl' cli command
openssh_run_tests "percent ${CODEBUILD_SKIPPED_TESTS}"

popd