118: def translate(settings)
119: settings.inject({}) do |hash, (key, value)|
120: case key
121: when 'ciphers' then
122: hash[:encryption] = value.split(/,/)
123: when 'compression' then
124: hash[:compression] = value
125: when 'compressionlevel' then
126: hash[:compression_level] = value
127: when 'connecttimeout' then
128: hash[:timeout] = value
129: when 'forwardagent' then
130: hash[:forward_agent] = value
131: when 'globalknownhostsfile'
132: hash[:global_known_hosts_file] = value
133: when 'hostbasedauthentication' then
134: if value
135: hash[:auth_methods] ||= []
136: hash[:auth_methods] << "hostbased"
137: end
138: when 'hostkeyalgorithms' then
139: hash[:host_key] = value.split(/,/)
140: when 'hostkeyalias' then
141: hash[:host_key_alias] = value
142: when 'hostname' then
143: hash[:host_name] = value
144: when 'identityfile' then
145: hash[:keys] = value
146: when 'macs' then
147: hash[:hmac] = value.split(/,/)
148: when 'passwordauthentication'
149: if value
150: hash[:auth_methods] ||= []
151: hash[:auth_methods] << "password"
152: end
153: when 'port'
154: hash[:port] = value
155: when 'preferredauthentications'
156: hash[:auth_methods] = value.split(/,/)
157: when 'proxycommand'
158: if value and !(value =~ /^none$/)
159: require 'net/ssh/proxy/command'
160: hash[:proxy] = Net::SSH::Proxy::Command.new(value)
161: end
162: when 'pubkeyauthentication'
163: if value
164: hash[:auth_methods] ||= []
165: hash[:auth_methods] << "publickey"
166: end
167: when 'rekeylimit'
168: hash[:rekey_limit] = interpret_size(value)
169: when 'user'
170: hash[:user] = value
171: when 'userknownhostsfile'
172: hash[:user_known_hosts_file] = value
173: end
174: hash
175: end
176: end