Added readme
This commit is contained in:
parent
9c15010107
commit
47acb8f729
4 changed files with 35 additions and 8 deletions
37
README.md
37
README.md
|
|
@ -1,10 +1,37 @@
|
||||||
# Ubuntu Howdy
|
# Howdy for Ubuntu
|
||||||
|
|
||||||
Windows Hello™ style authentication for Ubuntu
|
Windows Hello™ style authentication for Ubuntu. Use your build in IR emitters and camera in combination with face recognition to prove who you are.
|
||||||
|
|
||||||
Notes:
|
### Installation
|
||||||
|
|
||||||
tail /var/log/auth.log
|
Fist we need to install pam-python, fswebcam and OpenCV from the Ubuntu repositories:
|
||||||
|
|
||||||
/etc/pam.d/sudo
|
```
|
||||||
|
sudo apt install libpam-python fswebcam libopencv-dev python-opencv
|
||||||
|
```
|
||||||
|
|
||||||
|
After that, install the face_recognition python module. There's an excellent step by step guide on how to do this on [its github page](https://github.com/ageitgey/face_recognition#installation).
|
||||||
|
|
||||||
|
In the root of your cloned repo is a file called `config_template.py`. Duplicate this file and call it `config.py`. The `device_id` variable in this file is important, make sure it is the IR camera and not your normal webcam.
|
||||||
|
|
||||||
|
Now it's time to let Howdy learn your face. The learn.py script will make 3 models of your face and store them as an encoded set in the `models` folder. To run the script, open a terminal, navigate to this repository and run:
|
||||||
|
|
||||||
|
```
|
||||||
|
python3 learn.py
|
||||||
|
```
|
||||||
|
|
||||||
|
The script should guide you through the process.
|
||||||
|
|
||||||
|
Finally we need to tell PAM that there's a new module installed. Open `/etc/pam.d/sudo` as root (`sudo nano /etc/pam.d/sudo`) and add the following line to the top of the file:
|
||||||
|
|
||||||
|
```
|
||||||
auth sufficient pam_python.so /path/to/pam.py
|
auth sufficient pam_python.so /path/to/pam.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace the final argument with the full path to pam.py in this repository. The `sufficient` control tells PAM that Howdy is enough to authenticate the user, but if it fails we can fall back on more traditional methods.
|
||||||
|
|
||||||
|
If nothing went wrong we should be able to run sudo by just showing your face. Open a new terminal and run `sudo -i` to see it in action.
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
|
||||||
|
Any errors in the script itself get logged directly into the console and should indicate what went wrong. If authentication still fails but no errors are printed you could take a look at the last lines in `/var/log/auth.log` to see if anything has been reported there.
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ encodings = []
|
||||||
tries = 0
|
tries = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
encodings = json.load(open(os.path.dirname(__file__) + "/models/lem.dat"))
|
encodings = json.load(open(os.path.dirname(__file__) + "/models/" + user + ".dat"))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
stop(10)
|
stop(10)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
certainty = 3
|
certainty = 3
|
||||||
|
|
||||||
# The number of frames to capture and to process before timing out
|
# The number of frames to capture and to process before timing out
|
||||||
frame_count = 120
|
frame_count = 80
|
||||||
|
|
||||||
# The /dev/videoX id to capture frames from
|
# The /dev/videoX id to capture frames from
|
||||||
# On my laptop, video0 is the normal camera and video1 is the IR version
|
# On my laptop, video0 is the normal camera and video1 is the IR version
|
||||||
|
|
|
||||||
2
pam.py
2
pam.py
|
|
@ -9,7 +9,7 @@ def doAuth(pamh):
|
||||||
print("No face model is known for this user, skiping")
|
print("No face model is known for this user, skiping")
|
||||||
return pamh.PAM_SYSTEM_ERR
|
return pamh.PAM_SYSTEM_ERR
|
||||||
if status == 11:
|
if status == 11:
|
||||||
print("Timeout reached, ould not find a known face")
|
print("Timeout reached, could not find a known face")
|
||||||
return pamh.PAM_SYSTEM_ERR
|
return pamh.PAM_SYSTEM_ERR
|
||||||
if status == 0:
|
if status == 0:
|
||||||
print("Identified face as " + os.environ.get("USER"))
|
print("Identified face as " + os.environ.get("USER"))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue