Blame tests/p_openssh/sshd_user_login-with-key.sh

Karanbir Singh c127b6
#!/bin/sh
Karanbir Singh c127b6
2b3708
uname_arch=$(uname -m)
2b3708
2b3708
if [ "$uname_arch" == "armv7l" ]; then
2b3708
  t_Log "*** Not testing on Arch: $uname_arch ***"
2b3708
  exit 0
2b3708
fi
2b3708
Karanbir Singh c127b6
for KeyType in rsa dsa; do 
Karanbir Singh c127b6
	userdel -rf sshtest; useradd sshtest && echo sshtest | passwd --stdin sshtest
Karanbir Singh c127b6
	runuser -l sshtest -c "echo | ssh-keygen -q -t ${KeyType} -b 1024 -f ~/.ssh/id_${KeyType}" > /dev/null
Karanbir Singh c127b6
	runuser -l sshtest -c "cat ~/.ssh/*pub > ~/.ssh/authorized_keys && chmod 600 ~/.ssh/*keys" > /dev/null
Karanbir Singh c127b6
	cp ./tests/p_openssh/_helper_sshd_user_login-with-key.expect /home/sshtest/ && chmod +x /home/sshtest/*.expect
Karanbir Singh c127b6
Karanbir Singh c127b6
	# Create a test file
Karanbir Singh c127b6
	TestString=$( mktemp -u )
Karanbir Singh c127b6
	echo $TestString > /home/sshtest/ssh_test_file
Karanbir Singh c127b6
Karanbir Singh c127b6
	t_Log "Running $0 - SSH User can login using ${KeyType} key."
Karanbir Singh c127b6
	runuser -l sshtest -c "~/_helper_sshd_user_login-with-key.expect" | grep ${TestString}  > /dev/null 2>&1
Karanbir Singh c127b6
	t_CheckExitStatus $?
Karanbir Singh c127b6
	userdel -rf sshtest
2b3708
done