Skip to content

Conversation

@adamab48
Copy link
Contributor

Preserve Global SSH Configuration Directives (Include Statements)

Hello @Adembc, this PR fixes an issue where global SSH configuration directives—especially Include statements—were not even loaded when modifying server entries through the application.

Problematic SSH Config

# =====================================================================
# Includes
# =====================================================================
Include terraform.d/*
Include personal.d/*
Include work.d/*
Include ~/.orbstack/ssh/config

The above config was not loaded or preserved when adding, updating, or deleting servers.

Key Changes

  • Preserve implicit host block: Capture and restore the first host block containing global directives when loading and saving SSH config files.
  • Recursive Include processing: Extract hosts from Include directives recursively to handle all included files.
  • Comprehensive tests: Added include_preservation_test.go to ensure Include directives are preserved across all operations.

Technical Details

  • config_io.go: Store and restore the implicit host block during save operations.
  • mapper.go: Recursively process Include directives to extract hosts from included files.
  • Repository struct: Added implicitHost field to maintain global directives.

Testing

All Include directives are now properly loaded and preserved when:

  • Adding new servers
  • Updating existing servers
  • Deleting servers

✅ Users’ SSH config structure now remains intact, and Include statements continue to work as expected.

Thanks for your time !

@adamab48 adamab48 changed the title Fix: Preserve Include directives and global SSH config settings fix: Preserve Include directives and global SSH config settings Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant