class TddDeploy::RemoteIpTables
TddDeploy::RemoteIpTables
¶ ↑
checks to see if iptables is working by attempting to connect to each host on a collection of 'interesting' ports. the ports probed are: 20, 23, 25, 53, 5432, 2812
Public Instance Methods
tcp_some_blocked_ports()
click to toggle source
tcp_some_blocked_ports
- checks TCP ports
# File lib/tdd_deploy/host_tests/remote_ip_tables.rb, line 11 def tcp_some_blocked_ports @port_to_check ||= [20, 23, 25, 53, 5432, 2812] self.hosts.each do |host| result = true # Linode seems to refuse to block 21 - FTP control # [20, 21, 23, 25, 53, 5432, 2812].each do |port| if self.ping_host(host) @port_to_check.each do |port| tcp_socket = TCPSocket.new(host, port) rescue 'failed' unless tcp_socket == 'failed' result &= fail host, "Host: #{host}: iptables test: Should not be able to connect via tcp to port #{port}" end end pass host, "tcp ports #{@port_to_check.join(',')} blocked" else fail host, "Host: #{host}: iptables cannot be tested - host does not respond to ping" end end end