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

Karanbir Singh c127b6
#!/bin/sh
Karanbir Singh c127b6
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
Karanbir Singh c127b6
done