netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Dump the sock's security context
@ 2011-08-31  8:36 rongqing.li
  2011-08-31  8:36 ` [PATCH 1/2] Define security_sk_getsecctx rongqing.li
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: rongqing.li @ 2011-08-31  8:36 UTC (permalink / raw)
  To: netdev, selinux, linux-security-module

-------
    Any review would be much appreciated.
 
Comments:
--------
    Add a netlink attribute INET_DIAG_SECCTX
    
    Add a new netlink attribute INET_DIAG_SECCTX to dump the security
    context of TCP sockets.
    
    The element sk_security of struct sock represents the socket
    security context ID, which is inherited from the parent process
    when the socket is created.
    
    but when SELinux type_transition rule is applied to socket, or
    application sets /proc/xxx/attr/createsock, the socket security
    context would be different from the creating process. For these
    conditions, the "netstat -Z" would return wrong value, since
    "netstat -Z" only returns the process security context as socket
    process security.


The application to verify the netlink new attribute.
------
See attached file

test:
--------
1. Enable SELinux when compile and startup .
	root@qemu-host:/root> ./printsocketsec
	 inode:7141 system_u:system_r:rpcbind_t:s0 
	 inode:7136 system_u:system_r:rpcbind_t:s0 
	 inode:7604 system_u:system_r:initrc_t:s0 
	 inode:7227 system_u:system_r:rpcd_t:s0 
	 inode:7471 system_u:system_r:sshd_t:s0-s0:c0.c1023 
	 inode:7469 system_u:system_r:sshd_t:s0-s0:c0.c1023 
	 inode:7552 system_u:system_r:sendmail_t:s0 
	 inode:7348 system_u:system_r:initrc_t:s0 
	 inode:7553 system_u:system_r:sendmail_t:s0 
	root@qemu-host:/root> 

2. Disable SELinux when startup.
	root@qemu-host:/root> ./printsocketsec 
	inode:3221 
	inode:2942 
	inode:2861 
	inode:3256 
	inode:3156 
	inode:3220 
	inode:3060
	root@qemu-host:/root>

3. Disable SELinux when compile and startup
	root@qemu-host:/root> ./printsocketsec 
	inode:3221 
	inode:2942 
	inode:2861 
	inode:3256 
	inode:3156 
	inode:3220 
	inode:3060
	root@qemu-host:/root>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-09-05  0:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-31  8:36 [PATCH 0/2] Dump the sock's security context rongqing.li
2011-08-31  8:36 ` [PATCH 1/2] Define security_sk_getsecctx rongqing.li
2011-08-31 15:43   ` Casey Schaufler
2011-08-31 18:46     ` Stephen Smalley
2011-08-31 20:49       ` Casey Schaufler
2011-08-31  8:36 ` [PATCH 2/2] Add a netlink attribute INET_DIAG_SECCTX rongqing.li
2011-08-31 12:08   ` Stephen Smalley
2011-08-31 21:18   ` Paul Moore
2011-09-01  9:33     ` Rongqing Li
2011-09-01 12:28       ` Paul Moore
2011-09-05  0:32         ` Rongqing Li
2011-08-31  8:38 ` [PATCH 0/2] Dump the sock's security context Rongqing Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).