Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions linux/vitalii/README-cron.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Cron ##
The cron command-line utility is a job scheduler on Unix-like operating systems. Users who set up and maintain software environments use cron to schedule jobs

The actions of cron are driven by a crontab (cron table) file, a configuration file that specifies shell commands to run periodically on a given schedule. The crontab files are stored where the lists of jobs and other instructions to the cron daemon are kept. Users can have their own individual crontab files and often there is a system-wide crontab file (usually in /etc or a subdirectory of /etc e.g. /etc/cron.d) that only system administrators can edit.
___

## Exemple ##

```
* * * * * <command to execute>
| | | | |
| | | | day of the week (0–6) (Sunday to Saturday;
| | | month (1–12) 7 is also Sunday on some systems)
| | day of the month (1–31)
| hour (0–23)
minute (0–59)
```
This example runs a shell program called export_dump.sh at 23:45 (11:45 PM) every Saturday.
```
45 23 * * 6 /home/oracle/scripts/export_dump.sh
```
**Note**: On some systems it is also possible to specify ```*/n``` to run for every n-th interval of time.
Also, specifying multiple specific time intervals can be done with commas (e.g., 1,2,3). The line below would output "hello world" to the command line every 5th minute of every first, second and third hour (i.e., 01:00, 01:05, 01:10, up until 03:55).
```commandline
*/5 1,2,3 * * * echo hello world
```
The configuration file for a user can be edited by calling ``crontab -e`` regardless of where the actual implementation stores this file
___

## Time zone handling ##

Most cron implementations simply interpret crontab entries in the system time zone setting that the cron daemon runs under.
This can be a source of dispute if a large multi-user machine has users in several time zones, especially if the system default time zone includes the potentially confusing DST.
Thus, a cron implementation may as a special case recognize lines of the form **"CRON_TZ=\<time zone\>"** in user crontabs, interpreting subsequent crontab entries relative to that time zone.
___

## Basic comands ##
1. Open the crontab configuration file for the current user by entering the following command:
```crontab -e```

> If this is your first time accessing the crontab, the system creates a new file. In Ubuntu 22.04, users are prompted to select a preferred text editor. Enter the corresponding number, for example, 1 for nano, to open the crontab file.

2. To schedule a job for a different user, add the -u option and the username:
```crontab -u [username] -e```

3. Enter the following command to list all cron jobs on your system without opening the crontab configuration file:
```crontab -l```

34 changes: 34 additions & 0 deletions network/vitalii/README-NAT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Task: Know, understand what NAT is, why it is needed, what is the principle of operation, where it is used
___

# NAT (Network Address Translation)
NAT - is a mechanism in TCP/IP networks that allows the IP address to be changed in the header of a packet passing through a traffic routing device.

## Problems solved by NAT

1. Allows you to save IP addresses (only when using NAT in PAT mode) by translating multiple internal IP addresses to one external public IP address (or multiple, but still fewer than internal).
2. Allows you to prevent or limit traffic from the outside to internal hosts, while allowing traffic from the inside to the outside. When a connection is initiated from within the network, a broadcast is created. Corresponding packets coming in from the outside match the created broadcast and are therefore passed through. If there is no corresponding broadcast for packets coming from the outside (and it can be created at connection initiation or static), they are not passed.
3. Allows you to hide individual internal services of internal hosts/servers. Basically, the same, above, translation to the specified port is performed, but you can replace the internal port of the officially registered service (for example, the 80th TCP port (HTTP server) with the external 54055). Thus, externally, on the external IP address, after broadcasting the address on the site (or forum), for familiar visitors, it will be possible to get to the address http://example.org:54055, but on the internal server, which is through NAT, it will work on the usual 80th port. Increasing security and preservation of "non-public" resources.

## NAT types
There are 3 basic concepts of address translation: static (**Static Network Address Translation**), dynamic (**Dynamic Address Translation**), overloaded (**NAPT, NAT Overload, PAT**).

**Static NAT** - Mapping an unregistered IP address to a registered IP address on a one-to-one basis. Especially useful when the device needs to be accessible outside the network.

**Dynamic NAT** - Maps an unregistered IP address to a registered address from a pool of registered IP addresses. Dynamic NAT also establishes a direct mapping between unregistered and registered addresses, but the mapping may change depending on which registered address is available in the address stack during communication.

**Overloaded NAT** (**NAPT, NAT Overload, PAT, masquerading**) is a form of dynamic NAT that converts multiple unregistered addresses into a single registered IP address using a variety of ports. Also known as PAT (**Port Address Translation**). During congestion, every computer on the private network broadcasts to the same address, but with a different port number.
___

### Useful links: ###
1. https://www.checkpoint.com/cyber-hub/network-security/what-is-network-address-translation-nat/
2. https://www.youtube.com/watch?v=L1JtmAiSaFQ&ab_channel=AndreySozykin
3. https://www.youtube.com/watch?v=B3LViQ_184Q&ab_channel=NajQazi
4. https://www.youtube.com/watch?v=hFGXq66mcqM&ab_channel=CloudLearners