selinux Flashcards

1
Q

How do you list the ports allowed for http ?

A

semanage port -l | grep http

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

Where are the audit logs for selinux?

A

/var/log/audit/audit.log

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

How do you get the status of selinux?

A

getenforce

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

What is the context attibuted to nginx by selinux?

A

httpd

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

How do you authorize another port for httpd context? For instance, port 5000?

A

semanage port -m -t http_port_t -p tcp 5000

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

What is the wider alternative to allow nginx to network and how can you set it and remove it?

A

To enable:
setsebool -P httpd_can_network_connect 1
To disable:
setsebool -P httpd_can_network_connect 0

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

If you have an error in the selinux log how can investigate the error and understand why it’s happening? Let’s say the id is:
1694301099.423:104

A

grep 1694301099.423:104 /var/log/audit/audit.log | audit2why

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

How can you investigate errors related to the httpd context?

A

By putting the context in permissive mode:
semanage permissive -a httpd_t
This will log the errors instead of blocking them.

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

How can you set the context for httpd to permissive mode?

A

semanage permissive -a httpd_t

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

How do you remove the permissive mode for httpd if it’s enabled?

A

semanage permissive -d httpd_t

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

Where is the selinux config?

A

/etc/sysconfig/selinux

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

Create a command using grep to find the nginx denied error

A

grep nginx /var/log/audit/audit.log | \
grep denied

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