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
18 changes: 18 additions & 0 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from flask import Flask, request

app = Flask(__name__)

@app.route('/get', methods=['GET'])
def get_check():
return "GET checked\n"

@app.route('/post', methods=['POST'])
def post_check():
return f"POST checked: {request.json}\n"

@app.route('/put', methods=['PUT'])
def put_check():
return f"PUT checked: {request.json}\n"

if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)
Empty file added configs/linux_A.yaml
Empty file.
Empty file added configs/linux_B.yaml
Empty file.
Empty file added configs/linux_C.yaml
Empty file.
Binary file added pics/iptables1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/iptables2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/net1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/net2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/net3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/python.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/python_check1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/tcpGET1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/tcpPOST.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/tcpPOST1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/tcpPUT1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/vmC_check_curl1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Отчёт по работе №1: Практика Linux (VirtualBox)

**Этап 1: Создание виртуальных машин и настройка пользователей.**
Создаём одну ВМ на основе скачанного образа и создаём две её копии.
Далее настраиваем сетевые адаптеры по заданию (две подсети: servernet и clientnet + сетевой мост).
После этого на каждой машине вручную задаем новый hostname и user.
<br>`Linux A: user=shipilov_1, hostname=shipilovserver`
<br>`Linux B: user=shipilov_2, hostname=shipilovgateway`
<br>`Linux C: user=shipilov_3, hostname=shipilovclient`

<br><br>

**Этап 2: Netplan конфигурации.**
Необходимо переписать конфиги *netplan* согласно заданию и применить их командой *sudo netplan apply*:

![Netplan конфиг A](pics/net1.png)
![Netplan конфиг B](pics/net2.png)
![Netplan конфиг C](pics/net3.png)

<br>

На Linux А был для 'enp0s3' был выставлен автоматический айпи-адрес, а для 'enp0s8' - "192.168.15.10/24".
На Linux B был для 'enp0s3' был также выставлен автоматический айпи-адрес, для 'enp0s8' - "192.168.15.1/24", а для enp0s9 - "192.168.11.1/24".
На Linux С был для 'enp0s3' выставлен автоматический айпи-адрес, а для 'enp0s8' - "192.168.11.1/24".

<br><br>

**Этап 3: Донастройка каждой виртуальной машины.**
*Linux A*:<br>
Необходимо реализовать простое приложение на Flask (предварительно скачав его и Python) с тремя эндпоинтами (/get, /post, /put),
а также написать под него сервис, задача которого состоит в запуске приложение через автозагрузку:

![Flask app](pics/python.png)

<br>

*Linux B*:<br>
Необходимо настроить iptables для маршрутизации пакетов от машины A до машины C с фильтрацией пакетов по 5000-му порту:
Также необходимо включить ip_forward в настройках системы:

![iptables](pics/iptables1.png)
![iptables](pics/iptables2.png)

<br><br>

**Этап 4: Тестирование системы.**
*Linux A*:<br>
Запускаем на Linux A приложение командой `python3 app.py` и проверяем, на каких адресах работает. <br>

*Linux B*:<br>
Запускаем `tcpdump` для просмотра логов передачи пакетов между клиентом и сервером. <br>

*Linux С*:<br>
Отправляем три запроса (/get, /post, /put) для проверки:

![Linux A_py](pics/python_check1.png)
![Linux C_curl](pics/vmC_check_curl1.png)
![tcpGET](pics/tcpGET1.png)
![tcpPOST](pics/tcpPOST1.png)
![tcpPUT](pics/tcpPUT1.png)

Представленные скриншоты подтверждают работоспособность системы: все виртуальные машины успешно настроены, связь и фильтрация пакетов налажена, а Flask приложение отрабатывает все запросы.