On Fri, 2022-10-07 at 00:33 +0200, Francesco Poli wrote:

> I am not sure I see the use of such additional information

It is useful for accountability on systems where there are multiple
sysadmins who use sudo/etc to get root, to know who did what when.

> but anyway reading /var/log/apt/history.log means that we are
> assuming that apt-listbugs will always be invoked from apt.
> But apt-listbugs supports other package managers, which do not provide
> Commandline/Requested-By fields in history.log (aptitude) or, maybe, do
> not log to /var/log/apt/history.log at all (cupt?).

Sorry, I should have been clearer in my initial bug report.

I was asking for the requestor and command-line to be documented, but
not really for those to be read from the apt history log. The requestor
can be got from the SUDO_* or PKEXEC_UID environment variables, and the
command-line can be got from either SUDO_COMMAND and or by inspecting
the command-line of the parent process using the /proc/12345/cmdline
file. The PKEXEC_UID would need translating to the username of course.

$ sudo env -u FOO env | grep SUDO
SUDO_COMMAND=/usr/bin/env -u FOO env
SUDO_USER=pabs
SUDO_UID=1000
SUDO_GID=1000

$ pkexec env -u FOO env | grep PKEXEC
PKEXEC_UID=1000

$ su 
Password: 
root@localhost /home/pabs # env | grep =pabs$
LOGNAME=pabs
USERNAME=pabs
USER=pabs

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to