puppet-windows_firewall icon indicating copy to clipboard operation
puppet-windows_firewall copied to clipboard

Change already created rules/exceptions

Open azhurbilo opened this issue 8 years ago • 3 comments

How to reproduce (e.g Puppet code you use)

# run first time with
windows_firewall::exception { 'WINRM':
  ensure       => present,
  direction    => 'in',
  action       => 'Allow',
  enabled      => 'yes',
  protocol     => 'TCP',
  local_port   => '5985',
  remote_port  => 'any',
  display_name => 'Windows Remote Management HTTP-In',
  description  => 'Inbound rule for Windows Remote Management via WS-Management. [TCP 5985]',
}

# run second time with 'disabled' rule
windows_firewall::exception { 'WINRM':
  ensure       => present,
  direction    => 'in',
  action       => 'Allow',
  enabled      => 'no',
  protocol     => 'TCP',
  local_port   => '5985',
  remote_port  => 'any',
  display_name => 'Windows Remote Management HTTP-In',
  description  => 'Inbound rule for Windows Remote Management via WS-Management. [TCP 5985]',
}

What are you seeing

rule still enabled

What behaviour did you expect instead

rule disabled

Any additional information you'd like to impart

it because of

# Set command to check for existing rules
$check_rule_existance= "C:\\Windows\\System32\\netsh.exe advfirewall firewall show rule name=\"${display_name}\""
$unless = $check_rule_existance

if rule already exist you cannot change anything

azhurbilo avatar Mar 01 '17 17:03 azhurbilo