Linux Security Flashcards
How do you check if AppArmor is up and running?
sudo aa-status
How would you setup a port/protocol rule on ufw
sudo ufw allow PORT/PROTOCOL comment “STRING”
You don’t need the comment but would help if an unusual port etc
How would you add more than one port to the ufw rule
eg. “… allow 21,22/tcp …”. For itemised
or
“…. allow 30000:40000/udp …” for a range
Prioritise a ufw rule to the top of the table
sudo ufw prepend RULE …
How to insert a ufw rule into a specific point on the table
First:
sudo ufw status numbered
Then:
sudo ufw insert LINE NO RULE
Create a ufw rule for ssh with a more restricted scope of inbound sources I.e local machines only
sudo ufw allow proto tcp from 192.168.0.0/24 to any port 22
Remove a ufw rule
sudo ufw status numbered
sudo ufw remove LINE NO
What’s the syntax for adding an entry to the bottom of the sudoers file?
username ALL=(ALL) All
Where from=(who as). What commands
Where is the sudoers file?
/etc/sudoers
Edit with Visudo
Where is the SE Linux configuration
/etc/selinux/config
Default policy setting of SELinux?
Targeted: Only enforces network daemon policy rules
Non default SEL settings
minimum - only specified process
mls - US military & gov
strict - all daemons, not recommended
How to change SEL state
sudo getenforce permissive/enforcing
To disable you have to change the config file!
What utility do you use to view and set SEL context for user accounts?
semanage
What does chcon do and What is the syntax?
Change default SEL context;
chcon -u USER -r ROLE -t TYPE /FILE
Where does SEL log its security events?
/var/log/audit/audit.log.
Can use audit2allow to generate policy to allow a denied event
AppArmor is usually installed by default in Ubuntu but what packages might you need to get?
apparmor-utils
apparmor-profiles
Where are AppArmor profiles stored?
/etc/apparmor.d
What is noteworthy about AA profile names?
That usually reference the application path but swap the / for .
eg usr.bin.mysqld
How do you view a list of active network ports without an AA profile defined?
sudo aa-unconfined
How do you turn off (but not disable) an AA profile?
aa-complain Profile_PATH
How do you turn an AA profile off and on?
sudo aa-disable PATH
sudo aa-enforce PATH
What tools are required to setup joining AD?
sssd-ad, sssd-tools, realmd, adcli
How do you test if you can join the AD realm (domain)?
sudo realm -v discover DOMAIN
Once everything is setup, how do you join an AD domain (realm)?
sudo realm join -U USER@DOMAIN domain.name
What tools required to connect a current sys to OpenLDAP
libnss-ldapd, libpam-ldapd, ldap-utils
Where do you modify an individual users ssh config?
~/.ssh/config
Where do you modify every user’s ssh config?
/etc/ssh/ssh_config