saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.16k stars 5.48k forks source link

[BUG] Unable to configure Windows Firewall policy on Non-English systems #61534

Closed twangboy closed 5 months ago

twangboy commented 2 years ago

Description Unable to configure Windows Firewall policy on Non-English systems

https://bugzilla.eng.vmware.com/show_bug.cgi?id=2908191

The current method shells out to the netsh command line utility. The returns are localized depending on the language of the systems so we cannot guarantee English.

>netsh advfirewall show allprofiles

Configuración de Perfil de dominio:
----------------------------------------------------------------------
Estado                                ACTIVAR
Directiva de firewall                 BlockInbound,AllowOutbound
LocalFirewallRules                    N/A (solo almacén de GPO)
LocalConSecRules                      N/A (solo almacén de GPO)
InboundUserNotification               Deshabilitar
RemoteManagement                      Deshabilitar
UnicastResponseToMulticast            Habilitar

Registro:
LogAllowedConnections                 Deshabilitar
LogDroppedConnections                 Deshabilitar
FileName                              %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize                           4096

I've tried changing the codepage but it does not change the output.

Perhaps we can use some .NET libraries to set Windows Firewall instead of shelling out.

Steps to Reproduce the behavior Configure firewall policy on a Spanish system

Expected behavior You should be able to configure firewall policy

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ``` 3002+ ```
twangboy commented 2 years ago

May have to do .NET or something: https://docs.microsoft.com/en-us/windows/win32/api/_ics/ https://devblogs.microsoft.com/scripting/hey-scripting-guy-weekend-scripter-how-to-retrieve-enabled-windows-firewall-rules/ https://www.jianshu.com/p/78e70e8e363d https://docs.microsoft.com/en-us/windows/win32/api/netfw/

twangboy commented 5 months ago

This should be fixed by #66424