From a5a22b7c88e19dd6d924140a025acbd401f7b9b5 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Mon, 31 Aug 2020 21:14:09 -0500 Subject: [PATCH] Remove UPLOADKEYS_CHMOD option due to keygen.py Since keygen.py is run as root, uploadkeys is owned by root. This causes issues when imgupload.py tries to chmod the uploadkeys file since it doesn't have permissions to chmod it. Solution: remove UPLOADKEYS_CHMOD option --- configtest.py | 2 -- imgupload.py | 1 - settings.py.default | 1 - 3 files changed, 4 deletions(-) diff --git a/configtest.py b/configtest.py index 57945a7..5eb5c91 100644 --- a/configtest.py +++ b/configtest.py @@ -9,7 +9,6 @@ defaults = { "ROOTURL": "https://img.bbaovanc.com/", "SAVELOG": "savelog.log", "SAVELOG_CHMOD": "0o644", - "UPLOADKEYS_CHMOD": "0o400", "SAVELOG_KEYPREFIX": 4, "ENCKEY_PATH": "secret.key" } @@ -20,7 +19,6 @@ deftypes = { "ROOTURL": str, "SAVELOG": str, "SAVELOG_CHMOD": int, - "UPLOADKEYS_CHMOD": int, "SAVELOG_KEYPREFIX": int, "ENCKEY_PATH": str, } diff --git a/imgupload.py b/imgupload.py index 7b4cbe1..03fdd81 100644 --- a/imgupload.py +++ b/imgupload.py @@ -46,7 +46,6 @@ def upload(): if request.method == "POST": # sanity check: make sure it's a POST request print("Request method was POST!") - os.chmod("uploadkeys", settings.UPLOADKEYS_CHMOD) with open(settings.ENCKEY_PATH,"rb") as enckey: # load encryption key key = enckey.read() f = Fernet(key) diff --git a/settings.py.default b/settings.py.default index 08f0789..460efcf 100644 --- a/settings.py.default +++ b/settings.py.default @@ -3,6 +3,5 @@ ALLOWED_EXTENSIONS = [".png", ".jpg", ".jpeg", ".svg", ".bmp", ".gif", ".ico", ROOTURL = "https://example.com/" SAVELOG = "savelog.log" SAVELOG_CHMOD = 0o644 -UPLOADKEYS_CHMOD = 0o600 SAVELOG_KEYPREFIX = 4 ENCKEY_PATH = "secret.key"