Manage security Flashcards

1
Q

how to set firewall zone

A

firewall-cmd –set-default-zone=dmz

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

how to allow specific IP/range through firewall

A

firewall-cmd –permanent –zone=internal –add-source=192.168.0.0/24

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

how to allow specific service through firewall

A

firewall-cmd –permanent –zone=internal –add-service=mysql

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

how to allow specific port through firewall

A

firewall-cmd –permanent –zone=internal –add-port=1001/tcp

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

how to save current firewall rules

A

firewall-cmd –reload

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

how to list firewall rules by zone

A

firewall-cmd –permanent –zone=internal –list-all

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

how to set ACL on a file for a specific user

A

setfacl -m u:name:rwX file

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

how to delete all ACL rules on a file

A

setfacl -x file

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

how to set ACL on a directory and all files under it

A

setfacl -R -m d:u:name:rwX directory

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

how to check ACL’s on a file

A

getfacl file-A

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

how to copy ACL’s that one file has to another easily

A

getfacl file-A | setfacl –set-file=- file-B

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

how to live change SELinux to enforcing

A

setenforce 1

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

how to live change SELinux to permissive

A

setenforce 0

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

how to check current status of SELinux

A

getenforce

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

where is the file to permanently change SELinux mode

A

vim /etc/selinux/config

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

how to check SELinux context of a file

A

ls -Z /file/or/folder

17
Q

how to change SELinux context of a file

A

chcon -t httpd_sys_content_t /virtual
Or (this sets it for that folder and anything under it)
semanage fcontext -a -t httpd_sys_content_t ‘/virtual(/.*)?’

18
Q

how to restore default file context

A

restorecon -v /virtual
or recursively for that folder and everything under it
restorecon -RFvv /virtual

19
Q

how to view the documents with the descriptions of the purpose of each available SELinux booleans

A

(first make sure they are installed “selinux-policy-doc”)

man -k ‘_selinux’

20
Q

how to list all SELinux booleans and their state

A

getsebool -a

21
Q

how to list a specific SELinux boolean and its state

A

getsebool httpd_enable_homedirs

22
Q

how to temporarily change the state of a SELinux boolean

A

setsebool httpd_enable_homedirs on

23
Q

how to permanently change the state of a SELinux boolean

A

setsebool -P httpd_enable_homedirs on

24
Q

how to list SELinux booleans in which the current state differs from the default state

A

semanage boolean -l -C

25
Q

what log file would you check for SELinux policy violations

A

tail /var/log/messages

26
Q

what command would you run to get extra information on a SELinux violation

A

sealert -l 613ca624-248d-48a2-a7d9-d28f5bbe2763

27
Q

what command would you use to easily see recent audit messages

A

ausearch -m AVC -ts recent

To search the /var/log/audit.log file use the ausearch command. The -m searches on the message type. The -ts option searches based on time.

28
Q

how to block an IP address/range through the firewall

A

firewall-cmd –permanent –zone=block –add-source=192.168.0.1/32