Bug 1270927 - ksu doesn't properly log auth failures
ksu doesn't properly log auth failures
Status: POST
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: krb5 (Show other bugs)
7.1
All Linux
low Severity unspecified
: rc
: ---
Assigned To: Robbie Harwood
BaseOS QE Security Team
https://github.com/krb5/krb5/pull/776
:
Depends On: 1575771
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-12 13:12 EDT by Pat Riehecky
Modified: 2018-06-01 14:36 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1575771 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Pat Riehecky 2015-10-12 13:12:42 EDT
Description of problem:
I'm looking to switch from sudo to .k5users, but the logging is reduced
by comparison.

For example:
sudo: riehecky : TTY=pts/2 ; PWD=/home/riehecky ; USER=root ;
COMMAND=/bin/ls -a
vs
ksu[15242]: pam_unix(ksu:session): session opened for user root by
riehecky(uid=1000)

Can the logging be increased so that the command and its arguments is
logged?

Version-Release number of selected component (if applicable):krb5-1.12.2-15.el7_1


How reproducible:100%


Steps to Reproduce:
1.grant 'someuser' sudo rights to run /bin/ls
2.echo 'someuser@EXAMPLE.COM /bin/ls' /root/.k5users
3.sudo /bin/ls
4.ksu -e /bin/ls

Actual results:
sudo logs command executed
ksu logs as though the user acquired a full shell

Expected results:
ksu log action performed in a similar manner to sudo

Additional info:
http://krbdev.mit.edu/rt/Ticket/Display.html?id=8270
Comment 4 Robbie Harwood 2018-04-11 17:12:48 EDT
My read of the current state is:

- If the source user is root, no message will be logged.

- If the source user is not root and there's no cmd, a successful or failed auth message is logged.

- If the source user is not root, there's a command, and auth succeds, a message is logged (syslog at NOTICE) which says something like

    "Account TARGET: authorization for CLIENT for execution of CMD successful".

- If the source user is not root, there's a command, and auth fails, a message is logged (syslog at WARNING) which says something like

    "Account TARGET: authorization for CLIENT for execution of CMD failed".

Does that match what you're seeing?  And if so, what part of that (if any) are you requesting improvement in?
Comment 5 Pat Riehecky 2018-04-12 09:19:54 EDT
I'm not seeing the second two (Account TARGET:...) appear in syslog.

$ ksu testuser -e /bin/ls
account testuser: authorization failed

However, I don't show anything logged to secure or messages for execution for non-root target accounts.



I do show a success message for running as root:

$ ksu -e /bin/ls
Authenticated riehecky@FNAL.GOV
Account root: authorization for riehecky@FNAL.GOV for execution of
               /bin/ls successful

==> messages <==
Apr 12 08:18:30 test ksu[396]: Account root: authorization for riehecky@FNAL.GOV for execution of /bin/ls successful
Comment 6 Robbie Harwood 2018-05-07 17:03:38 EDT
I definitely see the non-root success:

may 07 14:50:16 freeipa.rharwood.biz ksu[1769]: 'ksu left' authenticated right@RHARWOOD.BIZ for right on /dev/pts/0
may 07 14:50:16 freeipa.rharwood.biz ksu[1769]: Account left: authorization for right@RHARWOOD.BIZ for execution of /bin/ls successful

Failures for non-root users (regardless of whether they're running a command, or their target user) don't seem to show up.

Let me see what I can do.
Comment 7 Robbie Harwood 2018-05-31 14:46:27 EDT
Just to double-check - the non-root success and failure logging as described in comment#4 would meet your requirements, right?  And currently the only missing part of that is the failure logging?
Comment 8 Pat Riehecky 2018-05-31 14:49:09 EDT
That is all correct.

Note You need to log in before you can comment on or make changes to this bug.