Skip to content

Support various Option syntax and additional SSH config options in parser #42

Description

@inureyes

Currently, bssh's SSH config parser only supports space-separated syntax (Option Value) and not the equals-sign syntax (Option=Value) that OpenSSH also supports. This causes parse failures for valid SSH configs.

Current Behavior

  • Parser only handles: HostKeyAlgorithms +ssh-rsa
  • Parser fails on: HostKeyAlgorithms=+ssh-rsa
  • Unknown option warnings for: UseKeychain, PubkeyAcceptedKeyTypes, IdentitiesOnly=yes

Expected Behavior

  • Support both Option Value and Option=Value syntax
  • Add support for commonly used but missing options

Issues Found

1. Syntax Limitation

  • Current parser splits on whitespace only (parser.rs:40-46)
  • OpenSSH supports both formats
  • Real user configs fail to parse

2. Missing Options (high priority)

  • PubkeyAcceptedAlgorithms (modern name for PubkeyAcceptedKeyTypes)
  • UseKeychain (macOS-specific but widely used)
  • IgnoreUnknown (important for cross-platform configs)
  • AddKeysToAgent
  • IdentityAgent

3. Coverage

  • bssh: 42/103 options (~41%)
  • Missing 61 OpenSSH options

Proposed Solution

1. Update parser to handle both syntaxes

// Support both:
// IdentitiesOnly yes
// IdentitiesOnly=yes

2. Add support for priority options

  • PubkeyAcceptedAlgorithms
  • AddKeysToAgent
  • IgnoreUnknown
  • UseKeychain (with macOS detection)
  • IdentityAgent

3. Consider adding Match directive support

For advanced configs with conditional logic

Files to Modify

  • src/ssh/ssh_config/parser.rs - Add equals-sign parsing
  • src/ssh/ssh_config/types.rs - Add new option fields
  • src/ssh/ssh_config/resolver.rs - Handle new options

References

Priority

Medium-High (affects real-world SSH config compatibility)

Metadata

Metadata

Assignees

Type

No fields configured for Story.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions