Lesson 12: Securing Linux Systems Flashcards
What is the CIA triad?
Every implanted security practice should be improving on of these: Confidentiality, Integrity, Availability
What command creates a boundary around a application to prevent cyberattacks?
Change root - commands chroot, create what is called a jail/boundary around a application
The syntax of the chroot command is chroot [options] {new root directory} [command]
How would you protect your logs?
Setup file auditing. Once audit is step you can configure in /etc/audit to protect syslog stored in /var/log and send to another location.
How can you protect your data if your physical computer is stolen?
Use encryption which creates a key the converts your data to cipher text
What is hashing?
Hashing deals with data integrity, to make sure data has not been tampered with
note.
Hashing takes the data, runs it through a mathematical formula that uses a key / algorithm to create a digest (like summary data) which would be compared to pull digest
How would encrypt the whole disk
LUKS - Linux Unified Key Setup allows you to encrypt the full disk by generating a managed key store
to encryt disk using luks use the cryptsetup command
cryptsetup –verbose –verify-passphrase luksFormat {disk_path}
verbose allow you to see whats happing as it happens
before data is copied to a encrypted disk you have to make sure it is mounted to unlock it
to mount and formate cryptsetup luksOpen {disk_path} {mount_name}
Then set file system mkfs.xfs /dev/mapper/{disk_mount_name}
then mount using mount command -> mount /dev/mapper/{disk_mount_name} /mnt/{folder_name}
What does the shred command do?
Shred command, will go through and write ones and zeroes to the disk to override any magnetic signature or crusty data on a disk. shred -v –iterations=3 {disk_path}
What is obfuscation?
The act of not securing something but hiding it - security theater
Where can you find ssh configurations?
The root folder is /etc/ssh :
/ssh_config file is for client configuration
/sshd_config file is for sever configurations
What are some ways to secure sshd?
- Change listening address
- use latest version (ssh version 2 use stronger encryption a larger key)
- in the ssh_config file require public keys to be in /ssh/known_host - enable “strict host key checking”
- add line in config file “protocol 2” to force the use of version 2 (systemctl restart sshd to make sure changes are applied)
- generate new keys: r
m * key* to remove existing keys
systemctl stop sshd
inside the ssh folder run ssh-keygen -t(type of key) rsa -f(where to place key) /etc/ssh/{use same file name}
note.
keys are based on /dev/random or urandom which may have som predictable sequences or pre generated keys that are installed on the insallintion media
Why would you store a fingerprint onto a client?
To know you’re connecting to a trusted server.
You can add in the .ssh folder in the home dir.
should be added to a text file /known host - contains public key of each host you trust
ssh-keyscan {server_location}»_space; ~/.ssh/known_hosts
takes output / public key from servers and places key in host file
How do you make sure all newly created users have the public keys?
place /known_hosts (public keys) file into the /etc/skel/.ssh folder
for exsisting users you will have to add manuel to the known_hosts file (be sure to append)
How do you view the ssh public key?
use ssh-keygen -lf {public key location} -E{algorithm (md5, sha, etc)}
What is SE Linux?
SELinux - Security Enhance Linux created by the NSA. Which has three modes detect inappropriate access - disable , permissive (keeps logs of access), enforcing (keeps log and prevents access), disable
How do you see if you are running SELinux?
Use comman sestatus - shows status, mount location, modes
How do you change SELinux role?
setenforce {enforce_level}
How do you chang SELinux boot mode?
Edit config file at /etc/selinux/config
How do you view selinux logs?
It is located in the var/log/audit/audit.log file
better to us tail or something else because file can get large
How do you view the SELinux labels on files, folder, etc.?
ls -lZ (cap Z) will show those lables or ps auxZ (cap Z)
What does the restorecon command do?
Allows you to put file or folder context back to what it is supposed to be by default
How do you view the status of App Armor?
apparmor_status
What three packages are necessary to install apparmor?
AppArmor packege, Profile and apparmor utility
How do you configure apparmor?
You can configure the files in the apparmor.d folder. & edit these three AppArmor packege, Profile and apparmor utility to configure further