Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-5029

{dsc} : {xFirewall not working}

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • dsc
    • Windows
    • Needs Assessment
    • Needs Assessment

    Description

      Basic Info
      Module Version: 1.3.0
      Puppet Version: 4.9
      OS Name/Version: Windows Server 2012 R2
      Other Software: WMF 5.1; .NET 4.5.2

      I'm trying to use xFirewall resource through Puppet and I'm not being able to do it as expected. I already used other resources like dsc_file and dsc_windowsfeature and they work.

      I tested using a simple rule, but since it wasn't working I tried to mimic the example provided in the Powershell/xNewtworking module (see example 1 from https://github.com/PowerShell/xNetworking/wiki/xFirewall)

      here is the code I wrote:

      class hg_windows_dev::ts_firewall_dsc {
        dsc_xfirewall { 'test-dsc_xfirewall':
          dsc_name        => 'NotePadFirewallRule',
          dsc_displayname => 'Firewall Rule for Notepad.exe',
          dsc_group       => 'NotePad Firewall Rule Group',
          dsc_ensure      => 'Present',
          dsc_enabled     => 'True',
          dsc_profile     => "('Domain', 'Private')",
          dsc_direction   => 'OutBound',
          dsc_remoteport  => "('8080', '8081')",
          dsc_localport   => "('9080', '9081')",
          dsc_protocol    => 'TCP',
          dsc_description => 'Firewall Rule for Notepad.exe',
          dsc_program     => 'c:\windows\system32\notepad.exe',
          dsc_service     => 'WinRM',
        }
      }
      

      Things to take in consideration:

      1. Firewall was always enabled
      2. I tested with a DSC script locally in the machine to set the firewall rules and it worked. (I had to import the xNetworking module, of course).
        the code:

      Configuration DSCFirewallRule
      {
          param
          (
              [string[]] $NodeName = 'localhost'
          )
       
          Import-DSCResource -ModuleName xNetworking
       
          Node $NodeName
          {
              xFirewall Firewall 
              {
                  Name        = 'NotePadFirewallRule'
                  DisplayName = 'Firewall Rule for Notepad.exe'
                  Group = 'NotePad Firewall Rule Group'
                  Ensure      = 'Present'
                  Enabled     = 'True'
                  Profile     = ('Domain', 'Private')
                  Direction   = 'OutBound'
                  RemotePort  = ('8080', '8081')
                  LocalPort   = ('9080', '9081')
                  Protocol    = 'TCP'
                  Description = 'Firewall Rule for Notepad.exe'
                  Program     = 'c:\windows\system32\notepad.exe'
                  Service = 'WinRM'
              }
       
          }
       
      }
       
      DSCFirewallRule
      Start-DscConfiguration -Path .\DSCFirewallRule -Wait -Force -Verbose
      

      Desired Behavior:
      Setting the rules properly.

      Actual Behavior:
      Nothing was applied.

      Attachments

        1. classes.txt
          0.3 kB
        2. DSC_xfirewall_lcm.PNG
          DSC_xfirewall_lcm.PNG
          79 kB
        3. puppet.log
          111 kB
        4. resources.txt
          0.5 kB
        5. state.yaml
          7 kB
        6. transactionstore.yaml
          3 kB

        Activity

          People

            Unassigned Unassigned
            ricardogaspar2 Ricardo Gaspar
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Zendesk Support