bugzilla-daemon at mindrot.org
2020-Mar-30 19:10 UTC
[Bug 3143] New: Add the ability to capture wildcard portion of Host keyword in ssh_config
https://bugzilla.mindrot.org/show_bug.cgi?id=3143
Bug ID: 3143
Summary: Add the ability to capture wildcard portion of Host
keyword in ssh_config
Product: Portable OpenSSH
Version: -current
Hardware: Other
OS: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: ssh
Assignee: unassigned-bugs at mindrot.org
Reporter: lavneetpuri at gmail.com
Use Case:
`ssh pc-1` would connect to remote-cpu-1.domain.com
Currently we can use `%h` token but it captures the whole argument to
Host keyword (i.e pc-1). This feature would enable capturing just the
pc number (ie. 1) by using a new `%m` token for example. It is useful
to simplify connection to complex ssh hostnames
For the above use-case, the ssh config can be specified as follows:
Host pc-*
Hostname remote-cpu-%m.domain.com
--
You are receiving this mail because:
You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2020-Mar-31 01:18 UTC
[Bug 3143] Add the ability to capture wildcard portion of Host keyword in ssh_config
https://bugzilla.mindrot.org/show_bug.cgi?id=3143
Darren Tucker <dtucker at dtucker.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dtucker at dtucker.net
--- Comment #1 from Darren Tucker <dtucker at dtucker.net> ---
There's a couple of problems with this:
- the current matching code doesn't lend itself to supporting this
kind of backreference
- it does however currently support multiple wildcards (eg
"*-*-?.domain.*") which don't map well onto the token you
suggested.
It'd probably need to be regex-style digits %1 - %9.
- "Host" specifically supports multiple matches. You could have, eg,
"Host pc-? *-* *.*.*", at which point you could have 1, 2 or 3
backrefs. In that case, what does "%3" evaluate to and when?
I'm not sure it's useful enough to be worth the extra complexity in the
parser, which is already pretty complex.
--
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at mindrot.org
2020-Apr-01 14:04 UTC
[Bug 3143] Add the ability to capture wildcard portion of Host keyword in ssh_config
https://bugzilla.mindrot.org/show_bug.cgi?id=3143 --- Comment #2 from Lavneet <lavneetpuri at gmail.com> --- I ended up writting a wrapper script to account for this special case - one that is not very neat - so I realize the complexity this may add to the parser. However, in terms of usefulness, ssh configs are among the best features that boost productivity. I wonder if this logic (and more advanced parsing feature to follow) could be offloaded from the main build - as a plugin of sorts. I'm not aware if this has been done before for any other components of the program. -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.