diff --git a/.travis.yml b/.travis.yml index 2997d16..3e0a5f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,11 @@ script: # Install the binary, running the debian scripts in the process - sudo apt install ../*.deb -y + # Go through function tests - ./tests/importing.sh - ./tests/passthrough.sh + - ./tests/pam.sh + - ./tests/compare.sh # Remove howdy from the installation - sudo apt purge howdy -y @@ -27,3 +30,4 @@ addons: - ack-grep - devscripts - fakeroot + - pamtester diff --git a/tests/compare.sh b/tests/compare.sh new file mode 100755 index 0000000..969d550 --- /dev/null +++ b/tests/compare.sh @@ -0,0 +1,29 @@ +# TEST MODEL-FRAME COMPARE FUNCTIONS +set -o xtrace +set -e + +# Make sure howdy is clean before starting +sudo howdy clear -y || true + +# Learn match 1 +sudo sed -i "s,device_path.*,device_path = $PWD\/tests\/video\/match1.m4v,g" /lib/security/howdy/config.ini +sudo howdy add -y + +# Text compare matching with same camera input +sudo python3 /lib/security/howdy/compare.py $USER + +# Change to match 2 and compare against the modal of match 1, which should fail +sudo sed -i "s,device_path.*,device_path = $PWD\/tests\/video\/match2.m4v,g" /lib/security/howdy/config.ini +! sudo python3 /lib/security/howdy/compare.py $USER + +# Add match 2 as a model to compare both 1 and 2 at the same time +sudo howdy add -y +sudo python3 /lib/security/howdy/compare.py $USER + +# Compare against a camera with no visible face +sudo sed -i "s,device_path.*,device_path = $PWD\/tests\/video\/noMatch.m4v,g" /lib/security/howdy/config.ini +! sudo python3 /lib/security/howdy/compare.py $USER + +# Clean up +sudo howdy clear -y +sudo sed -i "s,device_path.*,device_path = none,g" /lib/security/howdy/config.ini diff --git a/tests/importing.sh b/tests/importing.sh index 3f7bddd..4bb7c22 100755 --- a/tests/importing.sh +++ b/tests/importing.sh @@ -1,7 +1,9 @@ +# TEST INSTALLATION OF DEPENDENCIES +set -o xtrace +set -e + # Confirm the cv2 module has been installed correctly -echo "cv2 version:" sudo /usr/bin/env python3 -c "import cv2; print(cv2.__version__);" # Confirm the face_recognition module has been installed correctly -echo "face_recognition version:" sudo /usr/bin/env python3 -c "import face_recognition; print(face_recognition.__version__);" diff --git a/tests/pam.sh b/tests/pam.sh new file mode 100755 index 0000000..0f1f7a0 --- /dev/null +++ b/tests/pam.sh @@ -0,0 +1,32 @@ +# TEST THE PAM INTEGRATION +set -o xtrace +set -e + +# Make sure howdy is clean before starting +sudo howdy clear -y || true + +# Change active camera to match video 1 +sudo sed -i "s,device_path.*,device_path = $PWD\/tests\/video\/match1.m4v,g" /lib/security/howdy/config.ini + +# Let howdy add the match face +sudo howdy add -y + +# Test the PAM auth +timeout 10 pamtester login $USER authenticate + +# Clear the face models and change the camera to video 2 +sudo howdy clear -y +sudo sed -i "s,device_path.*,device_path = $PWD\/tests\/video\/match2.m4v,g" /lib/security/howdy/config.ini + +# Let howdy add the match face +sudo howdy add -y + +# Try to open a elevated session through PAM +timeout 10 pamtester login $USER open_session + +# Verify we can close sessions, even though howdy does not use this PAM function +timeout 10 pamtester login $USER close_session + +# Clean up +sudo howdy clear -y +sudo sed -i "s,device_path.*,device_path = none,g" /lib/security/howdy/config.ini diff --git a/tests/passthrough.sh b/tests/passthrough.sh old mode 100644 new mode 100755 index 8822b50..629d142 --- a/tests/passthrough.sh +++ b/tests/passthrough.sh @@ -1,3 +1,7 @@ +# TEST USER SUDO PASSTHOUGH (NON-ROOT) +set -o xtrace +set -e + # Check if the username passthough works correctly with sudo howdy | ack-grep --passthru --color "current active user: travis" sudo howdy | ack-grep --passthru --color "current active user: travis"