Class: TddDeploy::RemoteIpTables

Inherits:
TestBase show all
Defined in:
lib/tdd_deploy/host_tests/remote_ip_tables.rb

Overview

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

Constant Summary

Constants included from Assertions

Assertions::GROUP_ELT_TAG, Assertions::HEADER_ELT_TAG, Assertions::RESULT_ELT_TAG

Constants included from Environ

Environ::ENV_FNAME

Instance Method Summary collapse

Methods inherited from TestBase

flush_children_methods, inherited, #initialze

Methods inherited from Base

#initialize

Methods included from DeployTestMethods

#deploy_test_file_exists_on_hosts_as, #deploy_test_on_a_host_as, #deploy_test_on_hosts_as, #deploy_test_process_running_on_hosts_as

Methods included from RunMethods

#ping_host, #run_locally, #run_on_a_host_as, #run_on_all_hosts, #run_on_all_hosts_as, #run_on_hosts_as

Methods included from Assertions

#assert, #assert_equal, #assert_match, #assert_nil, #assert_not_nil, #assert_raises, #fail, #failure_count, #failure_messages, #formatted_test_results, #pass, #refute, #refute_equal, #refute_nil, #remove_failed_tests, #reset_tests, #test_count, #test_messages, #test_results, #total_failures, #total_tests

Methods included from CopyMethods

#append_dir_to_remote_hosts_as, #append_file_to_remote_file_as, #append_file_to_remote_hosts_as, #append_string_to_remote_file_as, #append_string_to_remote_file_on_hosts_as, #copy_dir_to_remote_hosts_as, #copy_file_to_remote_as, #copy_file_to_remote_hosts_as, #copy_string_to_remote_file_as, #copy_string_to_remote_file_on_hosts_as, #mkdir_on_remote_as

Methods included from Environ

#capfile, #clear_env, #env_defaults, #env_desc, #env_hash, #env_hash=, #env_types, #hosts, #hosts=, #list_to_str, #migration_hosts, #rationalize_host_list, #read_env, #reset_env, #save_env, #set_env, #str_to_list

Constructor Details

This class inherits a constructor from TddDeploy::Base

Instance Method Details

#tcp_some_blocked_portsObject

tcp_some_blocked_ports - checks TCP ports



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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