Technical Deep Dive: LSM and SELinux Internal Structure

LSM Module:

OS Security is a chronic and growing problem: as more systems (and more money) go on line, the motivation to attack rises. Linux is not immune to this either. Hence was introduced LSM that provides a general kernel framework to support security modules in Linux. The LSM is the Linux security framework that allows 3rd party access control mechanisms to be linked into the GNU / Linux kernel.

Currently there are two 3rd party services that utilize the LSM: SELinux and SMACK (Simplified Mandatory Access Control Kernel) that both provide mandatory access control services.

At Calsoft, we helped one of our customers with porting of Lustre file system to SELinux. This involved submission of the patch for Lustre server to enable it to run in SELinux environment. To read our success stories please click here.

The basic idea behind the LSM is to:

  • Insert security function calls (or hooks) and security data structures in the various kernel services to allow access control to be applied
  • Allow registration and initialization services for the 3rd party security modules
  • Allow process security attributes to be available to user-space services by extending the /proc file system with a security namespace
  • Support file systems that use extended attributes Consolidate the Linux capabilities into an optional
    module

Note: LSM does not provide any security services by itself, but only the hooks and structures for supporting 3rd party modules. If no 3rd party modules are loaded, the capabilities module becomes the default module thus allowing standard DAC.

Kernel services for which LSM has inserted hooks and structures to allow access control managed by 3rd party module:

Program
Execution
Filesystem
Operations
Inode
Operations
File operations Task operations Netlink messaging
Unix domain networking Socket operations XFRM operations
Key management operations IPC operations Memory Segments
Seamaphores Capability Sysctl
Syslog Audit

SELinux:

Security-Enhanced
Linux (SELinux) is a mandatory access control (MAC) security mechanism implemented in the kernel.

SELinux Modes:
SELinux has three basic modes of operation, of which Enforcing is set as the installation default mode. There is, however, an additional qualifier of targeted or mls which control how pervasive SELinux rules are applied, with targeted being the less stringent level.

  • Enforcing:
    The default mode which will enable and enforce the SELinux security policy on the system, denying access and logging actions
  • Permissive: In Permissive mode, SELinux is enabled but will not enforce the security policy, only warn and log actions. Permissive mode is useful for troubleshooting SELinux issues.
  • Disabled: SELinux is turned off

Need:
Without SELinux enabled, only traditional discretionary access control (DAC) methods such as file permissions or access control lists (ACLs) are used to control the file access of users. Users and programs alike are allowed to grant insecure file permissions to others or, conversely, to gain access to parts of the system that should not otherwise be necessary for normal operation. For example: Administrators have no way to control users: A user could set readable permissions on sensitive files such as ssh keys and the directory containing such keys, customarily: ~/.ssh/.

  • Processes can change security properties: A user’s mail files should be readable only by that user, but the mail client software has the ability to change them to be world readable.
  • Processes inherit user’s rights: Firefox, if compromised by a trojan’ed version, could read a user’s private ssh keys even though it has no reason to do so.

How it works:
SELinux follows the model of least-privilege more closely. By default under a strict enforcing setting, everything is denied and then a series of exceptions policies are written that give each element of the system (a service, program or user) only the access required to function. If a service, program or user subsequently tries to access or modify a file or resource not necessary for it to function, then access is denied and the action is can be
logged.

Diagrams briefly explain how various kernel modules fit together:

Write to us at marketing@calsoftinc.com

 
Share:

Related Posts

Role of Cyber Security in Business Continuity

Cyber security plays a critical role in business continuity by mitigating risks, cyber-attacks, and by maintaining trust with customers and partners. Explore the crucial role of cybersecurity in ensuring business continuity!

Share:
Navigating Big Data Storage Challenges

Navigating Big Data Storage Challenges

The last decade or so has seen a big leap in technological advancements. One of the technologies to come up at this time and see a rapid…

Share:
cloud storage vs. on Premises storage

Cloud Storage vs. On-Premises Storage: A Comparative Analysis

Enterprises in today’s digital landscape, be they Large/ Small Medium Enterprises (L/SMEs) or startups, face a perpetual dilemma – how to manage their data, applications, and technology…

Share:
Understanding the Potential of Storage and Security in IoT

Understanding the Potential of Storage and Security in IoT

The potential of storage and security in IoT plays a significant role in transforming industries and the lives of people. However, tackling challenges such as data isolation, interoperability, and scalability will be essential in underpinning this potential. To embrace the full potential of storage and security in IoT involves a holistic method, incorporating technological advancements with comprehensive tactics. Read the blog to understand the potential of security and storage in the IoT ecosystem, its challenges, and keyways to overcome them.

Share:
MicroStream Modernizing Data Storage

MicroStream: Modernizing Data Storage

MicroStream is an efficient Java persistence framework meant for continuous object storage and recovery. MicroStream’s lightweight solution and in-memory storage policy enables rapid development and augments application speed, making it an ideal choice for microservices architectures, serverless systems, embedded systems, and real-time applications. Read the blog to explore how MicroStream is reforming the outlook of data persistence.

Share:

Enhancing vCenter Capabilities with VMware vCenter Plugins: A Deep Dive

 vCenter Server is one of the most powerful tools in VMware’s product portfolio, enabling efficient management of virtualized environments. One of the most used features in vCenter is the vCenter plugin, which extends the capabilities by providing custom features such as 3rd Party system discovery, and provisioning, providing a unified view, allowing administrators to manage vSphere, and 3rd Party systems seamlessly.

Share: