Lesson 12: Securing Linux Systems Flashcards

1
Q

What is the CIA triad?

A

Every implanted security practice should be improving on of these: Confidentiality, Integrity, Availability

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

What command creates a boundary around a application to prevent cyberattacks?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How would you protect your logs?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you protect your data if your physical computer is stolen?

A

Use encryption which creates a key the converts your data to cipher text

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

What is hashing?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How would encrypt the whole disk

A

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}

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

What does the shred command do?

A

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}

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

What is obfuscation?

A

The act of not securing something but hiding it - security theater

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

Where can you find ssh configurations?

A

The root folder is /etc/ssh :

/ssh_config file is for client configuration
/sshd_config file is for sever configurations

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

What are some ways to secure sshd?

A
  • 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

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

Why would you store a fingerprint onto a client?

A

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}&raquo_space; ~/.ssh/known_hosts
takes output / public key from servers and places key in host file

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

How do you make sure all newly created users have the public keys?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you view the ssh public key?

A

use ssh-keygen -lf {public key location} -E{algorithm (md5, sha, etc)}

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

What is SE Linux?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you see if you are running SELinux?

A

Use comman sestatus - shows status, mount location, modes

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

How do you change SELinux role?

A

setenforce {enforce_level}

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

How do you chang SELinux boot mode?

A

Edit config file at /etc/selinux/config

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

How do you view selinux logs?

A

It is located in the var/log/audit/audit.log file

better to us tail or something else because file can get large

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

How do you view the SELinux labels on files, folder, etc.?

A

ls -lZ (cap Z) will show those lables or ps auxZ (cap Z)

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

What does the restorecon command do?

A

Allows you to put file or folder context back to what it is supposed to be by default

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

How do you view the status of App Armor?

A

apparmor_status

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

What three packages are necessary to install apparmor?

A

AppArmor packege, Profile and apparmor utility

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

How do you configure apparmor?

A

You can configure the files in the apparmor.d folder. & edit these three AppArmor packege, Profile and apparmor utility to configure further

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

What are the two mode of app armor?

A

complain & enforce

25
Q

How would you change the behaviour of apparmor ?

A

Can be changed in the /etc/apparmor.d/tunables folder

26
Q

What does aa-unconfined do?

A

Will list apps that are listing on a network port

27
Q

How do you check for a apparmor profile?

A

Profiles are listed in the apparmor.d folder

28
Q

How do you create a apparmor profile?

A

use the apparmor-util packege to use the aa-genprof.

aa-genprof {app_name} -> creates a profile

note.

Run and use app in question

  • which {app_name} - allows you to view app path
  • s to scan
  • s to save
  • f to finish
29
Q

How do enforce a apparmor policy?

A

aa-{apparmor_mode} {profile_path}

  • restart app systemctl restart {app_name}
  • check in aa-unconfined which should show status
30
Q

m

A
30
Q

How do check if system is running firewalld ?

A

check firewalld services

run > systemctl status firewalld

31
Q

How do you interact with firewalld?

A

use firewall command > firewall -cmd {option}

example. firewall -cmd –status

32
Q

How do you view the list of firewall zones?

A

firewall -cmd –get-zones

33
Q

How do you check the default firewalld zone?

A

firewall -cmd –get-default-zone

34
Q

How do you list active firewalld zones?

A

firewall -cmd –get-active-zones

35
Q

How do you create a firewalld zone?

A

firewall -cmd –permanent –new-zones={zonne_name}

firewall-cmd –reload

36
Q

How do you attach a int to a zone?

A

navigate to file settings > /etc/sysconfig/network-scripts/{int_name} file and edit the ZONE settings, then restart int > systemctl restart network or systemctl restart firewalld

  • confirm by running the following command: firewall-cmd –get-avtive-zones
37
Q

How do you view the firewalld supported services ?

A

firewall-cmd –get-services

shows supported services and approved name - define at /usr/lib/firewall/services folder which will list xml files

38
Q

How do you add a services to a zone?

A

firewall-cmd –zone={zone_name} –permanent –add-service=http

39
Q

How do you view current allowed firewalld services?

A

firewall-cmd –list-services

40
Q

How do you add a port to firewalld?

A

firewall-cmd –zone={zone_name} –permanent –add-port={port_name}/{tcp, udp, or blank for both}

to confirm run: firewall-cmd –permanent –list-ports

41
Q

How do you check if the iptables is running?

A

systemctl status iptables

42
Q

How do you configure iptables firewall?

A

to view use - iptables –list or

43
Q

How do you create a iptable rules?

A

You can edit the config settings in /etc/sysconfig/iptables or use commands such as:

iptables -A INPUT -p {port} –dport {port name/number} -s {source} -j {action such as accept}

to save to disk use: iptable-save > /etc/sysconfig/iptables

44
Q

How do you view the iptables statistics?

A

iptables -vnL –line which shows statistics for your configuration line

45
Q

What are the different types of backup?

A

Differential backups - backups what changed doing last full backup. To restore you have to include last full backup and last differential backup

Incremental backup - backups what changed doing last full backup. then backups what change since last incremental backup. To restore you have to include last full backup then then each Incremental backup since last full backup

46
Q

What is the TAR utility ?

A

Stands for Tape Archive, that allows you to do a backup:

tar {option/s} {filename-save/restore_location} {path to backup/restore}

Options:
c -comprise 
x -extract 
v -sees output
z -runs through gzip
f -file name
47
Q

What is DAR?

A

Disk Archive utility is a upgrade to TAR which allow all full, differential, and incremental backups.

to install: apt install dar

48
Q

How do you run a full backup using DAR?

A

dar -R (recursive) {backup_target} -c {store_location/filename}

49
Q

How do you run a differential backup using DAR?

A

dar -R (recursive) {backup_target} -c {store_location/filename} -A {fullbackup_path}

50
Q

How do you run a incremental backup using DAR?

A

dar -R (recursive) {backup_target} -c {store_location/filename} -A {lastback_path}

51
Q

How do you restore a backup using DAR?

A

dar -x {saved_backup_path} -w {saved_differential backup or incremental}

52
Q

What is the DD utility ?

A

Is the Copy and Covert used to copy entire disk:

dd if={disk_path} of={output_file}

to restore reverse command: dd if={output_file} of={disk_path}

53
Q

What is Kerberos?

A

An authentication service based on time-sensitive ticket-granting system. Used as a single sign-on method

Kerberos commands to note:

  • kinit —Authenticates with Kerberos, granting the user a ticket granting ticket(TGT) if successful.
  • kpassword —Changes the user’s Kerberos password.
  • klist —Lists the user’s ticket cache.
  • kdestroy —Clears the user’s ticket cache
54
Q

List the steps to enable SSL/TLS in apache

A
  1. Generate self-signed certificate (OpenSSL, or obtain a certificate from an external authority)
  2. Download and install the mod_ssl package
  3. Open the /etc/httpd/conf.d/ssl.conf file for editing.
  4. Uncomment the Document Root and ServerName lines, then replace values as necessary.
  5. Ensure SSL Engine is set to on.
  6. Point SSL Certificate File to the path where certificate file is located.
  7. Point SSLCertificateKeyFile to the path where your private key file islocated.
  8. Restart Apache.
  9. Open a browser and verify that the site is presenting a certificate
55
Q

How would you disable the use of Ctrl+Alt+Del and why ?

A

to prevent users from rebooting a system anddisrupting service availability. On systemd systems, you can mask ctrl-alt-del.target to disable Ctrl+Alt+Del functionality: systemctl maskctrl-alt-del.target

56
Q

How would you enable the auditd service to ensure that records used in auditing are beingwritten to storage.

A

Use the aureport and ausearch commands to see auditing data.

Enter systemctl enable auditd to enable auditd at boot.

57
Q

What is PAM

A

Pluggable Authentication Modules (PAM) define the underlying framework and centralized authentication method leveraged by authentication services like Kerberos and LDAP.

PAM configuration files are located in the /etc/pam.d/ directory,

The following is an example of a password policy directive: password required pam_cracklib.so retry=5

58
Q

What are some things you can do using openssl?

A
  • Generate public and private keys.
  • Generate self-signed digital certificates in various formats.
  • Generate digital certificates for other entities based on CSRs.
  • Calculate hash values using various functions.
  • Encrypt and decrypt data using various algorithms.
  • Manage keys and certificates in a CA.
  • And more.

The syntax of the openssl command is openssl [subcommand] [options]

The openssl command can be used interactively through one of several subcommands, or you can provide these subcommands and any options non-interactively.