Skip to content

Commit

Permalink
Merge pull request #595 from chrisdpa-tvx/windows_firewall
Browse files Browse the repository at this point in the history
Add a basic set of windows firewall checks
  • Loading branch information
mizzy authored Sep 27, 2017
2 parents 784d0bf + 3b10d15 commit 0ebb611
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/serverspec/helper/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Type
windows_feature windows_hot_fix windows_registry_key
windows_scheduled_task zfs docker_base docker_image
docker_container x509_certificate x509_private_key
linux_audit_system hadoop_config php_extension
linux_audit_system hadoop_config php_extension windows_firewall
)

types.each {|type| require "serverspec/type/#{type}" }
Expand Down
28 changes: 28 additions & 0 deletions lib/serverspec/type/windows_firewall.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module Serverspec::Type
class WindowsFirewall < Base
def exists?
@runner.check_firewall_exists(@name)
end

def tcp?
@runner.check_firewall_has_protocol(@name, 'TCP')
end

def has_localport?(port)
@runner.check_firewall_has_localport(@name, port)
end

def inbound?
@runner.check_firewall_has_direction(@name, 'Inbound')
end

def enabled?
@runner.check_firewall_is_enabled(@name)
end

def allowed?
@runner.check_firewall_has_action(@name, 'Allow')
end

end
end

0 comments on commit 0ebb611

Please sign in to comment.