Class: ProcessWanker::ConfigAuth

Inherits:
ConfigNode show all
Defined in:
lib/config/config_auth.rb

Instance Attribute Summary collapse

Attributes inherited from ConfigNode

#container

Instance Method Summary collapse

Methods inherited from ConfigNode

#find_attributes, #get_auth

Constructor Details

#initializeConfigAuth

Returns a new instance of ConfigAuth.



65
66
67
# File 'lib/config/config_auth.rb', line 65

def initialize()
	init_default()
end

Instance Attribute Details

#accept_ipObject

Returns the value of attribute accept_ip.



62
63
64
# File 'lib/config/config_auth.rb', line 62

def accept_ip
  @accept_ip
end

#accept_peersObject

Returns the value of attribute accept_peers.



59
60
61
# File 'lib/config/config_auth.rb', line 59

def accept_peers
  @accept_peers
end

#ca_certObject

Returns the value of attribute ca_cert.



56
57
58
# File 'lib/config/config_auth.rb', line 56

def ca_cert
  @ca_cert
end

#is_defaultObject

Returns the value of attribute is_default.



61
62
63
# File 'lib/config/config_auth.rb', line 61

def is_default
  @is_default
end

#my_certObject

Returns the value of attribute my_cert.



57
58
59
# File 'lib/config/config_auth.rb', line 57

def my_cert
  @my_cert
end

#my_keyObject

Returns the value of attribute my_key.



58
59
60
# File 'lib/config/config_auth.rb', line 58

def my_key
  @my_key
end

#reject_ipObject

Returns the value of attribute reject_ip.



63
64
65
# File 'lib/config/config_auth.rb', line 63

def reject_ip
  @reject_ip
end

#reject_peersObject

Returns the value of attribute reject_peers.



60
61
62
# File 'lib/config/config_auth.rb', line 60

def reject_peers
  @reject_peers
end

Instance Method Details

#allow_ip(ip) ⇒ Object



76
77
78
79
80
# File 'lib/config/config_auth.rb', line 76

def allow_ip(ip)
	return(false) if(accept_ip && !accept_ip.contains(ip))
	return(false) if(reject_ip && reject_ip.contains(ip))
	true
end

#init_defaultObject



69
70
71
72
73
74
# File 'lib/config/config_auth.rb', line 69

def init_default()
	@is_default=true
	@ca_cert=OpenSSL::X509::Certificate.new(DEFAULT_CA_CERT)
	@my_cert=OpenSSL::X509::Certificate.new(DEFAULT_MY_CERT)
	@my_key=OpenSSL::PKey::RSA.new(DEFAULT_MY_KEY)
end