assh icon indicating copy to clipboard operation
assh copied to clipboard

Use uppercase letters in hostnames

Open muupan opened this issue 6 years ago • 5 comments

When I put an entry with a hostname that contains uppercase letters to .ssh/assh.yml,

hosts:
  SomeHost:
    User: someuser

it always gets lowered in .ssh/config.

Host somehost
  User someuser

Is there any way to set uppercase hostnames in .ssh/config via assh?

I'm using assh 2.7.0 on macOS High Sierra.

muupan avatar Sep 13 '18 06:09 muupan

Hostnames are not case sensitive, RFC-952.

gillisandrew avatar Oct 13 '18 13:10 gillisandrew

At least they seem to be case sensitive to my OpenSSH client.

For example, when I put

Host github
  User git
  HostName github.com

to my ~/.ssh/config, I can ssh github, but cannot ssh Github.

$ ssh github
PTY allocation request failed on channel 0
Hi muupan! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
$ ssh Github
ssh: Could not resolve hostname github: nodename nor servname provided, or not known
$ ssh -V
OpenSSH_7.6p1, LibreSSL 2.6.2

muupan avatar Oct 14 '18 13:10 muupan

What you mean @muupan is the "Host github" entry not the actual Hostname that will be contacted. The "Host" basicly is just a string that dosn't have to do anything with the actual Hostname.

So if "$ ssh github" works, why don't you just use the lowercase host alias ;-)

notimplementedyet avatar Oct 31 '18 15:10 notimplementedyet

So if "$ ssh github" works, why don't you just use the lowercase host alias ;-)

Because it is not me but a program written by others that executes ssh Github.

Is there any reason for assh to prevent users from using uppercase letters in "Host"?

muupan avatar Nov 01 '18 03:11 muupan

Additionally, you can end up in a situation where previously accepted host keys are no longer considered to match. For example, we have a system with hundreds of hosts which have hostnames containing uppercase characters. A script generates an ssh config file containing those host configs, and also sets about accepting the keys once confirmed to match. However, after switching to assh managed config file, "HOSTA" has become "hosta" and any attempts to ssh to hosta are now met with:

The authenticity of host 'hosta ()' can't be established. ECDSA key fingerprint is ____. Are you sure you want to continue connecting (yes/no)?

I don't understand the value in the forced-lowercase behavior. Is there any way to override this?

Cptn727 avatar Apr 30 '20 17:04 Cptn727