[PR #65] [CLOSED] Add support for syncing known_hosts file #76

Closed
opened 2026-02-28 01:17:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/therealpaulgg/ssh-sync/pull/65
Author: @Copilot
Created: 5/23/2025
Status: Closed

Base: mainHead: copilot/fix-53


📝 Commits (5)

  • 2278ac0 Initial plan for issue
  • 47686c9 Implement known_hosts file syncing
  • ebffde7 Add unit tests for known_hosts syncing functionality
  • 53eb2da Update README with GPG signing instructions and package repository setup
  • 752be9b Revert GPG signing instructions in README that were meant for a different PR

📊 Changes

9 files changed (+238 additions, -11 deletions)

View changed files

📝 README.md (+6 -2)
📝 pkg/actions/download.go (+7 -1)
pkg/actions/knownhosts_test.go (+45 -0)
📝 pkg/actions/upload.go (+23 -0)
📝 pkg/dto/main.go (+6 -5)
📝 pkg/retrieval/data.go (+9 -0)
📝 pkg/retrieval/data_test.go (+37 -3)
📝 pkg/utils/write.go (+46 -0)
pkg/utils/write_test.go (+59 -0)

📄 Description

This PR implements the ability to sync the known_hosts file across different machines, ensuring consistent SSH host verification across systems.

Changes Made

  • Added KnownHosts field to DataDto structure to store the known_hosts file data
  • Enhanced upload functionality to read and encrypt the known_hosts file
  • Updated download process to write the known_hosts file to the user's .ssh directory
  • Added conflict resolution for known_hosts similar to existing SSH key handling
  • Created a dedicated WriteKnownHosts function with appropriate file permissions (0644)
  • Updated README to document the known_hosts syncing feature

With these changes, users will automatically have their trusted SSH hosts synchronized across machines, eliminating the need to verify host fingerprints on each device separately.

The implementation follows the existing pattern of encrypting sensitive data with the master key for secure transmission.

Fixes #53.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/therealpaulgg/ssh-sync/pull/65 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 5/23/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/fix-53` --- ### 📝 Commits (5) - [`2278ac0`](https://github.com/therealpaulgg/ssh-sync/commit/2278ac0e87f05692dd42bb1d74e559b563b33109) Initial plan for issue - [`47686c9`](https://github.com/therealpaulgg/ssh-sync/commit/47686c995b18cdc078a9aa503252435e4b415a2e) Implement known_hosts file syncing - [`ebffde7`](https://github.com/therealpaulgg/ssh-sync/commit/ebffde7bcd8b7d3b1c14e7fdc84649dc0987aa5f) Add unit tests for known_hosts syncing functionality - [`53eb2da`](https://github.com/therealpaulgg/ssh-sync/commit/53eb2da199281d5ce14ad5f090d5f2bae838557e) Update README with GPG signing instructions and package repository setup - [`752be9b`](https://github.com/therealpaulgg/ssh-sync/commit/752be9bd1772509064b73a77cd3eb087e3cac9c5) Revert GPG signing instructions in README that were meant for a different PR ### 📊 Changes **9 files changed** (+238 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+6 -2) 📝 `pkg/actions/download.go` (+7 -1) ➕ `pkg/actions/knownhosts_test.go` (+45 -0) 📝 `pkg/actions/upload.go` (+23 -0) 📝 `pkg/dto/main.go` (+6 -5) 📝 `pkg/retrieval/data.go` (+9 -0) 📝 `pkg/retrieval/data_test.go` (+37 -3) 📝 `pkg/utils/write.go` (+46 -0) ➕ `pkg/utils/write_test.go` (+59 -0) </details> ### 📄 Description This PR implements the ability to sync the known_hosts file across different machines, ensuring consistent SSH host verification across systems. ## Changes Made - Added `KnownHosts` field to `DataDto` structure to store the known_hosts file data - Enhanced upload functionality to read and encrypt the known_hosts file - Updated download process to write the known_hosts file to the user's .ssh directory - Added conflict resolution for known_hosts similar to existing SSH key handling - Created a dedicated `WriteKnownHosts` function with appropriate file permissions (0644) - Updated README to document the known_hosts syncing feature With these changes, users will automatically have their trusted SSH hosts synchronized across machines, eliminating the need to verify host fingerprints on each device separately. The implementation follows the existing pattern of encrypting sensitive data with the master key for secure transmission. Fixes #53. > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `cdn.fwupd.org` > - Triggering command: `/usr/bin/fwupdmgr refresh ` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to my [firewall allow list](https://gh.io/copilot/firewall-config) > > </details> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 01:17:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ssh-sync#76
No description provided.