Add logger for usr.bin/mdo/mdo.c: a logger like sudo.
We should add a logger for some MAC module. However, the logger for mac_do needs further discussions, and the tool use MAC framework should also be logging itself.
The output log format is like following:
Nov 4 03:46:54 bsd-workstation mdo[26618]: USER: rin; failed to call initgroups: 1
Nov 4 03:47:12 bsd-workstation mdo[26622]: USER: root; COMMAND=/bin/sh
I think this (adding logging support) is the right direction but logging in the utility is probably not a very good choice because when mdo is loaded and enabled, an approved users can simply call
setuid()and/orsetgid()in their applications to the allowed user / groups themselves, which will not trigger any logging...
Scratch that, I have misread the code. The module does require caller to be the hardcoded /usr/bin/mdo.
In general I like the idea, I don't have a strong feeling about it, but still if we could use open_memstream(3) it would be nicer
@OlCe2
Hi, could you please help me review this PR? Thank you very much!
@OlCe2 Any final comments? This seems reasonable to me. I'm on the fence whether @bapt 's comments would help or not... it seems like maybe only a marginal improvement unless I'm badly misreading.
Given the lack of answers, and the fact that since then the code of mdo(1) has considerably changed, closing this.
Feel free to re-open, rebase changes and cater to comments when you have the time.