add versions, removed sudo, powerusers group,

This commit is contained in:
edgd1er 2022-05-02 20:39:21 +02:00
parent 90b4af2627
commit 17bc78f534
No known key found for this signature in database
GPG key ID: F7B8E0D6C867CCAE
6 changed files with 16 additions and 22 deletions

View file

@ -31,7 +31,7 @@ def change_uid_grp():
loggersrv.info(f'not root user, cannot change uid/gid.')
return None
user_db_entries = pwd.getpwnam("py-kms")
user_grp_db_entries = grp.getgrnam("power_users")
user_grp_db_entries = grp.getgrnam("users")
uid = int(user_db_entries.pw_uid)
gid = int(user_grp_db_entries.gr_gid)
new_gid = int(os.getenv('GID', str(gid)))
@ -66,13 +66,15 @@ def change_uid_grp():
def change_tz():
tz = os.getenv('TZ', 'etc/UTC')
# TZ is not symlinked and defined TZ exists
if tz not in os.readlink('/etc/localtime') and os.path.isfile('/usr/share/zoneinfo/' + tz):
if tz not in os.readlink('/etc/localtime') and os.path.isfile('/usr/share/zoneinfo/' + tz) and hasattr(time, 'tzset'):
loggersrv.info("Setting timzeone to %s" % tz )
# time.tzet() should be called on Unix, but doesn't exist on Windows.
time.tzset()
# Main
if (__name__ == "__main__"):
loggersrv.info("Log level: %s" % log_level)
loggersrv.debug("user id: %s" % os.getuid())
change_tz()
childProcess = subprocess.Popen(PYTHON3 + " -u /usr/bin/start.py", preexec_fn=change_uid_grp(), shell=True)
def shutdown(signum, frame):