mirror of
https://github.com/Py-KMS-Organization/py-kms.git
synced 2025-05-13 06:34:45 -04:00
add versions, removed sudo, powerusers group,
This commit is contained in:
parent
90b4af2627
commit
17bc78f534
6 changed files with 16 additions and 22 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue