storm icon indicating copy to clipboard operation
storm copied to clipboard

No support for "Match" directive

Open plambert opened this issue 10 years ago • 2 comments

An .ssh/config file like this: https://gist.github.com/plambert/9f39b3de68da9133d498

Match originalhost=github.com
  CanonicalizeHostname no

Match host=two_sshd_host user=alt_user
  Port 2222

Results in output like this:

$ storm list
 Listing entries:

   (*) General options: 
      canonicalizehostname: no
      match originalhost: github.com
      match host: two_sshd_host user=alt_user
      port: 2222

This is not correct.

I am a lousy python programmer or I'd try to add the support myself and submit a pull request.

plambert avatar Jan 20 '15 09:01 plambert

I was not aware of the match directive. thanks!

adding support for it may be tricky. keep it on me, I will add it in a couple of weeks.

emre avatar Jan 20 '15 09:01 emre

Thanks, Enre. I think it might make sense to treat the Match and Host directives very similarly--rather than having a 'host' dictionary and adding everything to it, have a 'stanza' dictionary that includes a flag for whether it is a Match or Host stanza.

Then parse the Match parameters and put them into an array value in a key in the stanza, so they can be printed with nice formatting. Then when appending it to the list of entries in the config file, set the 'type' appropriately.

Easier said than done, of course!

Other directives you may or may not be handling are SendEnv (whose values are additions to a list, like the Local/Remote Forward directives), IgnoreUnknown (ideally, this should make the listed directives show in the 'list' output as requiring OpenSSH version X.Y.Z or above, which would require hardcoding a list of directives and minimum versions...), and IdentityFile (also like SendEnv, it can appear multiple times).

I don't have any of those in my configs, so can't test them.

This is REALLY useful, and thank you for your excellent work!

plambert avatar Jan 20 '15 09:01 plambert