SMACK : add logging support V1
Subsystems (3)
RFC 1/1 SMACK : add logging support V1
Hello,
the following patch, against current 2.6.29-rc7, add logging of smack decisions. This is of course very useful to understand what your current smack policy does. It borrows a lot from selinux;
It introduces a '/smack/logging' switch :
0: no logging
1: log denied (default)
2: log accepted
3: log denied&accepted
example of logs produced :
type=1400 audit(1236429348.858:5655879): SMACK[smack_task_kill]: denied pid=6521 comm="bash" subject:'toto' object:'_' requested:w pid=5757 comm="knetworkmanager"
type=1400 audit(1236429361.477:5655882): SMACK[smk_curacc_shm]: denied pid=6533 comm="ipcrm" subject:'toto' object:'_' requested:rw key=491521 type=1400 audit(1236429392.389:5655885): SMACK[smack_sb_mount]: denied pid=6536 comm="mount" subject:'toto' object:'_' requested:w path="/debug" dev=sda5 ino=16161
type=1400 audit(1236429485.009:5655890): SMACK[smack_ptrace_may_access]: denied pid=6539 comm="strace" subject:'toto' object:'_' requested:rw pid=5634 comm="python" type=1400 audit(1236429527.693:5655893): SMACK[smack_inode_getattr]: denied pid=6544 comm="ls" subject:'toto' object:'etienne' requested:r path="/home/etienne/linux" dev=sda8 ino=2342913 type=1400 audit(1236429741.006:6006665): SMACK[smack_socket_sendmsg]: granted pid=6580 comm="ping" subject:'toto' object:'@' requested:w daddr=192.168.0.10 type=1400 audit(1236429741.006:6006666): SMACK[smack_socket_sock_rcv_skb]: granted pid=6580 comm="ping" subject:'@' object:'toto' requested:w saddr=192.168.0.10 daddr=192.168.0.10 netif=lo
--- Documentation/Smack.txt | 12 + security/smack/Kconfig | 2 +- security/smack/Makefile | 2 +- security/smack/smack_logging.c | 460 ++++++++++++++++++++++++++++++++++++++++ security/smack/smack_logging.h | 97 +++++++++ security/smack/smack_lsm.c | 356 +++++++++++++++++++++++-------- security/smack/smackfs.c | 52 +++++ 7 files changed, 892 insertions(+), 89 deletions(-)
---
Documentation/Smack.txt +12 -0
@@ -491,3 +491,15 @@ Smack supports some mount options: These mount options apply to all file system types. +Smack logging support + +Smack supports logging of security accesses. It will log by default all denied +requests. The interface to change this behavior is /smack/logging, where you +can write the logging level you desire : +0: no logging +1: log denied (default) +2: log accepted +3: log denied&accepted + +Note that due to the rate-limit of audit messages, logging accepted request will +drop a lot of messages.
security/smack/Kconfig +1 -1
@@ -1,6 +1,6 @@ config SECURITY_SMACK bool "Simplified Mandatory Access Control Kernel Support" - depends on NETLABEL && SECURITY_NETWORK + depends on NETLABEL && SECURITY_NETWORK && AUDIT default n help This selects the Simplified Mandatory Access Control Kernel.
security/smack/Makefile +1 -1
@@ -4,4 +4,4 @@ obj-$(CONFIG_SECURITY_SMACK) := smack.o -smack-y := smack_lsm.o smack_access.o smackfs.o +smack-y := smack_lsm.o smack_access.o smackfs.o smack_logging.o
security/smack/smack_logging.c new file +460 -0
460 lines not on this page · raw message
security/smack/smack_logging.h new file +97 -0
97 lines not on this page · raw message
security/smack/smack_lsm.c +269 -87
880 lines not on this page · raw message
security/smack/smackfs.c +52 -0
76 lines not on this page · raw message
Quoted 25 lines · etienne
Hello,
the following patch, against current 2.6.29-rc7, add logging of smack decisions. This is of course very useful to understand what your current smack policy does. It borrows a lot from selinux;
It introduces a '/smack/logging' switch :
0: no logging
1: log denied (default)
2: log accepted
3: log denied&acceptedexample of logs produced :
type=1400 audit(1236429348.858:5655879): SMACK[smack_task_kill]: denied pid=6521 comm="bash" subject:'toto' object:'_' requested:w pid=5757 comm="knetworkmanager" type=1400 audit(1236429361.477:5655882):
SMACK[smk_curacc_shm]: denied pid=6533 comm="ipcrm" subject:'toto' object:'_' requested:rw key=491521 type=1400 audit(1236429392.389:5655885):
SMACK[smack_sb_mount]: denied pid=6536 comm="mount" subject:'toto' object:'_' requested:w path="/debug" dev=sda5 ino=16161 type=1400 audit(1236429485.009:5655890): SMACK[smack_ptrace_may_access]: denied pid=6539 comm="strace" subject:'toto' object:'_' requested:rw pid=5634 comm="python" type=1400 audit(1236429527.693:5655893):
Quoted 8 lines
SMACK[smack_inode_getattr]: denied pid=6544 comm="ls" subject:'toto' object:'etienne' requested:r path="/home/etienne/linux" dev=sda8 ino=2342913 type=1400 audit(1236429741.006:6006665):
SMACK[smack_socket_sendmsg]: granted pid=6580 comm="ping" subject:'toto' object:'@' requested:w daddr=192.168.0.10 type=1400 audit(1236429741.006:6006666): SMACK[smack_socket_sock_rcv_skb]: granted pid=6580 comm="ping" subject:'@' object:'toto' requested:w saddr=192.168.0.10 daddr=192.168.0.10 netif=lo
You will want to send this to the audit mailing list ([email protected]) for review, I suspect they will have several comments.
Signature · 2 lines
paul moore linux @ hp