darkoperator / darkoperator/Posh-SSH

Handling Host Key Change

Open
#614 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

We interact with one of out vendors SFTP servers to run schedule jobs that retrieve files. The problem we are running into is that they will do things that cause the host key to change. We are using the -AcceptKey parameter on New-SFTPSession and that works well on the initial connection to the server. What happens is when they make a change and the server has a new host key the connection fails until I remove the old host entry from hosts,json.

I know that this is probably not the best approach re: security but is there any way to accept the new key and overwrite the old host entry? They never tell us when this happens and it causes critical management reporting to fail.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with New-SFTPSession and its -AcceptKey handling, then trace how host entries are read from and written to hosts.json. Confirm the intended behavior for a changed host key and its security implications; done should provide a clear, tested way to handle the replacement without requiring manual removal.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.