mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
Added more in-depth test
This commit is contained in:
parent
873211da4c
commit
2318034610
5 changed files with 73 additions and 2 deletions
|
@ -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
|
||||
|
|
29
tests/compare.sh
Executable file
29
tests/compare.sh
Executable file
|
@ -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
|
|
@ -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__);"
|
||||
|
|
32
tests/pam.sh
Executable file
32
tests/pam.sh
Executable file
|
@ -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
|
4
tests/passthrough.sh
Normal file → Executable file
4
tests/passthrough.sh
Normal file → Executable file
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue