paramiko / paramiko/paramiko

SSHConfig.parse messes up when host is different from hostname

Open
#1,708 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs patch ssh_config
Dominant language
Python
Stars
9.9k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

I guess this is a bug.

paramiko.config.SSHConfig.parse messes up if host is different from hostname in the shh config file.

Host host1
  HostName 11.222.333.444
  User username
  IdentityFile C:\Users\xxx\ssh\id_rsa

returns:
{'hostname': '11.222.333.444'}
which is missing some variables

Host 11.222.333.444
  HostName 11.222.333.444
  User username
  IdentityFile C:\Users\xxx\ssh\id_rsa

returns:
{'hostname': '11.222.333.444', 'identityfile': ['C:\Users\xxx\ssh\id_rsa'], 'user': 'username'}
which is the output that i expects

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 paramiko.config.SSHConfig.parse and reproduce the two SSH configuration examples from the issue. Trace why HostName matching causes User and IdentityFile to be omitted, then verify that parsing a different Host and HostName preserves those variables as shown in the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.