FaceAuth is a user authentication system based on face recognition, featuring a modern graphical interface and seamless integration with Linux systems (e.g., PAM). The application allows you to log in or authorize privileged actions (such as sudo) using your face instead of a typed password, or as an additional security layer.
Remember:
FaceAuth uses 2D face recognition based on a standard webcam image. This approach is convenient and user-friendly, but it is not foolproof or as secure as advanced biometric systems (such as 3D or infrared recognition). The system may be vulnerable to sophisticated spoofing attacks (e.g., high-quality photos or videos). For critical security scenarios, always use FaceAuth as a supplement to strong passwords, not as the sole protection.
- Add and remove your own face templates (stored locally)
- Real-time face recognition for the user
- System login integration (PAM) via a custom daemon and C module
- User-friendly graphical interface (PyQt5)
- Support for multiple face templates per user
- Adding a face – The user positions their face in front of the camera and saves a template, which is processed by dlib models and stored as a feature vector.
- Recognition – During login, the application compares the current camera image with saved templates.
- PAM integration – The C module communicates with the daemon, which performs face recognition and returns the result to the system.
- Python 3 – main application language
- PyQt5 – graphical user interface
- OpenCV – camera handling and image processing
- dlib – face detection, landmark extraction, and feature vector generation
- NumPy – numerical operations and feature vector handling
- PAM (Pluggable Authentication Modules) – Linux login integration (optional)
- C – intermediary module for PAM
68_face_landmarks_model_v2.dat– custom-trained dlib model for detecting 68 facial landmarks, required for proper feature extraction.dlib_face_recognition_resnet_model_v1.dat– dlib model based on ResNet, generating a unique face feature vector for comparison and recognition.
- Python 3.7+
- dlib
- OpenCV
- PyQt5
- NumPy
- PAM (optional, for system integration)
-
Install the required libraries:
pip install -r requirements.txt
If you don't have a
requirements.txtfile, you can install the main dependencies manually:pip install dlib opencv-python PyQt5 numpy
-
Make sure the dlib models are present in the project directory:
68_face_landmarks_model_v2.datdlib_face_recognition_resnet_model_v1.dat
-
Create your face template(s):
- Run the main application to add your face:
python3 main.py
- Use the GUI to add and save your face template(s). These will be stored locally for your user.
- Run the main application to add your face:
-
Set up the PAM daemon:
- Add
pam-module-deamon.pyto autostart (e.g., as a systemd service or a background process at login), so it runs in the background and listens for authentication requests.
- Add
-
Configure PAM:
- Edit the PAM configuration file for the service you want to protect, for example for
sudo:sudo nano /etc/pam.d/sudo
- Add the following line at the top:
Replace
auth sufficient pam_exec.so stdout /path/to/face-auth/face-auth/path/to/face-authwith the path to your compiled C module that communicates with the daemon.
- Edit the PAM configuration file for the service you want to protect, for example for
-
(Optional) Compile the C module:
- If you use the provided C intermediary for PAM:
gcc -o face-auth face_auth.c
- If you use the provided C intermediary for PAM:
Project released under the MIT license.
