Repository navigation
tests: add option to run tests without docker - #762
Merged
Merged
Conversation
Merged
Member
Author
|
So far very little success with running sshd via chroot or other tricks. |
Member
Author
|
sshserver.pl from curl looks promising. |
via `export OPENSSH_NO_DOCKER=1`. SSH server host can be set via: `export OPENSSH_SERVER_HOST=127.0.0.1` SSH server port via existing: `export OPENSSH_SERVER_PORT=4711` This requires more work to be usable out of the box. The necessery sshd config is (partly) embedded into `tests/openssh_server/Dockerfile`. After this patch, it is possible to run tests in envs where docker is not installed or not available, by running a preconfigured, non-containerized sshd.
Member
Author
|
Some success: #!/bin/sh
cd "$(dirname "$0")" || exit 1
case "$(uname)" in
Darwin*) sed() { gsed "$@"; };;
esac
CURL_PATH='../../curl'
cp -p \
"${CURL_PATH}"/tests/pathhelp.pm \
"${CURL_PATH}"/tests/serverhelp.pm \
"${CURL_PATH}"/tests/sshhelp.pm \
.
# shellcheck disable=SC2016
sed \
-e '/"HostKey /a push @cfgarr, "HostKey ".abs_path("$path/curl_host_ecdsa_key");' \
-e '/"HostKey /a push @cfgarr, "HostKey ".abs_path("$path/curl_host_ed25519_key");' \
-e 's/PasswordAuthentication no/PasswordAuthentication yes/g' \
-e 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' \
< "${CURL_PATH}"/tests/sshserver.pl > sshserver.pl
cp -p openssh_server/authorized_keys curl_client_key.pub
chmod 600 curl_client_key.pub
for t in rsa ecdsa ed25519; do
cp -p "openssh_server/ssh_host_${t}_key" "curl_host_${t}_key"
chmod 600 "curl_host_${t}_key"
ssh-keygen -y -f "curl_host_${t}_key" > "curl_host_${t}_key.pub"
cut -d ' ' -f 2 < "curl_host_${t}_key.pub" | base64 -d | openssl dgst -md5 | tr -d \\n > "curl_host_${t}_key.pub_md5"
cut -d ' ' -f 2 < "curl_host_${t}_key.pub" | base64 -d | openssl dgst -sha256 -binary | base64 | tr -d \\n > "curl_host_${t}_key.pub_sha256"
done
perl -I. sshserver.pl --sshport 4711 --user libssh2Then: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
via
export OPENSSH_NO_DOCKER=1.SSH server host can be set via:
export OPENSSH_SERVER_HOST=127.0.0.1SSH server port via existing:
export OPENSSH_SERVER_PORT=4711This requires more work to be usable out of the box. The necessery sshd config is (partly) embedded into
tests/openssh_server/Dockerfile.After this patch, it is possible to run tests in envs where docker is not installed or not available, by running a preconfigured, non-containerized sshd.
Diff without whitespaces: https://github.com/libssh2/libssh2/pull/762/files?w=1