Added firewall rules

This commit is contained in:
Chan9390 2017-09-04 09:25:38 +05:30
parent 1f549fd8d7
commit bf97e32c34
No known key found for this signature in database
GPG Key ID: 6CC28422F21ED4FA
10 changed files with 78 additions and 0 deletions

View File

@ -30,3 +30,8 @@ cookbook_file 'C:\Program Files\Apache Software Foundation\tomcat\apache-tomcat-
source 'apache_struts/struts2-rest-showcase.war'
action :create
end
execute 'Update firewall rule' do
command 'netsh advfirewall firewall add rule name="Open Port 8282 for Apache Struts" dir=in action=allow protocol=TCP localport=8282'
action :run
end

View File

@ -0,0 +1,30 @@
#
# Cookbook:: metasploitable
# Recipe:: configure_firewall
#
# Copyright:: 2017, The Authors, All Rights Reserved.
execute 'Closed port 445 for SMB' do
command 'netsh advfirewall firewall add rule name="Closed port 445 for SMB" dir=in action=block protocol=TCP localport=445'
action :run
end
execute 'Closed port 139 for NetBIOS' do
command 'netsh advfirewall firewall add rule name="Closed port 139 for NetBIOS" dir=in action=block protocol=TCP localport=139'
action :run
end
execute 'Closed port 135 for NetBIOS' do
command 'netsh advfirewall firewall add rule name="Closed port 135 for NetBIOS" dir=in action=block protocol=TCP localport=135'
action :run
end
execute 'Closed Port 3389 for Remote Desktop' do
command 'netsh advfirewall firewall add rule name="Closed Port 3389 for Remote Desktop" dir=in action=block protocol=TCP localport=3389'
action :run
end
execute 'Closed Port 3306 for MySQL' do
command 'netsh advfirewall firewall add rule name="Closed Port 3306 for MySQL" dir=in action=block protocol=TCP localport=3306'
action :run
end

View File

@ -66,3 +66,8 @@ end
powershell_script 'Test' do
code "$body = [System.Text.Encoding]::ASCII.GetBytes('{\"user\":\"kimchy\", \"post_date\": \"2009-11-15T14:12:12\", \"message\": \"Elasticsearch\" }'); $req = [System.Net.HttpWebRequest]::Create('http://localhost:9200/metasploitable3/message/1'); $req.method = 'PUT'; $req.ContentType = 'application/x-www-form-urlencoded'; $stream = $req.GetRequestStream(); $stream.Write($body, 0, $body.Length); $stream.close(); $req.GetResponse()"
end
execute 'All firewall rule' do
command 'netsh advfirewall firewall add rule name="Open Port 9200 for ElasticSearch" dir=in action=allow protocol=TCP localport=9200'
action :run
end

View File

@ -57,3 +57,13 @@ batch 'Configure files' do
sc config "domain1" obj= "NT Authority\\LOCAL SERVICE"
EOH
end
execute 'Update firwall rule for port 4848' do
command 'netsh advfirewall firewall add rule name="Open Port 4848 for GlassFish" dir=in action=allow protocol=TCP localport=4848'
action :run
end
execute 'Update firewall rule for port 8080' do
command 'netsh advfirewall firewall add rule name="Open Port 8080 for GlassFish" dir=in action=allow protocol=TCP localport=8080'
action :run
end

View File

@ -6,4 +6,9 @@
batch 'Install_IIS' do
code 'start /w PKGMGR.EXE /quiet /norestart /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-FTPServer;IIS-FTPSvc;IIS-FTPExtensibility;'
end
execute 'Update firewall rule' do
command 'netsh advfirewall firewall add rule name="Open Port 80 for IIS" dir=in action=allow protocol=TCP localport=80'
action :run
end

View File

@ -30,3 +30,8 @@ windows_service 'jenkins' do
action [:enable, :start]
startup_type :automatic
end
execute 'Update firewall rule' do
command 'netsh advfirewall firewall add rule name="Open Port 8484 for Jenkins" dir=in action=allow protocol=TCP localport=8484'
action :run
end

View File

@ -15,3 +15,7 @@ batch 'Install OpenJDK' do
code '"C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip" -oC:\openjdk6"'
end
execute 'Add firewall rule' do
command 'netsh advfirewall firewall add rule name="Java 1.6 java.exe" dir=in action=allow program="C:\openjdk6\openjdk-1.6.0-unofficial-b27-windows-amd64\jre\bin\java.exe" enable=yes'
action :run
end

View File

@ -183,3 +183,7 @@ batch 'Install Rails service' do
EOH
end
execute 'Add firewall rule' do
command 'netsh advfirewall firewall add rule name="Open Port 3000 for Rails Server" dir=in action=allow protocol=TCP localport=3000'
action :run
end

View File

@ -21,3 +21,8 @@ registry_key 'HKLM\SYSTEM\ControlSet001\services\SNMP\Parameters\ValidCommunitie
values [{:name => 'public', :type => :dword, :data => 4}]
action :create
end
execute 'Add firewall rule' do
command 'netsh advfirewall firewall add rule name="Open Port 161 for SNMP" dir=in action=allow protocol=UDP localport=161'
action :run
end

View File

@ -54,3 +54,8 @@ end
batch 'Set attributes' do
code 'attrib -r +s C:\wamp\www\wordpress'
end
execute 'Update firewall rule' do
command 'netsh advfirewall firewall add rule name="Open Port 8585 for Wordpress and phpMyAdmin" dir=in action=allow protocol=TCP localport=8585'
action :run
end