class RhaAuthkeys
RhaAuthkeys
are authentication configurations for heartbeat.
Public Class Methods
new()
click to toggle source
Returns a new RhaConfig
Object
# File lib/rha/authkeys.rb, line 19 def initialize() @num ||= [] end
Public Instance Methods
add_crc(auth_num, method_num)
click to toggle source
Cyclic Redundancy Check hash method. This method does not require a shared secret and is insecure; it’s use is strongly discouraged.
# File lib/rha/authkeys.rb, line 63 def add_crc(auth_num, method_num) begin num_index = @num.index("auth #{auth_num}") @num.insert(num_index + 1, method_num.to_s + " crc " + "\n") rescue puts "no such auth num #{auth_num}" return false end end
add_md5(auth_num, method_num, secret)
click to toggle source
MD5 hash method. This method requires a shared secret.
# File lib/rha/authkeys.rb, line 36 def add_md5(auth_num, method_num, secret) begin num_index = @num.index("auth #{auth_num}") @num.insert(num_index + 1, method_num.to_s + " md5 " + secret.to_s + "\n") rescue puts "no such auth num #{auth_num}" return false end end
add_sha1(auth_num, method_num, secret)
click to toggle source
SHA-1 hash method. This method requires a shared secret.
# File lib/rha/authkeys.rb, line 49 def add_sha1(auth_num, method_num, secret) begin num_index = @num.index("auth #{auth_num}") @num.insert(num_index + 1, method_num.to_s + " sha1 " + secret.to_s + "\n") rescue puts "no such auth num #{auth_num}" return false end end
auth(value)
click to toggle source
auth num selects the currently active authentication method and secret.
num is a numerical identifier, between 1 and 15 inclusive. It must be unique within the file.
# File lib/rha/authkeys.rb, line 29 def auth(value) @num.push("auth #{value}") end
config()
click to toggle source
Return the RhaAuthkeys
configuration
# File lib/rha/authkeys.rb, line 76 def config return @num end