Transfer data throught the network Flashcards
What are the three profiles of Nginx through the ufw firewall?
- Nginx HTTP: port 80, unencrypted web traffic.
- Nginx HTTPS: port 443, TLS/SSL encrypted traffic.
- Nginx Full: both Nginx HTTP and HTTPS.
$ sudo ufw allow ‘[Nginx profile]’
Allow a specific Nginx profile through the ufw firewall.
$ sudo ufw status
List the traffic allowed through ufw.
What is the purpose of an init system like systemd?
To initialize the components that must be started after the Linux kernel is booted. it is also used to manage services and daemons for the server at any point while the system is running.
$ sudo systemctl start [application]
Start a systemd service, executing instructions in the service’s unit file.
$ sudo systemctl stop [application]
Stop a running systemd service.
$ sudo systemctl restart [application]
Restart a systemd service.
$ sudo systemctl reload [application]
Reload the application’s configuration files without restaring, if the application is able.
$ sudo systemctl reload-or-restart [application]
If unsure about the service, try to reload it first. if not possible, restart it.
$ sudo systemctl enable [application]
Start the service automatically at boot. This will create a symlink from the system’ s copy of the service file (/lib/systemd/system or /etc/systemd/system)) into the location on disk where systemd looks for autostart files (/etc/systemd/system/some_target.target.wants).
$ sudo systemctl disable [application]
Disable a service from starting automatically at boot by removing its symlink.
$ systemctl status [application]
Check the status of a service: state, cgroup hierarchy, first few log lines.
What are the important directories and files for nginx?
/var/www/html/: actual web content. This can be changed by altering Nginx configuration files. /etc/nginx/: Nginx directory for configuration files. /etc/nginx/nginx.conf: global Nginx configuration file. /etc/nginx/sites-available/: directory where per-site “server blocks” can be stored. Nginx will not use the configuration files found here unless they are linked to the sites-enabled directory. /etc/nginx/sites-enabled/: directory where enabled per-site “server-blocks” are stored. /etcnginx/snippets/: this directory contains potentially repeatable configuration fragments that can be included elsewhere. /var/log/nginx/access.log: every request to the web server is recorded here unless asked otherwise. /var/log/nginx/error.log: any Nginx errors will be recorded here.
What is the purpose of a host file, such as /etc/hosts?
It has the function to translate human-friendly hostnames into numeric protocol addresses called IP addresses, which uniquely identify and locate a host in an IP network. It can be used to personalized the hostname of the corresponding IP addresses.
How to associate a domain to an Ip address in a host file?
Example: 127.0.0.1 mydomain (for IPv4) ::1 mydomain (for IPv6)
$ sudo tail -f /var/log/nginx/access.log
Display the most recent logs of Nginx as they are appended.
$ sudo ufw app list
List the application configirations that ufw knows how to work with.
What is a server?
A computer connected to a network (intranet or extranet), offering a service. The principal differences with a personal computer is that:
- It offers services.
- There is no GUI.
- It is always turned on.
What is OpenSSH?
OpenSSH is a suite of security-related network-level utilities based on the Secure Shell (SSH) protocol, which help to secure network communications via the encryption of network traffic over multiple authentication methods and by providing secure tunneling capabilities.
Install OpenSSH (client-side, NOT server-side).
sudo apt-get install openssh-client
$ ssh-keygen -t rsa
Generate two SSH keys:
- Public: ~/.ssh/id_rsa.pub
- Private: ~/.ssh/id_rsa
Possibility to add a passphrase as an additional security to encrypt the private key.
How to authorize a connection from local host to the remote host / server?
The public key from local host should be copied to the remote host and its path appended to the ~/.ssh/authorized_keys file.
Get the public keys of any GitHub user.
$ curl https://github.com/.keys
For what is the tar command line tool used?
To get together several files into one large file called archive.
What is the difference between gzip, bzip2 and zip, rar?
- With gzip and bzip2, to compress several files into one archive, the user has to assemble the files together first (e.g. with tar) and then compress the archive.
- With zip and rar, the previous two-step process is done in one step.
How to use tar to create an archive?
- Get all files together under one directory ==> mkdir & mv
- Create a tar archive: $ tar -cvf [name].tar [directory]
What are common options for the tar command-line tool?
- -c: create an archive tar.
- -v: display operations details.
- -f: assemble the archive in a file.
- -t: list the files in ar archive.
- -r: append a file to an archive.
- -x: extract.
Display the content of an archive with tar without extracting it.
$ tar -tf [tar_file]
Add a file to an archive already created.
$ tar -rvf [tar_file] [file]