Skip to content

Instantly share code, notes, and snippets.

@TBK
Created March 28, 2018 15:19
Show Gist options
  • Save TBK/74d3c956093e4fa62491a57bdcc78513 to your computer and use it in GitHub Desktop.
Save TBK/74d3c956093e4fa62491a57bdcc78513 to your computer and use it in GitHub Desktop.
check() {
cd "$builddir"
# Setup user and cert
adduser -D sshuser
echo "sshuser:sshpassword" | chpasswd
mkdir -p ~sshuser/.ssh
chown sshuser:sshuser ~sshuser/.ssh
sh -c "cat $(pwd)/tests/testkey_rsa.pub >> ~sshuser/.ssh/authorized_keys"
chown sshuser:sshuser ~sshuser/.ssh/authorized_keys
chmod 600 ~sshuser/.ssh/authorized_keys
# Run dropbear
dropbear -r tests/testkey_rsa -P /tmp/php7-ssh2.pid
export "TEST_SSH2_HOSTNAME=localhost"
export "TEST_SSH2_USER=sshuser"
export "TEST_SSH2_PASS=sshpassword"
make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test
# Kill dropbear
pkill -F /tmp/php7-ssh2.pid
# Cleanup
rm -rf ~sshuser
deluser sshuser
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment