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