- Windows Firewall Profiles
- Windows Firewall Profiles — Restrictions per Profile
- Firewall & network protection in Windows Security
- Network settings
- Also on the Firewall & network protection page:
- Настройка правил брандмауэра Windows групповыми политиками
- Групповые политики, использующиеся для управления настройками Брандмауэра Защитника Windows
- Включаем Windows Firewall с помощью GPO
- Создаем правило файервола с помощью групповой политики
- Проверка политик брандмаэера Windows на клиентах
- Импорт / экспорт правил Брандмауэра Windows в GPO
- Доменные и локальные правила брандмауэра
- Несколько советов об управлении брандмауэром Windows через GPO
Windows Firewall Profiles
When authoring your firewall rules it is best to only plumb your firewall rules to profiles that are appropriate for your scenarios and to modify your rules according to each specific profile.
Windows Firewall offers three firewall profiles: domain, private and public. The domain profile applies to networks where the host system can authenticate to a domain controller. The private profile is a user-assigned profile and is used to designate private or home networks. Lastly, the default profile is the public profile, which is used to designate public networks such as Wi-Fi hotspots at coffee shops, airports, and other locations.
Windows Firewall provides public APIs which can be used to acquire the current profile and to enable firewall rule groups on specific profiles. These APIs should be utilized by all installers to provide the best user experience and seamless integration.
Best practices are to create your rules in all three profiles, but only enable the firewall rule group on the profiles that suit your scenarios. For example, if you are installing a home media sharing application that is only used on a private network then it would be best to create firewall rules in all three profiles, but only enable the firewall rule group containing your rules on the private profile.
If the current profile is not one of the profiles which apply to your scenarios, then inform the user that your firewall rules are not enabled in the current profile. You should also inform the user that the application will not function as expected unless the user moves to a network which has one of the profiles that applies to your scenario or re-categorizes the current network.
Enabling rules that have been created in the public profile by default is not recommended.
Windows Firewall Profiles — Restrictions per Profile
You may also wish to modify the restrictions on your firewall rules depending on which profile the rules are applied to. For applications and services that are designed to only be accessed by devices or other computers within a home or small business network, it is best to modify the remote address restriction to specify «Local Subnet» only. The same application or service would not have this restriction when used in an enterprise environment. This can be done by adding the remote address restriction to rules that are added to the private and public profiles, while leaving them unrestricted in the domain profile. This remote address restriction should not apply to applications or services that require global Internet connectivity.
Firewall & network protection in Windows Security
Firewall & network protection in Windows Security lets you view the status of Microsoft Defender Firewall and see what networks your device is connected to. You can turn Microsoft Defender Firewall on or off and access advanced Microsoft Defender Firewall options for the following network types:
Domain (workplace) networks
Private (discoverable) networks
Public (non-discoverable) networks
If you want to change a setting select the network type you want to change it on.
You can specify that a particular network your device connects to is «private» or «public». The key difference is whether other devices on the same network are allowed to see, and maybe connect to, your device.
Your home network might be an example of a private network — in theory the only devices on that network are your devices, and devices owned by your family. So you might be fine with those other devices being able to see yours. We call that «discoverable» because all the devices on that network are allowed to «discover» each other.
The Wi-Fi at your local coffee shop, however, is a public network. Most of the other devices connected to it belong to strangers and you’d probably prefer they not be able to see, connect to, or «discover» your device.
Network settings
When you select one of the three network types you’ll get the settings page for it. Here Windows Security will tell you which, if any, networks of that type you’re currently connected to. Usually your computer will only be connected to one network at a time.
You’ll also find a simple slider for turning the firewall on, or off, for that type of network.
Important: Turning the firewall off may increase the risk to your device or data. We recommend leaving it on unless you absolutely need to turn it off.
Under the Incoming connections section you’ll find a single checkbox for Blocks all incoming connections, including those in the list of allowed apps. Checking this box tells the Microsoft Defender Firewall to ignore the allowed apps list and block everything. Turning this on increases your security, but may cause some apps to stop working.
Also on the Firewall & network protection page:
Allow an app through firewall — If the firewall is blocking an app you really need, you can add an exception for that app, or open a specific port. Learn more about that process (and why you might not want to) at Risks of allowing apps through Microsoft Defender Firewall.
Network and Internet troubleshooter — If you’re having general network connectivity issues you can use this troubleshooter to try and automatically diagnose and fix them.
Firewall notification settings — Want more notifications when your firewall blocks something? Fewer? Here’s where you can configure that.
Advanced settings — If you’re knowledgeable about firewall settings this will open the classic Windows Defender Firewall tool which lets you create inbound or outbound rules, connection security rules, and see monitoring logs for the firewall. Most users won’t want to dig into it that deeply; adding, changing, or deleting rules incorrectly can cause your system to be more vulnerable or can cause some apps not to work.
Restore firewalls to default — If someone, or something, has made changes to your Windows Firewall settings that is causing things not to work properly you’re just two clicks away from resetting the settings back to the way they were when you first got the computer. If your organization has applied any policies to configure the firewall those will be reapplied.
Настройка правил брандмауэра Windows групповыми политиками
Брандмауэр Windows позволяет ограничить исходящий / входящий сетевой трафик для определенного приложения или TCP/IP порта, и является популярным средством ограничения сетевого доступа к (от) рабочим станциям пользователей или серверам. Правила Windows Firewall можно настроить индивидуально на каждом компьютере, или, если компьютер пользователя включен в домен Windows, администратор может управлять настройками и правилами брандмауэра Windows с помощью групповых политик.
В крупных организация правила фильтрации портов обычно выносятся на уровень маршрутизатором, L3 коммутаторов или выделенных межсетевых экранах. Однако ничего не мешает вам распространить ваши правила ограничения сетевого доступа Windows Firewall к рабочим станциям или серверам Windows.
Групповые политики, использующиеся для управления настройками Брандмауэра Защитника Windows
С помощью редактора доменной групповой политики (group Policy Management Console – gpmc.msc) создайте новую политику с именем Firewall-Policy и перейдите в режим редактирования (Edit).
В консоли групповой политики есть две секции, в которых можно управлять настройками брандмауэра:
- Computer Configuration -> Administrative Templates -> Network -> Network Connections -> Windows Firewall – эта секция GPO использовалась для настройки правил брандмауэра для ОС Vista / Windows Server 2008 и ниже. Если у вас в домене нет компьютеров со старыми ОС, для настройки файервола используется следующая секция.
Network -> Network Connections -> Windows Firewall » width=»609″ height=»276″ srcset=»https://winitpro.ru/wp-content/uploads/2018/12/administrative-templates-greater-network-greater-network-con.png 968w, https://winitpro.ru/wp-content/uploads/2018/12/administrative-templates-greater-network-greater-network-con-300×136.png 300w, https://winitpro.ru/wp-content/uploads/2018/12/administrative-templates-greater-network-greater-network-con-768×348.png 768w» sizes=»(max-width: 609px) 100vw, 609px»/>
- Computer Configuration -> Windows Settings -> Security Settings -> Windows Firewall with Advanced Security – это актуальный раздел для настройки Брандмауэра Windows в современных версиях ОС и по интерфейсу он напоминает интерфейс локальной консоли управления Брандмауэра.
Включаем Windows Firewall с помощью GPO
Чтобы пользователи (даже с правами локального админа) не могли выключить службу брандмауэра, желательно настроить автоматический запуск службы Windows Firewall через GPO. Для этого перейдите в раздел Computer Configuration- > Windows Settings -> Security Settings -> System Services. Найдите в списке служб Windows Firewall и измените тип запуск службы на автоматический (Define this policy setting -> Service startup mode Automatic). Убедитесь, что у пользователей нет прав на остановку службы.
Перейдите в раздел консоли GPO Computer Configuration -> Windows Settings -> Security Settings. Щелкните ПКМ по Windows Firewall with Advanced Security и откройте свойства.
На всех трех вкладках Domain Profile, Private Profile и Public Profile (что такое профиль сети) измените состояние Firewall state на On (recommended). В зависимости от политик безопасности в вашей организации вы можете указать, что все входящие подключения по умолчанию запрещены(Inbound connections -> Block), а исходящие разрешены (Outbound connections -> Allow) и сохраните изменения.
Создаем правило файервола с помощью групповой политики
Теперь попробуем создать разрешающее входящее правило файервола для всех. Например, мы хотим разрешить подключение к компьютерам по RDP (порт TCP 3389). Щелкните ПКМ по разделу Inbound Rules и выберите пункт меню New Rule.
Мастер создания правила брандмауэра очень похож на интерфейс локального Windows Firewall на обычном компьютере.
Выберите тип правила. Можно разрешить доступ для:
- Программы (Program) – можно выбрать исполняемый exe программы;
- Порта (Port) – выбрать TCP/UDP порт или диапазон портов;
- Преднастроенное правило (Predefined) – выбрать одно из стандартных правил Windows, в которых уже имеются правила доступа (описаны как исполняемые файлы, так и порты) к типовым службам (например, AD, Http, DFS, BranchCache, удаленная перезагрузка, SNMP, KMS и т.д.);
- Собственное правило (Custom) – здесь можно указать программу, протокол (другие протоколы помимо TCP и UDP, например, ICMP, GRE, L2TP, IGMP и т.д.), IP адреса клиентов или целые IP подсети.
В нашем случае мы выберем правило Port. В качестве протокола укажем TCP, в качестве порта – порт 3389 (RDP порт по-умолчанию, можно изменить).
Далее нужно выбрать что нужно сделать с таким сетевым соединением: разрешить (Allow the connection), разрешить если оно безопасное или заблокировать (Block the connection).
Осталось выбрать профили файервола, которым нужно применить правило. Можно оставить все профили (Domain, Private и Public).
На последнем шаге нужно указать имя правило и его описание. Нажмите кнопку Finish и оно появится в списке правил брандмауэра.
Аналогичным образом вы можете настроить другие правила для входящего трафика, которые должны применятся к вашим клиентам Windows.
Не забываете, что нужно создать правила для входящего и исходящего трафика.
Теперь осталось назначить политику Firewall-Policy на OU с компьютерами пользователей
Проверка политик брандмаэера Windows на клиентах
Обновите политики на клиентах (gpupdate /force). Проверьте, что указанные вами порты доступны на компьютерах пользователей (можно использовать командлет Test-NetConnection или утилиту Portqry).
На ПК пользователя откройте Панель управления\Система и безопасность\Брандмауэр Защитника Windows и убедитесь, что появилась надпись: Для обеспечения безопасности, некоторые параметры управляются групповой политикой (For your security, some settings are controlled by Group Policy), и используются заданные вами настройки брандмаэера.
Пользователь теперь не может изменить настройки брандмауэра, а в списке Inbound Rules должны быть указаны все созданные вами правила.
Также вы можете вывести настройки файервола с помощью команды:
netsh firewall show state
Импорт / экспорт правил Брандмауэра Windows в GPO
Конечно, процесс создания правил для брандмауэра Windows – очень кропотливое и долгое занятие (но результате того стоит). Для упрощения свое задачи можно воспользоваться возможностью импорт и экспорта настроек брандмауэра Windows. Для этого вам достаточно нужным образом настроить локальные правила брандмауэра на обычном рабочей станции. Затем встаньте на корень оснастки брандмауэра (Монитор Брандмауэра Защитника Windows в режиме повышенной безопасности) и выберите пункт Действие -> Экспорт политики.
Политика выгружается в WFW файл, который можно импортировать в редакторе Group Policy Management Editor, выбрав пункт Import Policy и указав путь к файлу wfw (текущие настройки будут перезаписаны).
Доменные и локальные правила брандмауэра
В зависимости от того, хотите ли вы, чтобы локальные администраторы могли создавать на своих компьютерах собственные правила брандмауэра и эти должны быть объединены с правилами, полученными с помощью групповой политики. в групповой политике вы можете выбрать режим объединения правил. Откройте свойства политики и обратите внимание на настройки в разделе Rule merging. По умолчанию режим объединения правил включен. Вы можете принудительно указать, что локальный администратор может создавать собственные правила брандмауэра: в параметре Apply local firewall rules выберите Yes (default).
Несколько советов об управлении брандмауэром Windows через GPO
Конечно, для серверов и рабочих станций нужно создавать отдельные политики управления правилами брандмауэра (для каждой группы одинаковых серверов возможно придется создать собственные политики в зависимости от их роли). Т.е. правила файервола для контроллера домена, почтового Exchange сервера и сервера SQL будут отличаться.
Какие порты нужно открыть для той или иной службы нужно искать в документации на сайте разработчика. Процесс довольно кропотливый и на первый взгляд сложный. Но постепенно вполне реальной придти к работоспособной конфигурации Windows файервола, который разрешает только одобренные подключения и блокирует все остальное. По опыту хочу отметить, что на ПО Microsoft можно довольно быстро найти список используемых TCP/UDP портов.