[PATCH] Allow matching HostName against Host entries
Ryan Kavanagh
rak at debian.org
Fri May 3 13:07:37 EST 2013
Sorry, a typo crept in to the final diff while I was revising it,
On Thu, May 02, 2013 at 10:32:15PM -0400, Ryan Kavanagh wrote:
> --- usr.bin/ssh/ssh_config.5 8 Jan 2013 18:49:04 -0000 1.161
> +++ usr.bin/ssh/ssh_config.5 3 May 2013 02:27:39 -0000
> @@ -1,4 +1,4 @@
> -.\"
> +\"
> .\" Author: Tatu Ylonen <ylo at cs.hut.fi>
Here ^^
The updated ssh_config.5 patch is inlined below. A complete patch can be
retrieved from http://athena.caslab.queensu.ca/~ryan/ssh_expandhost.diff
Best wishes,
Ryan
--
|_)|_/ Ryan Kavanagh | Debian Developer
| \| \ http://ryanak.ca/ | GPG Key 4A11C97A
Index: usr.bin/ssh/ssh_config.5
===================================================================
RCS file: /cvs/src/usr.bin/ssh/ssh_config.5,v
retrieving revision 1.161
diff -u -r1.161 ssh_config.5
--- usr.bin/ssh/ssh_config.5 8 Jan 2013 18:49:04 -0000 1.161
+++ usr.bin/ssh/ssh_config.5 3 May 2013 03:02:50 -0000
@@ -65,7 +65,10 @@
.Dq Host
specifications, and that section is only applied for hosts that
match one of the patterns given in the specification.
-The matched host name is the one given on the command line.
+The matched host name is the one given on the command line,
+and additionally the value of the
+.Dq ExpandHost
+configuration option once set.
.Pp
Since the first obtained value for each parameter is used, more
host-specific declarations should be given near the beginning of the
@@ -111,6 +114,9 @@
.Ar hostname
argument given on the command line (i.e. the name is not converted to
a canonicalized host name before matching).
+If the
+.Cm ExpandHost
+option has been set, its value is also matched against the patterns.
.Pp
A pattern entry may be negated by prefixing it with an exclamation mark
.Pq Sq !\& .
@@ -434,6 +440,13 @@
.Dq no .
The default is
.Dq no .
+.It Cm ExpandHost
+Specifies an additional string to match against any subsequent
+.Cm Host
+stanza's patterns.
+If the specification contains the character sequence
+.Ql %h ,
+then this will be replaced with the host name specified on the command line.
.It Cm ForwardAgent
Specifies whether the connection to the authentication agent (if any)
will be forwarded to the remote machine.
@@ -593,6 +606,11 @@
.Ql %h ,
then this will be replaced with the host name specified on the command line
(this is useful for manipulating unqualified names).
+If it contains the character sequence
+.Ql %e ,
+then this will be replaced with the value of the
+.Cm ExpandHost
+specification, which must have been set.
The default is the name given on the command line.
Numeric IP addresses are also permitted (both on the command line and in
.Cm HostName
More information about the openssh-unix-dev
mailing list