107: def translate(settings)
108: settings.inject({}) do |hash, (key, value)|
109: case key
110: when 'ciphers' then
111: hash[:encryption] = value.split(/,/)
112: when 'compression' then
113: hash[:compression] = value
114: when 'compressionlevel' then
115: hash[:compression_level] = value
116: when 'connecttimeout' then
117: hash[:timeout] = value
118: when 'forwardagent' then
119: hash[:forward_agent] = value
120: when 'globalknownhostsfile'
121: hash[:global_known_hosts_file] = value
122: when 'hostbasedauthentication' then
123: if value
124: hash[:auth_methods] ||= []
125: hash[:auth_methods] << "hostbased"
126: end
127: when 'hostkeyalgorithms' then
128: hash[:host_key] = value.split(/,/)
129: when 'hostkeyalias' then
130: hash[:host_key_alias] = value
131: when 'hostname' then
132: hash[:host_name] = value
133: when 'identityfile' then
134: hash[:keys] = value
135: when 'macs' then
136: hash[:hmac] = value.split(/,/)
137: when 'passwordauthentication'
138: if value
139: hash[:auth_methods] ||= []
140: hash[:auth_methods] << "password"
141: end
142: when 'port'
143: hash[:port] = value
144: when 'preferredauthentications'
145: hash[:auth_methods] = value.split(/,/)
146: when 'pubkeyauthentication'
147: if value
148: hash[:auth_methods] ||= []
149: hash[:auth_methods] << "publickey"
150: end
151: when 'rekeylimit'
152: hash[:rekey_limit] = interpret_size(value)
153: when 'user'
154: hash[:user] = value
155: when 'userknownhostsfile'
156: hash[:user_known_hosts_file] = value
157: end
158: hash
159: end
160: end