SELinux Flashcards

1
Q

What options are available in SELinux?

A

Enforcing = Enabled (Enabled by default)
Permissive = Disabled but logs the activity
Disabled = Disabled and does not log any activity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you check the status of SELinux?

A

sestatus or getenforce

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you enable and disable SELinux?

A

setenforce 0 = permissive/disabled
setenforce 1 = enabled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Where is the SELinux config file located and how can you modify the config for permanent setting?

A

/etc/selinux/config
SELINUX=enforcing
SELINUX=disabled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What should you do before modifying the SELinux config file?

A

Take a snapshot of your VM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Before rebooting to apply SELinux changes what file should you create?

A

./autorelabel

touch ./autorelabel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the two main concepts of SELinux?

A

Labeling -> user:role:type:level
Type enforcement
Note: Type is the main focus

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can you list the label of a file?

A

ls -lz /usr/sbin/httpd

Output:
-rwxr-xr-x. root root system_u:object_r:httpd_exec_t:s0 /usr/sbin/httpd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you list the label of a directory?

A

ls -dz /etc/httpd

Output:
drwxr-xr-x. root root systemu:object_r:httpd_config_t:s0 /etc/httpd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you find the label of a process?

A

ps axZ | grep httpd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How can you view a label at the socket level?

A

netstat -tnlpZ | grep http

labeled as http_t in memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the command to manage SELinux setting? Bonus: What are the available options?

A

semanage

Bonus:
login
user
port
interface
module
node
file context
boolean
permissive state
dontaudit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is boolean?

A

The On/Off switch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What command can you use to get a list of all booleans?

A

getsebool -a (for all)
semanage boolean -l (for list)

Both options have the same result

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What command can you use to turn on a boolean?

A

setsebool -P boolean_name on

On for on, Off for off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What command can you use to check error messages related to SELinux?

A

journalctl

17
Q

What command can you use to change the type in a label?

A

chcon -t httpd_syscontent_t FILENAME
semanage -t httpd_syscontent_t FILENAME