Skip to content

Commit faef639

Browse files
authored
Merge pull request #48 from boltgolt/dev
Version 2.3.0
2 parents 527db61 + 4bab7d9 commit faef639

File tree

11 files changed

+87
-33
lines changed

11 files changed

+87
-33
lines changed

README.md

+31-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,42 @@
1-
# Howdy for Linux [![](https://img.shields.io/travis/Boltgolt/howdy/master.svg)](https://travis-ci.org/Boltgolt/howdy) [![](https://img.shields.io/github/release/Boltgolt/howdy.svg?colorB=4c1)](https://github.com/Boltgolt/howdy/releases) ![](https://boltgolt.nl/howdy_badge/installs.php?nc) ![](https://boltgolt.nl/howdy_badge/views.php)
1+
# Howdy for Linux [![](https://img.shields.io/travis/boltgolt/howdy/master.svg)](https://travis-ci.org/boltgolt/howdy) [![](https://img.shields.io/github/release/boltgolt/howdy.svg?colorB=4c1)](https://github.com/boltgolt/howdy/releases) ![](https://boltgolt.nl/howdy_badge/installs.php?nc) ![](https://boltgolt.nl/howdy_badge/views.php)
22

3-
Windows Hello™ style authentication for Ubuntu. Use your built-in IR emitters and camera in combination with face recognition to prove who you are.
3+
Windows Hello™ style authentication for Linux. Use your built-in IR emitters and camera in combination with face recognition to prove who you are.
44

5-
Using the central authentication system in Linux (PAM), this works everywhere you would otherwise need your password: Login, lock screen, sudo, su, etc.
5+
Using the central authentication system (PAM), this works everywhere you would otherwise need your password: Login, lock screen, sudo, su, etc.
66

7-
### Installation
7+
## Installation
88

9-
* Ubuntu: Add the following ppa with ``` sudo add-apt-repository ppa:boltgolt/howdy ``` and ``` sudo apt update```. Then install Howdy with ``` sudo apt install howdy ```.
10-
11-
* Arch Linux: Install the following package from the AUR: ``` howdy ```. Please read the [ArchWiki entry](https://wiki.archlinux.org/index.php/Howdy) for additional information.
9+
Howdy is currently available for Ubuntu/Debian and Arch Linux. If you’re interested in packaging Howdy for your distro, don’t hesitate to open an issue.
1210

1311
**Note:** The build of dlib can hang on 100% for over a minute, give it time.
1412

15-
This will guide you through the installation. When that's done run `sudo howdy add` to add a face model.
13+
### Ubuntu (apt)
14+
15+
Run the installer by pasting (`ctrl+shift+V`) the following commands into the terminal one at a time:
16+
17+
```
18+
sudo add-apt-repository ppa:boltgolt/howdy
19+
sudo apt update
20+
sudo apt install howdy
21+
```
22+
23+
This will guide you through the installation.
24+
25+
### Arch Linux
26+
27+
Install the `howdy` package from the AUR. For AUR installation instructions, take a look at this [wiki page](https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages).
28+
29+
You will need to do some additional configuration steps. Please read the [ArchWiki entry](https://wiki.archlinux.org/index.php/Howdy) for more information.
30+
31+
## Setup
32+
33+
After installation, you need to let Howdy learn your face. Run `sudo howdy add` to add a face model.
1634

1735
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.
1836

19-
If you're curious you can run `sudo howdy config` to open the central config file and see the options Howdy has.
37+
If you're curious you can run `sudo howdy config` to open the central config file and see the options Howdy has. On most systems this will open the nano editor, where you have to press `ctrl`+`x` to save your changes.
2038

21-
### CLI
39+
## CLI
2240

2341
The installer adds a `howdy` command to manage face models for the current user. Use `howdy --help` or `man howdy` to list the available options.
2442

@@ -37,17 +55,17 @@ howdy [-U user] [-y] command [argument]
3755
| `remove` | Remove a specific model for an user |
3856
| `test` | Test the camera and recognition methods |
3957

40-
### Contributing [![](https://img.shields.io/travis/Boltgolt/howdy/dev.svg?label=dev%20build)](https://github.com/Boltgolt/howdy/tree/dev) [![](https://img.shields.io/github/issues-raw/Boltgolt/howdy/enhancement.svg?label=feature+requests&colorB=4c1)](https://github.com/Boltgolt/howdy/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
58+
## Contributing [![](https://img.shields.io/travis/boltgolt/howdy/dev.svg?label=dev%20build)](https://github.com/boltgolt/howdy/tree/dev) [![](https://img.shields.io/github/issues-raw/boltgolt/howdy/enhancement.svg?label=feature+requests&colorB=4c1)](https://github.com/boltgolt/howdy/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
4159

4260
You can contribute in many ways. The easiest are reporting bugs and opening github issues for features you'd like to see in howdy. Code contributions are also very welcome.
4361

44-
### Troubleshooting
62+
## Troubleshooting
4563

4664
Any python errors 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.
4765

4866
If you encounter an error that hasn't been reported yet, don't be afraid to open a new issue.
4967

50-
### A note on security
68+
## A note on security
5169

5270
This script is in no way as secure as a password and will never be. Although it's harder to fool than normal face recognition, a person who looks similar to you or well-printed photo of you could be enough to do it.
5371

debian/changelog

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
howdy (2.3.0) xenial; urgency=medium
2+
3+
* Added a config option to set the frame height and width (thanks @wzrdtales!)
4+
* Rewrote the code that fetches the non-root username (thanks @dmig!)
5+
* Changed the config command so it uses the default editor (thanks @stellarpower and @dmig!)
6+
* Fixed issue where a "y" could be interpreted as a no (thanks @ramkrishna757575!)
7+
* Fixed division by zeno (thanks @stellarpower!)
8+
9+
-- boltgolt <[email protected]> Thu, 28 Jun 2018 14:59:52 +0100
10+
111
howdy (2.2.2) xenial; urgency=medium
212

313
* Fixed fetching of wrong config section (thanks @halcyoncheng and @arifeinberg!)

debian/control

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Priority: optional
44
Standards-Version: 3.9.7
55
Build-Depends: python, dh-python, devscripts, dh-make, debhelper
66
Maintainer: boltgolt <[email protected]>
7-
Vcs-Git: https://github.com/Boltgolt/howdy
7+
Vcs-Git: https://github.com/boltgolt/howdy
88

99
Package: howdy
10-
Homepage: https://github.com/Boltgolt/howdy
10+
Homepage: https://github.com/boltgolt/howdy
1111
Architecture: all
1212
Depends: ${misc:Depends}, git, python3, python3-pip, python3-dev, python3-setuptools, build-essential, libpam-python, fswebcam, libopencv-dev, python-opencv, cmake
13-
Description: Howdy: Windows Hello style authentication for Ubuntu.
13+
Description: Howdy: Windows Hello style authentication for Linux.
1414
Use your built-in IR emitters and camera in combination with face recognition
1515
to prove who you are.

debian/howdy.1

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" Please adjust this date whenever revising the manpage.
22
.TH HOWDY 1 "April 9, 2018" "Howdy help" "User Commands"
33
.SH NAME
4-
howdy \- Windows Hello style authentication for Ubuntu
4+
howdy \- Windows Hello style authentication for Linux
55
.SH DESCRIPTION
66
Howdy IR face recognition implements a PAM module to use your face as a authentication method.
77
.SS "Usage:"
@@ -44,4 +44,4 @@ Skip all questions.
4444
Show this help message and exit.
4545
.PP
4646
.SH AUTHOR
47-
Howdy was written by boltgolt. For more information visit https://github.com/Boltgolt/howdy
47+
Howdy was written by boltgolt. For more information visit https://github.com/boltgolt/howdy

debian/postinst

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ if "HOWDY_NO_PROMPT" not in os.environ:
187187
ans = input("Apply this change? [y/N]: ")
188188

189189
# Abort the whole thing if it's not
190-
if (ans.lower() != "y"):
190+
if ans.lower().strip() != "y" or ans.lower().strip() == "yes":
191191
print("Interpreting as a \"NO\", aborting")
192192
sys.exit(1)
193193

@@ -223,7 +223,7 @@ if "HOWDY_NO_PROMPT" not in os.environ:
223223
diag_out += "```"
224224

225225
# Print it all as a clickable link to a new github issue
226-
print("https://github.com/Boltgolt/howdy-reports/issues/new?title=Post-installation%20camera%20information&body=" + urllib.parse.quote_plus(diag_out) + "\n")
226+
print("https://github.com/boltgolt/howdy-reports/issues/new?title=Post-installation%20camera%20information&body=" + urllib.parse.quote_plus(diag_out) + "\n")
227227

228228
# Let the user know what to do with the link
229229
print("Installation complete.")

debian/preinst

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ for dev in devices:
8989
os.killpg(os.getpgid(sub.pid), signal.SIGTERM)
9090

9191
# Set this camera as picked if the answer was yes, go to the next one if no
92-
if ans.lower() == "y" or ans.lower() == "yes":
92+
if ans.lower().strip() == "y" or ans.lower().strip() == "yes":
9393
picked = dev[5:]
9494
break
9595
else:

src/cli.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
import builtins
1111

1212
# Try to get the original username (not "root") from shell
13-
user = subprocess.check_output("echo $(logname 2>/dev/null || echo $SUDO_USER)", shell=True).decode("ascii").strip()
13+
try:
14+
user = os.getlogin()
15+
except:
16+
user = os.environ.get("SUDO_USER")
1417

1518
# If that fails, try to get the direct user
16-
if user == "root" or user == "":
19+
if user == "root" or user == None:
1720
env_user = getpass.getuser().strip()
1821

1922
# If even that fails, error out
@@ -28,7 +31,7 @@
2831
formatter_class=argparse.RawDescriptionHelpFormatter,
2932
add_help=False,
3033
prog="howdy",
31-
epilog="For support please visit\nhttps://github.com/Boltgolt/howdy")
34+
epilog="For support please visit\nhttps://github.com/boltgolt/howdy")
3235

3336
# Add an argument for the command
3437
parser.add_argument("command",
@@ -73,7 +76,8 @@
7376
# Check if we have rootish rights
7477
# This is this far down the file so running the command for help is always possible
7578
if os.getenv("SUDO_USER") is None:
76-
print("Please run this command with sudo")
79+
print("Please run this command as root:\n")
80+
print("\tsudo howdy " + " ".join(sys.argv[1:]))
7781
sys.exit(1)
7882

7983
# Beond this point the user can't change anymore, if we still have root as user we need to abort

src/cli/config.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
import subprocess
77

88
# Let the user know what we're doing
9-
print("Opening config.ini in gedit")
9+
print("Opening config.ini in the default editor")
1010

1111
# Open gedit as a subprocess and fork it
12-
subprocess.Popen(["gedit", os.path.dirname(os.path.realpath(__file__)) + "/../config.ini"],
13-
cwd="/",
14-
stdout=subprocess.PIPE,
15-
stderr=subprocess.STDOUT)
12+
subprocess.call(["/etc/alternatives/editor", os.path.dirname(os.path.realpath(__file__)) + "/../config.ini"])

src/cli/test.py

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
if config.get("video", "force_mjpeg") == "true":
2525
video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237)
2626

27+
# Set the frame width and height if requested
28+
if int(config.get("video", "frame_width")) != -1:
29+
video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, int(config.get("video", "frame_width")))
30+
31+
if int(config.get("video", "frame_height")) != -1:
32+
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, int(config.get("video", "frame_height")))
33+
2734
# Let the user know what's up
2835
print("""
2936
Opening a window with a test feed

src/compare.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,16 @@ def stop(status):
6262

6363
# Force MJPEG decoding if true
6464
if config.get("video", "force_mjpeg") == "true":
65+
# Set a magic number, will enable MJPEG but is badly documentated
6566
video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237)
6667

68+
# Set the frame width and height if requested
69+
if int(config.get("video", "frame_width")) != -1:
70+
video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, int(config.get("video", "frame_width")))
71+
72+
if int(config.get("video", "frame_height")) != -1:
73+
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, int(config.get("video", "frame_height")))
74+
6775
# Capture a single frame so the camera becomes active
6876
# This will let the camera adjust its light levels while we're importing for faster scanning
6977
video_capture.read()
@@ -97,6 +105,11 @@ def stop(status):
97105
# All values combined for percentage calculation
98106
hist_total = int(sum(hist)[0])
99107

108+
# If the image is fully black, skip to the next frame
109+
if hist_total == 0:
110+
dark_tries += 1
111+
continue
112+
100113
# Scrip the frame if it exceeds the threshold
101114
if float(hist[0]) / hist_total * 100 > float(config.get("video", "dark_threshold")):
102115
dark_tries += 1
@@ -159,5 +172,5 @@ def print_timing(label, offset):
159172

160173
print("Winning model: " + str(match_index) + " (\"" + models[match_index]["label"] + "\")")
161174

162-
# End peacegully
175+
# End peacefully
163176
stop(0)

src/config.ini

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Howdy config file
2+
# Press CTRL + X to save in the nano editor
23

34
[core]
45
# Do not print anything when a face verification succeeds
@@ -37,6 +38,12 @@ max_height = 320
3738
# YUYV raw frame deconding
3839
force_mjpeg = false
3940

41+
# Set the camera input profile to this width and height
42+
# The largest profile will be used if set to -1
43+
# Automatically ignored if not a valid profile
44+
frame_width = -1
45+
frame_height = -1
46+
4047
# Because of flashing IR emitters, some frames can be completely unlit
4148
# Skip the frame if the lowest 1/8 of the histogram is above this percentage
4249
# of the total
@@ -46,5 +53,3 @@ dark_threshold = 50
4653
[debug]
4754
# Show a short but detailed diagnostic report in console
4855
end_report = false
49-
50-
dummy = true

0 commit comments

Comments
 (0)