Questions tagged [selinux]

SELinux (Security-Enhanced Linux) is an implementation of a flexible mandatory, role-based access control architecture on Linux. It is primarily used to confine system processes.

SELinux (Security-Enhanced Linux) is an optional component of Linux that provides mandatory access control based on the FLASK architecture. It originated as an NSA project, but has been part of the mainline Linux kernel since version 2.6.0.

Questions about SELinux often straddle the border between security and functionality. If your point of view is that of a security professional (choosing a security policy, encoding a security policy in SELinux, …), ask here. If your point of view is that of a system administrator (setting up SELinux, getting a program to work with SELinux, …), ask on our sister site Unix & Linux.

SELinux provides mandatory access control, integrity controls, role-based access control with multilevel security. SELinux is primarily used to confine system processes (daemons), as writing a usable yet usefully restrictive policy for programs used by users is difficult.

SELinux assigns to each process and to each file a context consisting of a role, user (not related to Linux users) and a domain. Utilities such as ls and ps display SELinux contexts if the -Z flag is specified.

SELinux has been officially supported in RHEL since version 4.0 and Fedora since version 2. Other major distributions allow the use of SELinux but may not provide standard policies.

Other projects with a similar goal include:

77 questions
85
votes
9 answers

Comparison Between AppArmor and Selinux

I was reviewing several different comparisons of AppArmor and SELinux which include: Why I Like AppArmor More Than SELinux SELinux and AppArmor: An Introductory Comparison From these articles I conclude that AppArmor is better than SELinux based…
Ali Ahmad
  • 4,784
  • 8
  • 35
  • 61
39
votes
8 answers

How can I prevent a user from copying files to another hard drive?

I have a Linux machine that contains sensitive files. Users should be able to access (read) them when they are using the computer, but should not be able to copy them to another hard drive (USB stick or another hard drive that might have been added…
Iakovos Gurulian
  • 509
  • 1
  • 4
  • 9
29
votes
2 answers

How trustworthy is SELinux?

Given the ongoing leaks concerning mass surveillance and the fact that the NSA is the original developer of SELinux, I'm wondering whether that means that backdoors should be expected in there? As every other obfuscated C contest, not at last the…
0xC0000022L
  • 1,604
  • 2
  • 15
  • 20
16
votes
2 answers

Network policies under AppArmor/SELinux

I am attempting to sandbox some untrusted processes using Linux's MAC frameworks -- either SELinux or AppArmor. I see that both SELinux and AppArmor allow the selected granting of socket level access to the program being sandboxed. However, is it…
Prashanth
  • 163
  • 5
10
votes
2 answers

Why does Android use SELinux?

To restrict/sandbox processes Android uses SELinux. Why was that chosen and not the linux capabilities or cgroups+namespaces solution? After all the cgroups+namespaces is kind of home grown for them too. What does SELinux provide or what do the…
user220201
  • 893
  • 9
  • 22
10
votes
3 answers

Is there an easy way to see a log of SCP activity on a server (ala /var/log/secure for ssh login)?

On Linux systems, /var/log/secure (or similar, depending on distro) shows all SSH login activity. Is there a similar log for SCP? If not, what's a good approach to enabling logging of scp activity on my servers? Is it SELinux through…
JJC
  • 471
  • 1
  • 3
  • 8
10
votes
2 answers

Does linux support signed binaries?

I am looking for something similar to what iOS supports. Does it exist in linux? With a secure boot (based in hardware chain of trust), doesn't it make sense to have signed binaries for security? Actually, if I have an opportunity to do signed…
user220201
  • 893
  • 9
  • 22
10
votes
2 answers

What are the security implications of disabling SELinux?

Is there any attack that would be possible just by disabling SELinux? Particularly on a server running http and ssh services?
Azad
  • 201
  • 2
  • 4
9
votes
3 answers

Restrict access to a specific directory on Linux

I want to limit access to a single directory on the hard disk (log files) to few processes (log files for a single process for example). All processes run under the same user, so file system access restrictions are not an option. What are my…
leoluk
  • 193
  • 1
  • 5
9
votes
5 answers

Prevent apps from having full access to user files

Applications should not have access to data of other applications or to user's private data unless user allows them. Isn't this an obvious need? But every program we launch has full access to our $HOME dir, to our mic and cam. Most users will not…
Sion0
  • 101
  • 6
9
votes
3 answers

Restrict network access for a single process with SELinux or AppArmor

I have a Python script that access the network, and I want to deny it network access sometimes. How can I achieve this with SELinux or AppArmor? I want to be able to launch this specific script with restricted access.
scythargon
  • 191
  • 1
  • 2
8
votes
1 answer

How does SELinux affect the Linux Kernel networking stack?

I'm interested in how SELinux effects the processing of packets through the networking stack. I've found the following questions and answers: Network policies under AppArmor/SELinux Filtering network access on a user/group/process basis The first…
RoraΖ
  • 12,317
  • 4
  • 51
  • 83
7
votes
2 answers

SELinux and text relocations exploitability

I have been assigned the task of adopting and implementing a certain backup software solution for our GNU/Linux farm. As per my deparment defined requirements, this solution should support SELinux enabled systems to be valid. After a not too…
dawud
  • 448
  • 5
  • 13
7
votes
2 answers

Opt-in a security profile at runtime, without tedious setup

I like lowering my access privilege mid-program (e.g. restrict my program to the current directory and files, disable networking). I imagine this is a pretty common wish. I would like to be able to do this as a normal user, without the involvement…
fluxrider
  • 171
  • 2
7
votes
2 answers

Difference between SELinux booleans "httpd_can_network_relay" and "httpd_can_network_connect"

I'm in the process of enabling SELinux on my CentOS 7.3 server. I have it set in permissive mode and monitoring the audit log for denials. I'm looking to implement the minimal set of rules that will allow all that is needed on the server and no…
user112461
1
2 3 4 5 6