MT#64092 Differentiate owner of logfile with the call file

Owner of logging must be root
Owner of file under asterisk spool must be asterisk
to let it read and originate the call accordingly.

Change-Id: I966e39a651e5cb26082275c8ef13fdd9f0cd0c0a
(cherry picked from commit 62ebe2f573)
(cherry picked from commit 9f5f0ab14e)
mr12.5.1
Alessio Garzi 8 months ago
parent a22a5f7511
commit 6fa1216bd0

@ -12,7 +12,8 @@ import grp
CONFIG_FILE = "/etc/ngcp-reminder/reminder.conf"
LOG_FILE = "/var/log/ngcp/ngcp-reminder.log"
OWNER = "root"
OWNERLOGFILE = "root"
OWNERTMPFILE = "asterisk"
# --- Logging setup -----------------------------------------------------------
SYSLOG_ADDRESS = '/dev/log' # Standard Unix socket for local syslog
@ -20,7 +21,7 @@ SYSLOG_ADDRESS = '/dev/log' # Standard Unix socket for local syslog
# Ensure proper permissions and ownership for the log file
if not os.path.exists(LOG_FILE):
open(LOG_FILE, "w").close()
uid = pwd.getpwnam(OWNER).pw_uid
uid = pwd.getpwnam(OWNERLOGFILE).pw_uid
gid = grp.getgrnam('adm').gr_gid
os.chown(LOG_FILE, uid, gid)
os.chmod(LOG_FILE, 0o640) # rw-r-----
@ -111,8 +112,8 @@ def create_call_file(
f.write(f"Setvar: LANG={lang or 'en'}\n")
# Set file ownership and permissions
uid = pwd.getpwnam(OWNER).pw_uid
gid = pwd.getpwnam(OWNER).pw_gid
uid = pwd.getpwnam(OWNERTMPFILE).pw_uid
gid = pwd.getpwnam(OWNERTMPFILE).pw_gid
os.chown(tmp_filename, uid, gid)
os.chmod(tmp_filename, 0o600)

Loading…
Cancel
Save