ePages 6.17.48 - DE_EPAGES/Core/API/SELinux.pm

Package DE_EPAGES::Core::API::SELinux

This module provides SELinux functions.

Example
use DE_EPAGES::Core::API::SELinux qw( SetSELinuxContext );
@EXPORT_OK
SetSELinuxContext
SELinuxEnabled

Functions

SELinuxEnabled
SetSELinuxContext

SELinuxEnabled

Shows whether SELinux is enabled or not.

Syntax
$Result = SELinuxEnabled($hFlags);
Example
return unless SELinuxEnabled();
Return
$Result (boolean)
true-enabled, false-disabled, undef-has no selinux

SetSELinuxContext

Sets SELinux context (if SELinuxEnabled) in $Path with $hFlags as defined by chcon (see man chcon)

Syntax
SetSELinuxContext($Path, $hFlags);
Example
SetSELinuxContext( "$ENV{EPAGES_WEBROOT}/StoreTypes",
                   {type => 'httpd_sys_content_t'} );
Input
$Path (string)
file or directory to be modified
$hFlags (ref.hash)
flags
  • user - set user in the target security context
  • role - set role in the target security context
  • type - set type in the target security context
  • range - set range in the target security context
  • Print - print the command line before execution - boolean
  • Capture - captures STDOUT and returns it as string
  • Warning - does not thow an error but a warning