Whamcloud - gitweb
LU-8955 sec: create new function sptlrpc_get_sepol() 40/34640/4
authorSebastien Buisson <sbuisson@ddn.com>
Fri, 16 Jun 2017 12:36:23 +0000 (14:36 +0200)
committerOleg Drokin <green@whamcloud.com>
Tue, 16 Apr 2019 20:50:26 +0000 (20:50 +0000)
commit781e1df5c936c42ce4f9df205c3ad19c78580b8b
tree27f33eda5a8274046f26237b89e20bdfe022dfa4
parentf1c8a02d75a83f0f2056437af3c5ab42ef2b1673
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.

Lustre-change: https://review.whamcloud.com/24421
Lustre-commit: c61168239eff571aefc2a695ef12ae355230e611

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Change-Id: I7a4b955f36c5e0f4eca1561beae2b40fec88d570
Reviewed-on: https://review.whamcloud.com/34640
Tested-by: Jenkins
Tested-by: Maloo <maloo@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]