Whamcloud - gitweb
LU-8955 sec: create new function sptlrpc_get_sepol() 21/24421/31
authorSebastien Buisson <sbuisson@ddn.com>
Fri, 16 Jun 2017 12:36:23 +0000 (14:36 +0200)
committerOleg Drokin <green@whamcloud.com>
Wed, 30 Jan 2019 02:39:55 +0000 (02:39 +0000)
commitc61168239eff571aefc2a695ef12ae355230e611
tree7864586eadb99eba9aa3d70bfddd231c8a5ae765
parent1f6cb3534e74f0c9462008c8088b5734b64ed41c
LU-8955 sec: create new function sptlrpc_get_sepol()

Create new function sptlrpc_get_sepol() in ptlrpc/sec.c to compute
SELinux policy info, by calling new userland command l_getsepol.

The SELinux policy info syntax is the following:
<mode>:<name>:<version>:<hash>
where:
- <mode> is a digit telling if SELinux is in Permissive mode (0)
  or Enforcing mode (1)
- <name> is the name of the SELinux policy
- <version> is the version of the SELinux policy
- <hash> is the computed hash of the binary representation of the
  policy, as exported in /etc/selinux/<name>/policy/policy.<version>

Userland command l_getsepol can be called on the command line by a
security administrator to get SELinux status information to store into
'sepol' field of nodemap.

SELinux status information is reported by Lustre client only if
new 'send_sepol' ptlrpc kernel module's parameter is not zero, and
SELinux is enabled on the client.
'send_sepol' accepts various values:
- 0: do not send SELinux policy info;
- -1: send SELinux policy info for every request;
- N > 0: only send SELinux policy info every N seconds. Use max value
  2^31-1 (signed int on 32 bits) to make sure SELinux policy info is
  only checked at mount time.
Independently from 'send_sepol' value, SELinux policy info has an
associated mtime. l_getsepol checks mtime and recalculates whole
SELinux policy info (including SHA) only if mtime changed.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I7a4b955f36c5e0f4eca1561beae2b40fec88d570
Reviewed-on: https://review.whamcloud.com/24421
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/include/lustre_net.h
lustre/include/lustre_sec.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/ptlrpc/gss/sec_gss.c
lustre/ptlrpc/sec.c
lustre/ptlrpc/sec_lproc.c
lustre/utils/.gitignore
lustre/utils/Makefile.am
lustre/utils/l_getsepol.c [new file with mode: 0644]