What is windows firewall domain profile

How to configure a firewall for Active Directory domains and trusts

This article describes how to configure a firewall for Active Directory domains and trusts.

Original product version: В Windows Server 2019, Windows Server 2016, Windows Server 2012 R2 Standard, Windows Server 2012 Standard
Original KB number: В 179442

Not all the ports that are listed in the tables here are required in all scenarios. For example, if the firewall separates members and DCs, you don’t have to open the FRS or DFSR ports. Also, if you know that no clients use LDAP with SSL/TLS, you don’t have to open ports 636 and 3269.

More information

The two domain controllers are both in the same forest, or the two domain controllers are both in a separate forest. Also, the trusts in the forest are Windows Server 2003 trusts or later version trusts.

Client Port(s) Server Port Service
1024-65535/TCP 135/TCP RPC Endpoint Mapper
1024-65535/TCP 1024-65535/TCP RPC for LSA, SAM, NetLogon (*)
1024-65535/TCP/UDP 389/TCP/UDP LDAP
1024-65535/TCP 636/TCP LDAP SSL
1024-65535/TCP 3268/TCP LDAP GC
1024-65535/TCP 3269/TCP LDAP GC SSL
53,1024-65535/TCP/UDP 53/TCP/UDP DNS
1024-65535/TCP/UDP 88/TCP/UDP Kerberos
1024-65535/TCP 445/TCP SMB
1024-65535/TCP 1024-65535/TCP FRS RPC (*)

NETBIOS ports as listed for Windows NT are also required for Windows 2000 and Windows Server 2003 when trusts to domains are configured that support only NETBIOS-based communication. Examples are Windows NT-based operating systems or third-party Domain Controllers that are based on Samba.

For more information about how to define RPC server ports that are used by the LSA RPC services, see:

Windows Server 2008 and later versions

Windows Server 2008 newer versions of Windows Server have increased the dynamic client port range for outgoing connections. The new default start port is 49152, and the default end port is 65535. Therefore, you must increase the RPC port range in your firewalls. This change was made to comply with Internet Assigned Numbers Authority (IANA) recommendations. This differs from a mixed-mode domain that consists of Windows Server 2003 domain controllers, Windows 2000 server-based domain controllers, or legacy clients, where the default dynamic port range is 1025 through 5000.

For more information about the dynamic port range change in Windows Server 2012 and Windows Server 2012 R2, see:

  • The default dynamic port range for TCP/IP has changed.
  • Dynamic Ports in Windows Server.
Client Port(s) Server Port Service
49152 -65535/UDP 123/UDP W32Time
49152 -65535/TCP 135/TCP RPC Endpoint Mapper
49152 -65535/TCP 464/TCP/UDP Kerberos password change
49152 -65535/TCP 49152-65535/TCP RPC for LSA, SAM, NetLogon (*)
49152 -65535/TCP/UDP 389/TCP/UDP LDAP
49152 -65535/TCP 636/TCP LDAP SSL
49152 -65535/TCP 3268/TCP LDAP GC
49152 -65535/TCP 3269/TCP LDAP GC SSL
53, 49152 -65535/TCP/UDP 53/TCP/UDP DNS
49152 -65535/TCP 49152 -65535/TCP FRS RPC (*)
49152 -65535/TCP/UDP 88/TCP/UDP Kerberos
49152 -65535/TCP/UDP 445/TCP SMB (**)
49152 -65535/TCP 49152-65535/TCP DFSR RPC (*)

NETBIOS ports as listed for Windows NT are also required for Windows 2000 and Server 2003 when trusts to domains are configured that support only NETBIOS-based communication. Examples are Windows NT-based operating systems or third-party Domain Controllers that are based on Samba.

(*) For information about how to define RPC server ports that are used by the LSA RPC services, see:

(**) For the operation of the trust this port is not required, it is used for trust creation only.

External trust 123/UDP is only needed if you have manually configured the Windows Time Service to Sync with a server across the external trust.

Active Directory

In Windows 2000 and Windows XP, the Internet Control Message Protocol (ICMP) must be allowed through the firewall from the clients to the domain controllers so that the Active Directory Group Policy client can function correctly through a firewall. ICMP is used to determine whether the link is a slow link or a fast link.

In Windows Server 2008 and later versions, the Network Location Awareness Service provides the bandwidth estimate based on traffic with other stations on the network. There is no traffic generated for the estimate.

The Windows Redirector also uses ICMP Ping messages to verify that a server IP is resolved by the DNS service before a connection is made, and when a server is located by using DFS. If you want to minimize ICMP traffic, you can use the following sample firewall rule:

Unlike the TCP protocol layer and the UDP protocol layer, ICMP does not have a port number. This is because ICMP is directly hosted by the IP layer.

By default, Windows Server 2003 and Windows 2000 Server DNS servers use ephemeral client-side ports when they query other DNS servers. However, this behavior may be changed by a specific registry setting. Or, you can establish a trust through the Point-to-Point Tunneling Protocol (PPTP) compulsory tunnel. This limits the number of ports that the firewall has to open. For PPTP, the following ports must be enabled.

Client Ports Server Port Protocol
1024-65535/TCP 1723/TCP PPTP

In addition, you would have to enable IP PROTOCOL 47 (GRE).

When you add permissions to a resource on a trusting domain for users in a trusted domain, there are some differences between the Windows 2000 and Windows NT 4.0 behavior. If the computer cannot display a list of the remote domain’s users, consider the following behavior:

  • Windows NT 4.0 tries to resolve manually typed names by contacting the PDC for the remote user’s domain (UDP 138). If that communication fails, a Windows NT 4.0-based computer contacts its own PDC, and then asks for resolution of the name.
  • Windows 2000 and Windows Server 2003 also try to contact the remote user’s PDC for resolution over UDP 138. However, they do not rely on using their own PDC. Make sure that all Windows 2000-based member servers and Windows Server 2003-based member servers that will be granting access to resources have UDP 138 connectivity to the remote PDC.

Reference

Service overview and network port requirements for Windows is a valuable resource outlining the required network ports, protocols, and services that are used by Microsoft client and server operating systems, server-based programs, and their subcomponents in the Microsoft Windows Server system. Administrators and support professionals may use the article as a roadmap to determine which ports and protocols Microsoft operating systems and programs require for network connectivity in a segmented network.

You should not use the port information in Service overview and network port requirements for Windows to configure Windows Firewall. For information about how to configure Windows Firewall, see Windows Firewall with Advanced Security.

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.

Настройка правил брандмауэра 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 портов.

Читайте также:  Asus p5q установка windows с флешки
Оцените статью