[Bug 3419] regular expression patterns in Host directive

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Mon Apr 11 10:18:16 AEST 2022


https://bugzilla.mindrot.org/show_bug.cgi?id=3419

Darren Tucker <dtucker at dtucker.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dtucker at dtucker.net

--- Comment #1 from Darren Tucker <dtucker at dtucker.net> ---
(In reply to Christoph Anton Mitterer from comment #0)
[...]
> The above is still a very simple example of course, but with regular
> expressions one could do much more nice things like matching:
> (www\.)?[^.]+\.(intranet|public)\.example\.(com|biz)

You can already do this via Match Exec, eg:

$ cat /tmp/ssh_config
Match Exec "egrep '^[^.]+\.(intranet|public)\.example\.com$' <<<'%h'"
        Hostname matched
Host *
        Hostname notmatched

$ ssh -G -F /tmp/ssh_config foo.public.example.com | awk
'$1=="hostname"'
hostname matched

$ ssh -G -F /tmp/ssh_config somehost | awk '$1=="hostname"'
hostname notmatched

You can use any pattern matching language you have tooling for, not
just regular expressions.

-- 
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.


More information about the openssh-bugs mailing list