From be788cbacba7338113c12b1f5a13fb0e4b562676 Mon Sep 17 00:00:00 2001 From: Bart Seghers Date: Wed, 1 Oct 2025 09:49:09 +0200 Subject: [PATCH] Fix build --- .../howdy/dh_installchangelogs.dch.trimmed | 78 +++++++ .../generated/howdy/installed-by-dh_install | 14 ++ .../howdy/installed-by-dh_installdocs | 0 .../howdy/installed-by-dh_installman | 1 + debian/.debhelper/howdy/dbgsym-build-ids | 1 + .../howdy/dbgsym-root/DEBIAN/control | 12 + .../howdy/dbgsym-root/DEBIAN/md5sums | 2 + .../dbgsym-root/usr/share/doc/howdy-dbgsym | 1 + debian/changelog | 167 ++++++++++++++ debian/compat | 1 + debian/control | 17 ++ debian/copyright | 21 ++ debian/howdy.lintian-overrides | 7 + debian/howdy.manpages | 1 + debian/install | 18 ++ debian/postinst | 209 ++++++++++++++++++ debian/preinst | 30 +++ debian/prerm | 45 ++++ debian/rules | 22 ++ debian/source/format | 1 + debian/source/options | 14 ++ howdy.1 | 1 + meson.options | 4 +- 23 files changed, 665 insertions(+), 2 deletions(-) create mode 100644 debian/.debhelper/generated/howdy/dh_installchangelogs.dch.trimmed create mode 100644 debian/.debhelper/generated/howdy/installed-by-dh_install create mode 100644 debian/.debhelper/generated/howdy/installed-by-dh_installdocs create mode 100644 debian/.debhelper/generated/howdy/installed-by-dh_installman create mode 100644 debian/.debhelper/howdy/dbgsym-build-ids create mode 100644 debian/.debhelper/howdy/dbgsym-root/DEBIAN/control create mode 100644 debian/.debhelper/howdy/dbgsym-root/DEBIAN/md5sums create mode 120000 debian/.debhelper/howdy/dbgsym-root/usr/share/doc/howdy-dbgsym create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/howdy.lintian-overrides create mode 100644 debian/howdy.manpages create mode 100644 debian/install create mode 100755 debian/postinst create mode 100755 debian/preinst create mode 100755 debian/prerm create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/options create mode 120000 howdy.1 diff --git a/debian/.debhelper/generated/howdy/dh_installchangelogs.dch.trimmed b/debian/.debhelper/generated/howdy/dh_installchangelogs.dch.trimmed new file mode 100644 index 00000000..a4bbffa1 --- /dev/null +++ b/debian/.debhelper/generated/howdy/dh_installchangelogs.dch.trimmed @@ -0,0 +1,78 @@ +howdy (3.0.0+nmu5) plucky; urgency=medium + + * Non-maintainer upload. + * Fix python3 lcoation + + -- Bart Seghers Wed, 01 Oct 2025 09:30:56 +0200 + +howdy (3.0.0+nmu4) plucky; urgency=medium + + * Non-maintainer upload. + * Switch to plucky to fix build + + -- Bart Seghers Wed, 01 Oct 2025 09:24:07 +0200 + +howdy (3.0.0+nmu3) focal; urgency=medium + + * Non-maintainer upload. + * + + -- Bart Seghers Wed, 01 Oct 2025 08:59:48 +0200 + +howdy (3.0.0+nmu2) focal; urgency=medium + + * Non-maintainer upload. + * Upload to personal PPA + * + + -- Bart Seghers Wed, 01 Oct 2025 08:42:02 +0200 + +howdy (3.0.0) focal; urgency=medium + + * Way too many changes to all list individually, thanks to everyone who contributed! + * Rewrote PAM handling logic in C++ (thanks @saidsay-so!) + * Added simultaneous face recognition and password authentication + * Added native dialog dismissal after successful authentication + * Added configurable image rotation (thanks @matan-arnon!) + * Fixed four config options whose names were opposite of their function + + -- boltgolt Sun, 22 Jun 2025 11:52:44 +0200 + +howdy (2.6.1) xenial; urgency=medium + + * Fixed accidentally using emergency priority for log messages (thanks @kageurufu and many others!) + * Fixed certainty prompt selected the exact opposite value + * Fixed sleeping for negative time in test slow mode (thanks @willwill2will54!) + * Fixed opencv error when imported after dlib (thanks @cnyk!) + * Fixed typo causing manual exposure failure (thanks @h45h74x!) + * Fixed missing command autocomplete options on tab + * Fixed not knowing how to spell the word latest (thanks @divykj!) + + -- boltgolt Wed, 02 Sep 2020 15:05:59 +0200 + +howdy (2.6.0) xenial; urgency=medium + + * Added new options to capture a snapshot of failed or even successful logins + * Added command that creates a new snapshot and saves it + * Added version command + * Added question to automatically set certainty value on installation + * Added automatic logging to system-wide auth.log + * Added clearer feedback when login is rejected due to dark frames (thanks @andrewmv!) + * Refactored video capture logic (thanks @AnthonyWharton!) + * Reordered the editor priorities for the config command + * Fixed gstreamer warnings showing up in console (thanks @ajnart!) + * Fixed issue where add command would never end + * Fixed test command overlay not being in color (thanks @PetePriority!) + * Fixed typo preventing timeout config option from working (thanks @Ajayneethikannan!) + * Fixed old numpy installation failure (thanks @rushabh-v!) + * Fixed issue where no PAM response would be returned + * Fixed CLAHE not being applied equally to all video commands (thanks @PetePriority!) + * Fixed an incorrect suggested command (thanks @TheButlah!) + * Fixed missing release method in video capture class + * Removed deprecated dlib flags (thanks @rhysperry111!) + * Removed streamer as a required dependency + + -- boltgolt Mon, 22 Jun 2020 16:11:46 +0200 + +# Older entries have been removed from this changelog. +# To read the complete changelog use `apt changelog howdy`. diff --git a/debian/.debhelper/generated/howdy/installed-by-dh_install b/debian/.debhelper/generated/howdy/installed-by-dh_install new file mode 100644 index 00000000..839ce269 --- /dev/null +++ b/debian/.debhelper/generated/howdy/installed-by-dh_install @@ -0,0 +1,14 @@ +./howdy/src/cli/. +./howdy/src/recorders/. +./howdy/src/rubberstamps/. +./howdy/src/cli.py +./howdy/src/compare.py +./howdy/src/i18n.py +./howdy/src/logo.png +./howdy/src/snapshot.py +./build/howdy/src/pam/pam_howdy.so +./howdy/src/dlib-data/. +./howdy/src/config.ini +./howdy/src/autocomplete/. +./howdy/src/pam-config/. +./howdy/howdy.1 diff --git a/debian/.debhelper/generated/howdy/installed-by-dh_installdocs b/debian/.debhelper/generated/howdy/installed-by-dh_installdocs new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/howdy/installed-by-dh_installman b/debian/.debhelper/generated/howdy/installed-by-dh_installman new file mode 100644 index 00000000..320ead1f --- /dev/null +++ b/debian/.debhelper/generated/howdy/installed-by-dh_installman @@ -0,0 +1 @@ +./howdy.1 diff --git a/debian/.debhelper/howdy/dbgsym-build-ids b/debian/.debhelper/howdy/dbgsym-build-ids new file mode 100644 index 00000000..a333610a --- /dev/null +++ b/debian/.debhelper/howdy/dbgsym-build-ids @@ -0,0 +1 @@ +9c09d29d02a6bc266425dd2c249f87fde09479e5 9c09d29d02a6bc266425dd2c249f87fde09479e5 9c09d29d02a6bc266425dd2c249f87fde09479e5 9c09d29d02a6bc266425dd2c249f87fde09479e5 9c09d29d02a6bc266425dd2c249f87fde09479e5 9c09d29d02a6bc266425dd2c249f87fde09479e5 9c09d29d02a6bc266425dd2c249f87fde09479e5 9c09d29d02a6bc266425dd2c249f87fde09479e5 64b8105e4a26271e88da5fb451b4316063d69781 64b8105e4a26271e88da5fb451b4316063d69781 64b8105e4a26271e88da5fb451b4316063d69781 \ No newline at end of file diff --git a/debian/.debhelper/howdy/dbgsym-root/DEBIAN/control b/debian/.debhelper/howdy/dbgsym-root/DEBIAN/control new file mode 100644 index 00000000..b5ea2221 --- /dev/null +++ b/debian/.debhelper/howdy/dbgsym-root/DEBIAN/control @@ -0,0 +1,12 @@ +Package: howdy-dbgsym +Source: howdy +Version: 3.0.0+nmu5 +Auto-Built-Package: debug-symbols +Architecture: amd64 +Maintainer: boltgolt +Installed-Size: 663 +Depends: howdy (= 3.0.0+nmu5) +Section: debug +Priority: optional +Description: debug symbols for howdy +Build-Ids: 9c09d29d02a6bc266425dd2c249f87fde09479e5 64b8105e4a26271e88da5fb451b4316063d69781 diff --git a/debian/.debhelper/howdy/dbgsym-root/DEBIAN/md5sums b/debian/.debhelper/howdy/dbgsym-root/DEBIAN/md5sums new file mode 100644 index 00000000..7a32d60b --- /dev/null +++ b/debian/.debhelper/howdy/dbgsym-root/DEBIAN/md5sums @@ -0,0 +1,2 @@ +882d62bfaa684d06aaf10c6e54dba18d usr/lib/debug/.build-id/64/b8105e4a26271e88da5fb451b4316063d69781.debug +f9048db921176dc70957f52bc398a03c usr/lib/debug/.build-id/9c/09d29d02a6bc266425dd2c249f87fde09479e5.debug diff --git a/debian/.debhelper/howdy/dbgsym-root/usr/share/doc/howdy-dbgsym b/debian/.debhelper/howdy/dbgsym-root/usr/share/doc/howdy-dbgsym new file mode 120000 index 00000000..729e5cf4 --- /dev/null +++ b/debian/.debhelper/howdy/dbgsym-root/usr/share/doc/howdy-dbgsym @@ -0,0 +1 @@ +howdy \ No newline at end of file diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..769cbfd9 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,167 @@ +howdy (3.0.0+nmu5) plucky; urgency=medium + + * Non-maintainer upload. + * Fix python3 lcoation + + -- Bart Seghers Wed, 01 Oct 2025 09:30:56 +0200 + +howdy (3.0.0+nmu4) plucky; urgency=medium + + * Non-maintainer upload. + * Switch to plucky to fix build + + -- Bart Seghers Wed, 01 Oct 2025 09:24:07 +0200 + +howdy (3.0.0+nmu3) focal; urgency=medium + + * Non-maintainer upload. + * + + -- Bart Seghers Wed, 01 Oct 2025 08:59:48 +0200 + +howdy (3.0.0+nmu2) focal; urgency=medium + + * Non-maintainer upload. + * Upload to personal PPA + * + + -- Bart Seghers Wed, 01 Oct 2025 08:42:02 +0200 + +howdy (3.0.0) focal; urgency=medium + + * Way too many changes to all list individually, thanks to everyone who contributed! + * Rewrote PAM handling logic in C++ (thanks @saidsay-so!) + * Added simultaneous face recognition and password authentication + * Added native dialog dismissal after successful authentication + * Added configurable image rotation (thanks @matan-arnon!) + * Fixed four config options whose names were opposite of their function + + -- boltgolt Sun, 22 Jun 2025 11:52:44 +0200 + +howdy (2.6.1) xenial; urgency=medium + + * Fixed accidentally using emergency priority for log messages (thanks @kageurufu and many others!) + * Fixed certainty prompt selected the exact opposite value + * Fixed sleeping for negative time in test slow mode (thanks @willwill2will54!) + * Fixed opencv error when imported after dlib (thanks @cnyk!) + * Fixed typo causing manual exposure failure (thanks @h45h74x!) + * Fixed missing command autocomplete options on tab + * Fixed not knowing how to spell the word latest (thanks @divykj!) + + -- boltgolt Wed, 02 Sep 2020 15:05:59 +0200 + +howdy (2.6.0) xenial; urgency=medium + + * Added new options to capture a snapshot of failed or even successful logins + * Added command that creates a new snapshot and saves it + * Added version command + * Added question to automatically set certainty value on installation + * Added automatic logging to system-wide auth.log + * Added clearer feedback when login is rejected due to dark frames (thanks @andrewmv!) + * Refactored video capture logic (thanks @AnthonyWharton!) + * Reordered the editor priorities for the config command + * Fixed gstreamer warnings showing up in console (thanks @ajnart!) + * Fixed issue where add command would never end + * Fixed test command overlay not being in color (thanks @PetePriority!) + * Fixed typo preventing timeout config option from working (thanks @Ajayneethikannan!) + * Fixed old numpy installation failure (thanks @rushabh-v!) + * Fixed issue where no PAM response would be returned + * Fixed CLAHE not being applied equally to all video commands (thanks @PetePriority!) + * Fixed an incorrect suggested command (thanks @TheButlah!) + * Fixed missing release method in video capture class + * Removed deprecated dlib flags (thanks @rhysperry111!) + * Removed streamer as a required dependency + + -- boltgolt Mon, 22 Jun 2020 16:11:46 +0200 + +howdy (2.5.1) xenial; urgency=medium + + * Removed dismiss_lockscreen as it could lock users out of their system (thanks @ujjwalbe, @ju916 and many others!) + * Added option to disable howdy when the laptop lid is closed (thanks @accek!) + * Added automatic fallback to default frame color palette (thanks @Ethiarpus!) + * Added manual exposure setting (thanks @accek!) + * Fixed test command ignoring dark frame threshold (thanks @eduncan911!) + * Fixed import error in v4l2 recorder (thanks @timwelch!) + + -- boltgolt Fri, 29 Mar 2019 23:02:21 +0100 + +howdy (2.5.0) xenial; urgency=medium + + * Added FFmpeg and v4l2 recorders (thanks @timwelch!) + * Added automatic PAM inclusion on installation + * Added optional notice on detection attempt (thanks @mrkmg!) + * Added support for grayscale frame encoding (thanks @dmig and @sapjunior!) + * Massively improved recognition speed (thanks @dmig!) + * Fixed typo in "timout" config value + * Removed unneeded dependencies (thanks @dmig!) + + -- boltgolt Sun, 06 Jan 2019 14:37:41 +0100 + +howdy (2.4.0) xenial; urgency=medium + + * Cameras are now selected by path instead of by video device number (thanks @Rhiyo!) + * Added fallbacks to $EDITOR for the config command (thanks @yassineim!) + * Fixed missing cv2 module after installation (thanks @bendandersen and many others!) + * Fixed file permissions crashing Howdy in some cases (thanks @GJDitchfield!) + * Fixed howdy using python3 from local virtual environment (thanks @EdwardJB!) + + -- boltgolt Fri, 09 Nov 2018 20:59:45 +0100 + +howdy (2.3.1) xenial; urgency=high + + * Fixed issue where `frame_width` and `frame_height` would be completely ignored (thanks @janecz-n!) + * Fixed security problem with remote session authentication (thanks @cccaballero!) + + -- boltgolt Mon, 24 Sep 2018 17:49:07 +0100 + +howdy (2.3.0) xenial; urgency=medium + + * Added a config option to set the frame height and width (thanks @wzrdtales!) + * Rewrote the code that fetches the non-root username (thanks @dmig!) + * Changed the config command so it uses the default editor (thanks @stellarpower and @dmig!) + * Fixed issue where a "y" could be interpreted as a no (thanks @ramkrishna757575!) + * Fixed division by zeno (thanks @stellarpower!) + + -- boltgolt Thu, 28 Jun 2018 14:59:52 +0100 + +howdy (2.2.2) xenial; urgency=medium + + * Fixed fetching of wrong config section (thanks @halcyoncheng and @arifeinberg!) + + -- boltgolt Fri, 11 May 2018 10:43:03 +0200 + +howdy (2.2.1) xenial; urgency=medium + + * Added mechanism to keep config files between updates + * Added force_mjpeg option to fix YUYV image issues (thanks @arifeinberg!) + * Revamped the bash autocompletion script + * Fixed timeout never being reached in certain scenarios (thanks @Tkopic001!) + * Fixed issue where BGR to RGB frame conversion caused a crash (thanks @Jerezano!) + + -- boltgolt Thu, 10 May 2018 15:14:03 +0200 + +howdy (2.1.0) xenial; urgency=medium + + * First complete PPA release + * Reworked CLI + + -- boltgolt Fri, 13 Apr 2018 22:22:27 +0200 + +howdy (2.0.0-alpha+3) xenial; urgency=medium + + * Fixed issue where dlib dependency failed to install on some installations + * Added preinst script for camera detection + + -- boltgolt Thu, 12 Apr 2018 21:42:42 +0000 + +howdy (2.0.0-alpha+2) xenial; urgency=medium + + * Fixed build dependency issue + + -- boltgolt Sat, 07 Apr 2018 21:30:48 +0200 + +howdy (2.0.0-alpha+1) xenial; urgency=low + + * Initial packaged release. + + -- boltgolt Wed, 04 Apr 2018 18:13:15 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..aca922a8 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: howdy +Section: misc +Priority: optional +Standards-Version: 3.9.7 +Build-Depends: devscripts, git, dh-make, debhelper, fakeroot, python3, python3-pip, python3-setuptools, python3-wheel, ninja-build, meson, libpam0g-dev, libboost-all-dev, pkg-config, libevdev-dev, libinih-dev +Maintainer: boltgolt +Vcs-Git: https://github.com/boltgolt/howdy + +Package: howdy +Homepage: https://github.com/boltgolt/howdy +Architecture: amd64 +Depends: ${misc:Depends}, libc6, libgcc-s1, libpam0g, libstdc++6, curl | wget, python3, python3-pip, python3-dev, python3-setuptools, python3-numpy, python-opencv | python3-opencv, libopencv-dev, cmake, libinih-dev +Recommends: libatlas-base-dev | libopenblas-dev | liblapack-dev, howdy-gtk, v4l-utils +Suggests: nvidia-cuda-dev (>= 7.5) +Description: Howdy: Windows Hello style authentication for Linux. + Use your built-in IR emitters and camera in combination with face recognition + to prove who you are. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..54f078c9 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 boltgolt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/debian/howdy.lintian-overrides b/debian/howdy.lintian-overrides new file mode 100644 index 00000000..2160448a --- /dev/null +++ b/debian/howdy.lintian-overrides @@ -0,0 +1,7 @@ +# W: Don't require ugly linebreaks in last 5 chars +howdy: debian-changelog-line-too-long + +# E: Allows the name Howdy to show up in Ubuntu updater +howdy: description-starts-with-package-name +# E: Allows python for installation scripts +howdy: unknown-control-interpreter diff --git a/debian/howdy.manpages b/debian/howdy.manpages new file mode 100644 index 00000000..a27b8e74 --- /dev/null +++ b/debian/howdy.manpages @@ -0,0 +1 @@ +howdy.1 diff --git a/debian/install b/debian/install new file mode 100644 index 00000000..6d22bf4c --- /dev/null +++ b/debian/install @@ -0,0 +1,18 @@ +howdy/src/cli/. lib/security/howdy/cli +howdy/src/recorders/. lib/security/howdy/recorders +howdy/src/rubberstamps/. lib/security/howdy/rubberstamps +howdy/src/cli.py lib/security/howdy +howdy/src/compare.py lib/security/howdy +howdy/src/i18n.py lib/security/howdy +howdy/src/logo.png lib/security/howdy +howdy/src/snapshot.py lib/security/howdy + +build/howdy/src/pam/pam_howdy.so lib/security/howdy + +howdy/src/dlib-data/. etc/howdy/dlib-data +howdy/src/config.ini etc/howdy + +howdy/src/autocomplete/. usr/share/bash-completion/completions +howdy/src/pam-config/. /usr/share/pam-configs + +howdy/howdy.1 howdy.1 diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 00000000..38d01a94 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,209 @@ +#!/usr/bin/python3 +# Installation script to install howdy +# Executed after primary apt install + +# Import required modules +import fileinput +import subprocess +import sys +import os +import re +import tarfile +from shutil import rmtree, which + +# Don't run unless we need to configure the install +# Will also happen on upgrade but we will catch that later on +if "configure" not in sys.argv: + sys.exit(0) + + +def log(text): + """Print a nicely formatted line to stdout""" + print("\n>>> " + col(1) + text + col(0) + "\n") + + +def handleStatus(status): + """Abort if a command fails""" + if (status != 0): + print(col(3) + "Error while running last command" + col(0)) + sys.exit(1) + + +def col(id): + """Add color escape sequences""" + if id == 1: return "\033[32m" + if id == 2: return "\033[33m" + if id == 3: return "\033[31m" + return "\033[0m" + + +# Create shorthand for subprocess creation +sc = subprocess.call + +# If the package is being upgraded +if "upgrade" in sys.argv: + # If preinst has made a config backup + if os.path.exists("/tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"): + # Get the config parser + import configparser + + # Load th old and new config files + oldConf = configparser.ConfigParser() + oldConf.read("/tmp/howdy_config_backup_v" + sys.argv[2] + ".ini") + newConf = configparser.ConfigParser() + newConf.read("/etc/howdy/config.ini") + + # Go through every setting in the old config and apply it to the new file + for section in oldConf.sections(): + for (key, value) in oldConf.items(section): + + # MIGRATION 2.3.1 -> 2.4.0 + # If config is still using the old device_id parameter, convert it to a path + if key == "device_id": + key = "device_path" + value = "/dev/video" + value + + # MIGRATION 2.4.0 -> 2.5.0 + # Finally correct typo in "timout" config value + if key == "timout": + key = "timeout" + + # MIGRATION 2.5.0 -> 2.5.1 + # Remove unsafe automatic dismissal of lock screen + if key == "dismiss_lockscreen": + if value == "true": + print("DEPRECATION: Config value dismiss_lockscreen is no longer supported because of login loop issues.") + continue + + # MIGRATION 2.6.1 -> 3.0.0 + # Fix capture being enabled by default + if key == "capture_failed" or key == "capture_successful": + if value == "true": + print("NOTICE: Howdy login image captures have been disabled by default, change the config to enable them again") + value = "false" + + # MIGRATION 2.6.1 -> 3.0.0 + # Rename config options so they don't do the opposite of what is commonly expected + if key == "ignore_ssh": + key = "abort_if_ssh" + if key == "ignore_closed_lid": + key = "abort_if_lid_closed" + if key == "capture_failed": + key = "save_failed" + if key == "capture_successful": + key = "save_successful" + + try: + newConf.set(section, key, value) + # Add a new section where needed + except configparser.NoSectionError: + newConf.add_section(section) + newConf.set(section, key, value) + + # Write it all to file + with open("/etc/howdy/config.ini", "w") as configfile: + newConf.write(configfile) + + sys.exit(0) + +log("Downloading dlib") + +dlib_archive = "/tmp/v19.16.tar.gz" +loader = which("wget") +LOADER_CMD = None + +# If wget is installed, use that as the downloader +if loader: + LOADER_CMD = [loader, "--tries", "5", "--output-document"] +# Otherwise, fall back on curl +else: + loader = which("curl") + LOADER_CMD = [loader, "--retry", "5", "--location", "--output"] + +# Assemble and execute the download command +cmd = LOADER_CMD + [dlib_archive, "https://github.com/davisking/dlib/archive/v19.16.tar.gz"] +handleStatus(sc(cmd)) + +# The folder containing the dlib source +DLIB_DIR = None +# A regex of all files to ignore while unpacking the archive +excludes = re.compile( + r"davisking-dlib-\w+/(dlib/(http_client|java|matlab|test/)|" + r"(docs|examples|python_examples)|" + r"tools/(archive|convert_dlib_nets_to_caffe|htmlify|imglab|python/test|visual_studio_natvis))" +) + +# Open the archive +with tarfile.open(dlib_archive) as tf: + for item in tf: + # Set the destination dir if unset + if not DLIB_DIR: + DLIB_DIR = "/tmp/" + item.name + + # extract only files sufficient for building + if not excludes.match(item.name): + tf.extract(item, "/tmp") + +# Delete the downloaded archive +os.unlink(dlib_archive) + +log("Building dlib") + +cmd = ["sudo", "python3", "setup.py", "install"] +cuda_used = False + +# Compile and link dlib +try: + sp = subprocess.Popen(cmd, cwd=DLIB_DIR, stdout=subprocess.PIPE) +except subprocess.CalledProcessError: + print("Error while building dlib") + raise + +# Go through each line from stdout to check for CUDA usage +while sp.poll() is None: + line = sp.stdout.readline().decode("utf-8") + + if "DLIB WILL USE CUDA" in line: + cuda_used = True + + print(line, end="") + +log("Cleaning up dlib") + +# Remove the no longer needed git clone +del sp +rmtree(DLIB_DIR) + +print("Temporary dlib files removed") + +log("Configuring howdy") + +# Make sure to use CNN if dlib was compiled with CUDA support +for line in fileinput.input(["/etc/howdy/config.ini"], inplace=1): + line = line.replace("use_cnn = false", "use_cnn = " + str(cuda_used).lower()) + print(line, end="") + +print("CNN saved to config, CUDA " + ("enabled" if cuda_used else "disabled")) + +# Secure the howdy folder +handleStatus(sc(["chmod 755 -R /lib/security/howdy/"], shell=True)) +handleStatus(sc(["chmod 755 -R /etc/howdy/"], shell=True)) + +# Allow anyone to execute the python CLI +os.chmod("/lib/security/howdy", 0o755) +os.chmod("/lib/security/howdy/cli.py", 0o755) +handleStatus(sc(["chmod 755 -R /lib/security/howdy/cli"], shell=True)) +print("Permissions set") + +# Make the CLI executable as howdy +os.symlink("/lib/security/howdy/cli.py", "/usr/local/bin/howdy") +os.chmod("/usr/local/bin/howdy", 0o755) +print("Howdy command installed") + +log("Adding howdy as PAM module") + +# Activate the pam-config file +handleStatus(subprocess.call(["pam-auth-update --package"], shell=True)) + +# Sign off +print("Installation complete.") diff --git a/debian/preinst b/debian/preinst new file mode 100755 index 00000000..a29bbb64 --- /dev/null +++ b/debian/preinst @@ -0,0 +1,30 @@ +#!/usr/bin/python3 +# Used to check cameras before committing to install +# Executed before primary apt install of files + +import subprocess +import sys +import os + +# Backup the config file if we're upgrading +if "upgrade" in sys.argv: + # Try to copy the config file as a backup + try: + # Try to copy the new location first + if os.path.exists("/etc/howdy/config.ini"): + subprocess.call(["cp /etc/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True) + # If that does not exist, try copying the old location + else: + subprocess.call(["cp /lib/security/howdy/config.ini /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini"], shell=True) + + # Let the user know so he knows where to look on a failed install + print("Backup of Howdy config file created in /tmp/howdy_config_backup_v" + sys.argv[2] + ".ini") + except subprocess.CalledProcessError: + print("Could not make an backup of old Howdy config file") + + # Don't continue setup when we're just upgrading + sys.exit(0) + +# Don't run if we're not trying to install fresh +if "install" not in sys.argv: + sys.exit(0) diff --git a/debian/prerm b/debian/prerm new file mode 100755 index 00000000..f545bef6 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,45 @@ +#!/usr/bin/python3 +# Executed on deinstallation +# Completely remove howdy from the system + +# Import required modules +import subprocess +import sys +import os +from shutil import rmtree + +# Only run when we actually want to remove +if "remove" not in sys.argv and "purge" not in sys.argv: + sys.exit(0) + +# Don't try running this if it's already gone +if not os.path.exists("/lib/security/howdy/cli"): + sys.exit(0) + +# Remove files and symlinks +try: + os.unlink("/usr/local/bin/howdy") +except Exception: + print("Can't remove executable") +try: + os.unlink("/usr/share/bash-completion/completions/howdy") +except Exception: + print("Can't remove autocompletion script") + +# Refresh and remove howdy from pam-config +try: + subprocess.call(["pam-auth-update --package"], shell=True) + subprocess.call(["rm /usr/share/pam-configs/howdy"], shell=True) + subprocess.call(["pam-auth-update --package"], shell=True) +except Exception: + print("Can't remove pam module") + +# Remove full installation folder, just to be sure +try: + rmtree("/lib/security/howdy") +except Exception: + # This error is normal + pass + +# Remove dlib +subprocess.call(["pip3", "uninstall", "dlib", "-y", "--no-cache-dir"]) diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..124ad3bc --- /dev/null +++ b/debian/rules @@ -0,0 +1,22 @@ +#!/usr/bin/make -f +DH_VERBOSE = 1 + +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk + +%: + dh $@ + +build: + # Create build dir + meson setup build -Dinih:with_INIReader=true + # Compile shared object + ninja -C build + +clean: + # Delete mason build directory + rm -rf ./build + # Force remove temp debian build directory + rm -rf ./debian/howdy + # Make sure subprojects get pulled locally + meson subprojects download --sourcedir howdy/src/pam diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..89ae9db8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 00000000..1c21301f --- /dev/null +++ b/debian/source/options @@ -0,0 +1,14 @@ +tar-ignore = ".git" +tar-ignore = ".gitignore" +tar-ignore = ".github" +tar-ignore = "models" +tar-ignore = "snapshots" +tar-ignore = "tests" +tar-ignore = "README.md" +tar-ignore = ".travis.yml" +tar-ignore = "fedora" +tar-ignore = "opensuse" +tar-ignore = "archlinux" +tar-ignore = "build" +tar-ignore = "__pycache__" +tar-ignore = "*.dat" diff --git a/howdy.1 b/howdy.1 new file mode 120000 index 00000000..c6099070 --- /dev/null +++ b/howdy.1 @@ -0,0 +1 @@ +howdy/howdy.1 \ No newline at end of file diff --git a/meson.options b/meson.options index 56c8f160..b65d51d0 100644 --- a/meson.options +++ b/meson.options @@ -6,6 +6,6 @@ option('user_models_dir', type: 'string', value: '', description: 'Set the user option('log_path', type: 'string', value: '/var/log/howdy', description: 'Set the log file path') option('install_in_site_packages', type: 'boolean', value: false, description: 'Install howdy python files in site packages') option('py_sources_dir', type: 'string', value: '', description: 'Set the python sources directory') -option('install_pam_config', type: 'boolean', value: false, description: 'Install pam config file (for Debian/Ubuntu)') -option('python_path', type: 'string', value: '/usr/bin/python', description: 'Set the path to the python executable') +option('install_pam_config', type: 'boolean', value: true, description: 'Install pam config file (for Debian/Ubuntu)') +option('python_path', type: 'string', value: '/usr/bin/python3', description: 'Set the path to the python executable') option('with_polkit', type: 'boolean', value: false, description: 'Install polkit policy config file')