Regiani Iago 44c65faf81 Migrate syslog-ng-config to Debian
Modified syslog-ng-config to add support for Debian packaging.

Removed rsyslog as if was conflicting with linux-kernel-log-daemon,
and adapted conf to use systemd-journal as source.

Test Plan:

PASS: Package installed and ISO built successfully
PASS: Package files were copied with right permissions

Story: 2009256
Task: 43923

Signed-off-by: Regiani Iago <Iago.RodriguezRegiani@windriver.com>
Change-Id: I28bcead8e140c18ef8cf4d670a2b0d2bf19d7c2c
2021-11-23 08:15:38 -03:00

50 lines
873 B
Python
Executable File

#!/usr/bin/python3
#
# Copyrights (c) 2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# We assume that we are being called because of a command option in
# ssh authorized_keys for whoever we are. Where the log goes depends
# on the configuration of syslog.
# replace bash
#
# logger --id=$$ -p user.info SSHLOG: $SHELL \"${SSH_ORIGINAL_COMMAND}\"
#
# exec $SHELL -c "${SSH_ORIGINAL_COMMAND}"
import os
try:
shell = os.environ['SHELL']
except:
shell = "/bin/sh"
# Do not log interactive session
#
try:
cmd = os.environ['SSH_ORIGINAL_COMMAND']
except:
os.execl(shell, shell)
import syslog, pwd
try:
user = pwd.getpwuid(os.getuid())[0]
except:
user = "unknown"
try:
msg = "user=%s cmd='%s'" % (user,cmd)
syslog.syslog(syslog.LOG_USER | syslog.LOG_DEBUG, msg)
except:
pass
# execute cmd
#
os.execl(shell, shell, "-c", cmd)