diff options
author | Hans Nilsson <[email protected]> | 2018-01-09 18:25:48 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-01-09 18:25:48 +0100 |
commit | af78b33b77f0bb4abff1a4f3144c2a8a5acb3d4e (patch) | |
tree | 5e50f73de669bda5f2b197cdc86948000952cf0a /lib/ssh/test/ssh_compat_SUITE_data/build_scripts/create-ssh-image | |
parent | 8eeaa775a218ce8b74a59cace2f6b3d31f323b0b (diff) | |
parent | 6e8a91b5d3a47e4f1b5be4ce1b213f0175b23062 (diff) | |
download | otp-af78b33b77f0bb4abff1a4f3144c2a8a5acb3d4e.tar.gz otp-af78b33b77f0bb4abff1a4f3144c2a8a5acb3d4e.tar.bz2 otp-af78b33b77f0bb4abff1a4f3144c2a8a5acb3d4e.zip |
Merge branch 'maint'
* maint:
ssh: A compatibility testing suite using dockers This suite tests compatibility with different combinations of OpenSSH and OpenSSL. The peer SSH is running in a docker container.
Diffstat (limited to 'lib/ssh/test/ssh_compat_SUITE_data/build_scripts/create-ssh-image')
-rwxr-xr-x | lib/ssh/test/ssh_compat_SUITE_data/build_scripts/create-ssh-image | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_compat_SUITE_data/build_scripts/create-ssh-image b/lib/ssh/test/ssh_compat_SUITE_data/build_scripts/create-ssh-image new file mode 100755 index 0000000000..983c57b18b --- /dev/null +++ b/lib/ssh/test/ssh_compat_SUITE_data/build_scripts/create-ssh-image @@ -0,0 +1,71 @@ +#!/bin/sh + +# ./create-image openssh 7.3p1 openssl 1.0.2m + +set -x + +case $1 in + openssh) + FAMssh=openssh + VERssh=$2 + PFX=https://ftp.eu.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh- + SFX=.tar.gz + TMP=tmp.tar.gz + ;; + *) + echo "Unsupported: $1" + exit +esac + +FAMssl=$3 +VERssl=$4 + +VER=${FAMssh}${VERssh}-${FAMssl}${VERssl} + +# This way of fetching the tar-file separate from the docker commands makes +# http-proxy handling way easier. The wget command handles the $https_proxy +# variable while the docker command must have /etc/docker/something changed +# and the docker server restarted. That is not possible without root access. + +# Make a Dockerfile. This method simplifies env variable handling considerably: +cat - > TempDockerFile <<EOF + + FROM ssh_compat_suite-${FAMssl}:${VERssl} + + LABEL openssh-version=${VER} + + WORKDIR /buildroot + + COPY ${TMP} . + RUN tar xf ${TMP} + + # Build and install + + WORKDIR ${FAMssh}-${VERssh} + + # Probably VERY OpenSSH dependent...: + RUN ./configure --without-pie \ + --prefix=/buildroot/ssh \ + --with-ssl-dir=/buildroot/ssl \ + --with-pam + RUN make + RUN make install + RUN echo UsePAM yes >> /buildroot/ssh/etc/sshd_config + + RUN echo Built ${VER} + + # Start the daemon, but keep it in foreground to avoid killing the container + CMD /buildroot/ssh/sbin/sshd -D -p 1234 + +EOF + +# Fetch the tar file. This could be done in an "ADD ..." in the Dockerfile, +# but then we hit the proxy problem... +wget -O $TMP $PFX$VERssh$SFX + +# Build the image: +docker build -t ssh_compat_suite-ssh:$VER -f ./TempDockerFile . + +# Cleaning +rm -fr ./TempDockerFile $TMP + |