SELinux Flashcards

1
Q

Check the current SELinux state:

A

getenforce

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

There are 3 states in SELinux:

A

disabled, permissive, and enforcing

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

How to change the state of SELinux:

A

setenforce {Permissive or 0, Enforcing or 1}

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

Where are the SELinux logs?

A

/var/log/audit/audit.log

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

How to search the logs?

A

grep AVC /var/log/audit/audit.log
or
sealert -a /var/log/audit/audit.log

(Access Vector Cache)

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

SELinux Overview

A

SELinux is essentially labeling, called security contexts

All processes, files, and directories have security contexts. All files and directories in inherit a default security context.

SELinux is a type enforcement system

SELinux messages for allowing or denying are cached as Access Vector Cach(AVC)

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

SELinux Messages Contain?

A
scontext = source context of the process 
tcontext = target context of the process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Two packages to install to help troubleshoot SELinux

A

yum install policycoreutils-gui setroubleshoot

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

File that contains the state of SELinux?

A

/etc/selinux/config

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

To see the man pages related to SELinux?

A

apropos selinux

man -k selinux

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

to view the secuirty context on a file or directory?

A

ls -Z /etc/

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

The security context is broken down into three components

A

User:Role:Type

User- refers to the type of user logged in
Role- Which indicates the purpose of this file

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

View the security context for a running process

A

ps auZ

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

Reference a files security context and transfer it to another file:

A

chcon –reference /root/anaconda-ks.cfg /etc/ssh/sshdconfig

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

To restore the default security context ?

A

restorecon -R /root/.ssh

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

How to set the security context manually?

A

chcon -t etc_t /etc/ssh/sshd_config (will not survive a system relablel)

17
Q

How to make a manual security context change persistent?

A

semanage fcontext -a -t etc_t “/etc/ssh/sshd_config”

semanage fcontext -a -t httpd_sys_content_t “/web(/.*)?”

18
Q

To see a complete list of SELinux booleans?

A

semanage boolean -l | less

19
Q

Set SE booleans related to a specify service?

A

getsebool -a | grep ftp

20
Q

To set a boolean

A

setsebool -P ftp ftp_home_dir on

21
Q

Get the status of SELinux

A

sestatus

22
Q

Look at the man for semanage examples

A

man semanage-fcontext

23
Q

search the audit log

A

ausearch -m avc

24
Q

To see the default type context

A

semanage fcontext -l

semanage fcontext -l | grep httpd

25
Q

Relabel SELinux

A

touch /.autorelabel

26
Q

Change the default type context in selinux

A

semanage fcontext -a -t http_sys_content_t ‘/content(/.*)?’

  • a = add
  • t = type
27
Q

Restore the context recursively

A

restorecon -Rv /content

28
Q

Delete the context

A

semanage fcontext -d “/content(/.*)?”

29
Q

list the available boolean values on the system

A

getsebool -a

30
Q

Look at all the default boolean values

A

semanage boolean -l

31
Q

To find out what package you need to install to use semanage

A

yum whatprovides semanage

32
Q

Package you need to install to use sealert

A

yum install -y setroubleshoot-server