3 Parses ssh client configuration
5 Author: Jiri Suchomel <jsuchome@suse.cz>
11 This file is licensed under the GPL.
14 Sample usage of this lens in augtool
16 augtool> set /files/etc/ssh/ssh_config/Host example.com
17 augtool> set /files/etc/ssh/ssh_config/Host[.='example.com']/RemoteForward/machine1:1234 machine2:5678
18 augtool> set /files/etc/ssh/ssh_config/Host[.='example.com']/Ciphers/1 aes128-ctr
19 augtool> set /files/etc/ssh/ssh_config/Host[.='example.com']/Ciphers/2 aes192-ctr
26 let eol = del /[ \t]*\n/ "\n"
27 let spc = Util.del_ws_spc
29 let key_re = /[A-Za-z0-9]+/
30 - /SendEnv|Host|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers/
32 let comment = Util.comment
33 let empty = Util.empty
34 let comma = Util.del_str ","
35 let indent = Util.indent
36 let value_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
37 let value_to_spc = store /[^ \t\n]+/
38 let value_to_comma = store /[^, \t\n]+/
40 let array_entry (k:string) =
41 [ indent . key k . counter k . [ spc . seq k . value_to_spc]* . eol ]
43 let commas_entry (k:string) =
44 [ key k . counter k . spc .
45 [ seq k . value_to_comma] . ([ seq k . comma . value_to_comma])* . eol ]
47 let send_env = array_entry "SendEnv"
49 let proxy_command = [ indent . key "ProxyCommand" . spc . value_to_eol . eol ]
51 let fw_entry (k:string) = [ indent . key k . spc .
52 [ key /[^ \t\n\/]+/ . spc . value_to_eol . eol ]]
54 let remote_fw = fw_entry "RemoteForward"
55 let local_fw = fw_entry "LocalForward"
57 let ciphers = commas_entry "Ciphers"
58 let macs = commas_entry "MACs"
61 [ indent . key key_re . spc . value_to_spc . eol ]
63 let entry = (comment | empty
72 let host = [ key "Host" . spc . value_to_eol . eol . entry* ]
74 let lns = entry* . host*
76 let xfm = transform lns (incl "/etc/ssh/ssh_config" .