2020-10-14 21:00:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-26 22:29:28 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2022 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
|
2021-03-22 20:16:35 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-10-14 21:00:32 +00:00
|
|
|
echo "### These tests requires VirtualBox running with the following images"
|
|
|
|
echo 'vagrant@centos3'
|
|
|
|
|
|
|
|
SERVER1=centos3
|
|
|
|
SSHUSER1=vagrant
|
|
|
|
SSHLOGIN1=$SSHUSER1@$SERVER1
|
|
|
|
# server with shellshock hardened bash
|
|
|
|
SERVER2=172.27.27.1
|
|
|
|
SSHUSER2=parallel
|
|
|
|
export SSHLOGIN2=$SSHUSER2@$SERVER2
|
|
|
|
|
2020-10-22 19:47:01 +00:00
|
|
|
stdout ping -w 1 -c 1 centos3 >/dev/null || (
|
2020-10-14 21:00:32 +00:00
|
|
|
# Vagrant does not set the IP addr
|
|
|
|
cd testsuite/vagrant/tange/centos3/ 2>/dev/null
|
|
|
|
cd vagrant/tange/centos3/ 2>/dev/null
|
|
|
|
cd ../vagrant/tange/centos3/ 2>/dev/null
|
2021-10-03 18:31:55 +00:00
|
|
|
(
|
|
|
|
stdout vagrant up >/dev/null
|
|
|
|
vagrant ssh -c 'sudo ifconfig eth1 172.27.27.3' |
|
|
|
|
# Ignore empty ^M line
|
|
|
|
grep ..
|
|
|
|
) &
|
2020-10-22 19:47:01 +00:00
|
|
|
)
|
|
|
|
(
|
2020-10-14 21:00:32 +00:00
|
|
|
# Copy binaries to server
|
2020-10-22 19:47:01 +00:00
|
|
|
cd testsuite/vagrant/tange/centos3/ 2>/dev/null
|
|
|
|
cd vagrant/tange/centos3/ 2>/dev/null
|
|
|
|
cd ../vagrant/tange/centos3/ 2>/dev/null
|
2020-10-14 21:00:32 +00:00
|
|
|
cd ../../../..
|
|
|
|
scp -q .*/src/{parallel,sem,sql,niceload,env_parallel*} $SSHLOGIN1:bin/
|
|
|
|
ssh $SSHLOGIN1 'touch .parallel/will-cite; mkdir -p bin'
|
2020-10-22 19:47:01 +00:00
|
|
|
# Allow login from centos3 to $SSHLOGIN2 (that is shellshock hardened)
|
|
|
|
ssh $SSHLOGIN1 cat .ssh/id_rsa.pub | ssh $SSHLOGIN2 'cat >>.ssh/authorized_keys'
|
2020-10-14 21:00:32 +00:00
|
|
|
ssh $SSHLOGIN1 'cat .ssh/id_rsa.pub >>.ssh/authorized_keys; chmod 600 .ssh/authorized_keys'
|
|
|
|
ssh $SSHLOGIN1 'ssh -o StrictHostKeyChecking=no localhost true; ssh -o StrictHostKeyChecking=no '$SSHLOGIN2' true;'
|
|
|
|
) &
|
|
|
|
|
|
|
|
. `which env_parallel.bash`
|
|
|
|
env_parallel --session
|
|
|
|
|
|
|
|
par_shellshock_bug() {
|
|
|
|
bash -c 'echo bug \#43358: shellshock breaks exporting functions using --env name;
|
|
|
|
echo Non-shellshock-hardened to non-shellshock-hardened;
|
|
|
|
funky() { echo Function $1; };
|
|
|
|
export -f funky;
|
|
|
|
PARALLEL_SHELL=bash parallel --env funky -S localhost funky ::: non-shellshock-hardened'
|
|
|
|
|
|
|
|
bash -c 'echo bug \#43358: shellshock breaks exporting functions using --env name;
|
|
|
|
echo Non-shellshock-hardened to shellshock-hardened;
|
|
|
|
funky() { echo Function $1; };
|
|
|
|
export -f funky;
|
|
|
|
PARALLEL_SHELL=bash parallel --env funky -S '$SSHLOGIN2' funky ::: shellshock-hardened'
|
|
|
|
}
|
|
|
|
|
|
|
|
# As the copied environment is written in Bash dialect
|
|
|
|
# we get 'shopt'-errors and 'declare'-errors.
|
|
|
|
# We can safely ignore those.
|
|
|
|
export LC_ALL=C
|
|
|
|
export TMPDIR=/tmp
|
|
|
|
env_parallel --env par_shellshock_bug --env LC_ALL --env SSHLOGIN2 --env _ \
|
|
|
|
-vj9 -k --joblog /tmp/jl-`basename $0` --retries 3 \
|
|
|
|
-S $SSHLOGIN1 --tag '{} 2>&1' \
|
|
|
|
::: $(compgen -A function | grep par_ | sort) \
|
|
|
|
2> >(grep -Ev 'shopt: not found|declare: not found|No xauth data')
|