Repository navigation
Conversation
OpenSSH added the Tag directive and the "Match tagged" criterion. The parser rejected "tagged" as an unsupported Match keyword, so a single "Match tagged" block anywhere in ~/.ssh/config made every tunnel fail to open. Accept "tagged" and match it against the first Tag set by a preceding matching block, like ssh(1). boring has no equivalent of ssh -P, so without a Tag directive the tag is empty and "Match tagged" never matches, which is also what ssh(1) does when no tag is set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenSSH supports a
Tagdirective and a matchingMatch tagged <pattern>criterion (see
ssh_config(5);ssh -P <tag>sets the tag from the command line).boring's parser rejects
taggedas an unsupported Match keyword:Since parse errors are returned from
ssh_config.ParseSSHConfig, a singleMatch taggedblock anywhere in~/.ssh/config(or an included file) makesevery tunnel fail to open, including tunnels for unrelated hosts. The same
config works fine with
ssh(1).Change
taggedas a Match keyword.matchContext, set by the firstTagdirective in amatching block (first value wins, like
User/HostNamealready are).Match taggedmatches against that tag. boring has no equivalent ofssh -P, so without aTagdirective the tag is empty and, likessh(1)with no tag set,Match taggeddoes not match.No new config options or dependencies; the change is 11 lines in the parser
plus a testdata file.
Tests
New
testdata/match-taggedcases inTestGet:Tag workpicks up theMatch tagged workblockTagline does not override the firstHost *make testpasses exceptTestConfigCreateOpenFails, which fails the sameway on
mainwhen run as root (the read-only directory is still writable).Notes
Match execandMatch canonicalremain unsupported; this PR only coverstagged, which can be evaluated without running commands or DNS lookups.