Module 2 of 8Free to explore

Firewall rules: allow what is needed and verify the denial

120–150 minutes with practiceTheory and practiceEasy

A working page is half the check

A student needs a lesson while a tutor also needs staff files. Allowing students every destination and port might make the page work, but removes the intended boundary. Here you will design precise rules, predict five decisions and identify a rule that silently defeats a denial. The main output is a reviewable matrix and change proposal, without modifying your home network.

1. What a firewall decides

A firewall evaluates communication against conditions. A gateway sees traffic that passes through it; a host firewall protects communication involving that workstation. These are different locations. A gateway’s policy does not necessarily control two neighbours in the same VLAN when their exchange never crosses it.

Rule conditions can include source, destination, zone, transport protocol, port, user and action. The source initiates the exchange being evaluated; the destination receives it. A zone groups interfaces or areas under a common policy. A zone name does not enforce protection on its own. tcp/443 and udp/443 are separate conditions.

A stateful firewall tracks communication state. Replies may be allowed as part of an established session; adding a broad reverse rule for every reply is unnecessary. When evaluating a changed rule, consider existing sessions: an old session and a new connection can behave differently. A real lab follows its version’s procedure without terminating all operational connections.

Segmentation separates network areas and restricts required connections. NAT translates addresses or ports; it is not itself policy authorization. Translation and an allow decision are different observations. An NGFW adds functions such as application recognition and IPS. Its name neither guarantees the correct protection profile nor replaces application permissions on documents.

A narrow rule, evaluation order and two independent checks

The diagram checks useful traffic and forbidden traffic separately. One successful page does not establish segmentation.

2. Product access and the free route

Our Russian product example is UserGate NGFW. It is commercial: using its image and features requires authorized training access and a valid licence or officially provided trial terms. This course supplies no licence and does not promise everyone a console. Confirm images, trial duration and subscriptions with the vendor or lab owner before installing anything. Certification applies to particular documented versions; this lesson does not claim that every build is certified.

The required free case uses an ordinary editor and a browser with official documentation. Create NetworkLab/firewall-plan.txt. Open the firewall chapter for the relevant release. Locate the documented Network Policies → Firewall section, Add action, and source, destination, service and logging fields. Read their descriptions without applying changes in somebody else’s console. A 6.1.x article and the 7.x manual must not be presented as one identical interface.

If an authorized training console is available, first locate the rule list, enabled state, ordering and traffic log. Add opens a form; it does not automatically establish a safe policy. Before saving, know the destination object, service and restoration method. UserGate evaluates rules from top to bottom and uses the first complete match. A later narrow denial cannot repair an earlier broad allowance.

Mini-exercise A: locate Allow/Deny and write four condition names in your proposal. Mini-exercise B: compare Students -> Lesson tcp/443 allow with Students -> Any any allow. The second covers more destinations and services. You are ready when you can explain source, destination, service, action and why rearranging rules can change the result.

3. Read a log before searching it

This is invented teaching data, not a UserGate export or guaranteed log syntax:

10:05:00 src=10.50.10.25 dst=10.50.20.8
proto=tcp dport=443 rule=Student-Lesson action=allow
10:06:00 src=10.50.10.25 dst=10.50.20.9
proto=tcp dport=445 rule=Student-Deny action=deny

src is source, dst destination and dport the destination port. rule explains the decision. Time correlates an event with a test. allow reports a network decision, not HTTP200. deny reports the card’s policy outcome; a client timeout without a log does not identify the device responsible.

UserGate logging is configured in rules. A missing line may result from disabled logging, a different time filter or traffic taking another path. Do not enable per-packet logging on an operational gateway for this exercise; it adds load and data volume. A named training-session event is sufficient if the version and access support it.

Practice 4. requirement before rule

All addresses are fictional. Do not test them against your network.

Students: 10.50.10.0/24
Tutors:   10.50.11.0/24
Lesson:   10.50.20.8, HTTPS tcp/443
Files:    10.50.20.9, SMB tcp/445
Student need: lesson only
Tutor need: lesson and files
Other exchange: denied in this teaching model

Step 1. Write a four-row matrix: student-to-lesson, student-to-files, tutor-to-lesson and tutor-to-files. Allow the first, deny the second and allow the last two. Add “other traffic denied”. These are explicit inputs, not conclusions inferred from what already works.

Step 2. Create the ordered proposal. Names let a reviewer locate a rule in logs:

1 Student-Lesson: Students -> Lesson tcp/443 allow, log
2 Tutor-Lesson:   Tutors   -> Lesson tcp/443 allow, log
3 Tutor-Files:    Tutors   -> Files  tcp/445 allow, log
4 Remaining:     Any      -> Any    any     deny, log

Any belongs to this teaching table, not an importable configuration. A product first needs address and service objects matched to its version. Real infrastructure requirements, including DNS and management, need separate analysis. This table is not a complete organizational policy.

Step 3. Evaluate each request from the top and mark the first line matching every condition. Student-to-lesson/443 matches1. Student-to-files/445 reaches4. Tutor-to-files/445 matches3. Student-to-lesson/445 reaches4. Student-to-lesson/udp443 also reaches4 because the transport differs. Save all five decisions and rule numbers.

Step 4. Apply a negative control to the proposal. Insert Students -> Any any allow at the beginning and reevaluate student-to-files. The broad rule now matches before the denial. The problem is rule order and scope. Remove this inserted line and reevaluate all five requests.

Step 5. Compare the intended actions with the two teaching log entries. These entries support only their listed events. A similar third flow is not automatically tested. Record missing evidence and a plan for collecting it on an authorized lab.

5. Optional licensed, isolated VM

This route is additional. A lab owner must supply UserGate, client VMs, an address map, console access, permissions and a restoration snapshot. Do not apply this setup to the home router or host operating-system firewall. Verify that gateway management uses an approved path independent of the rule being changed.

Save the baseline export or snapshot according to the owner’s procedure. Create only lab address and service objects, then uniquely named narrow rules. Initiate new requests between owned VMs according to the matrix, recording time, client outcome and matching rule. A failed page alone is insufficient: check the log and the service’s availability. Investigate one condition, route and ordering issue before broadening permissions.

Afterwards restore the baseline or snapshot, remove your temporary objects as planned and verify normal training access. Without a VM the required work remains a completed proposal with calculated checks. Do not describe it as a deployed NGFW.

6. Deliverable and readiness

Your firewall-plan.txt contains requirements, the four initial rules, five decisions, the broad-rule defect and its corrected version. Label documentation readings, map predictions and any actually tested VM traffic separately.

Frequent mistakes include equating NAT with allowance, reversing source and destination, omitting the transport, interpreting allow as permission to somebody else’s file and forgetting traffic that bypasses the firewall. The repeat step is concrete: match the request against each condition and the gateway’s position on the map. You are ready for VPN when you can restrict a new network path to its intended resource and test a denial separately.

Primary sources and additional reading

Try the idea yourself

Why a service cannot be reached

Change the conditions and observe this training model. It runs in your browser and does not change your computer.

DNS→Firewall→HTTPS :443
Observation

Choose conditions above to see an explanation of the result.

Independent exercise · Russian

На сортировочном участке терминалы должны только отправлять ведомости на сервер «Приёмка» по HTTPS. После переноса правил терминалам стал доступен и служебный веб-интерфейс «Учёт». В распоряжении администратора есть выгрузка политики и записи уже завершённых соединений.

Evidence

Правила применяются сверху вниз до первого совпадения. № 10: из зоны Терминалы в зону Серверы, TCP 443, разрешить. № 20: из Терминалов на «Учёт», любой сервис, запретить. № 90: прочее запретить. «Приёмка» и «Учёт» находятся в зоне Серверы. Журнал содержит две разрешённые записи на TCP 443, обе с номером 10.

Assignment

Предложите минимальную правку к правилу 10. Заполните ожидаемые номера правил для трёх обменов: Терминалы → Приёмка:443, Терминалы → Учёт:443 и Терминалы → Приёмка:22.

Compare your reasoning

Сузьте назначение правила 10 до узла «Приёмка». Тогда первая строка совпадёт с № 10, вторая с № 20, третья с № 90. Критерий приёмки по этим трём строкам журнала — одно разрешение и два запрета с ожидаемыми номерами. Такое изменение сохраняет отправку ведомостей и закрывает доступ к новым узлам зоны по умолчанию.

Personal practice environment

Check an excerpt, find matching lines and compute the SHA-256 of the original text. Temporary data expires after 30 minutes or when you close the environment.