Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions howdy/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ print("CNN saved to config, CUDA " + ("enabled" if cuda_used else "disabled"))
handleStatus(sc(["chmod 755 -R /lib/security/howdy/"], shell=True))
handleStatus(sc(["chmod 755 -R /etc/howdy/"], shell=True))

# Restrict biometric model files to root only
models_dir = "/etc/howdy/models"
if os.path.isdir(models_dir):
os.chmod(models_dir, 0o700)
for f in os.listdir(models_dir):
os.chmod(os.path.join(models_dir, f), 0o600)

# Allow anyone to execute the python CLI
os.chmod("/lib/security/howdy", 0o755)
os.chmod("/lib/security/howdy/cli.py", 0o755)
Expand Down
5 changes: 4 additions & 1 deletion howdy/src/cli/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# Make the ./models folder if it doesn't already exist
if not os.path.exists(paths_factory.user_models_dir_path()):
print(_("No face model folder found, creating one"))
os.makedirs(paths_factory.user_models_dir_path())
os.makedirs(paths_factory.user_models_dir_path(), mode=0o700)

# To try read a premade encodings file if it exists
try:
Expand Down Expand Up @@ -209,6 +209,9 @@
with open(enc_file, "w") as datafile:
json.dump(encodings, datafile)

# Restrict permissions so only root can read the biometric model
os.chmod(enc_file, 0o600)

# Give let the user know how it went
print(_("""\nScan complete
Added a new model to """) + user)
3 changes: 3 additions & 0 deletions howdy/src/cli/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,7 @@
with open(enc_file, "w") as datafile:
json.dump(new_encodings, datafile)

# Maintain restrictive permissions on the biometric model file
os.chmod(enc_file, 0o600)

print(_("Removed model {}").format(id))