Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

StormConfig converting uppercase keys to lowercase #157

Open
sar009 opened this issue Feb 13, 2018 · 5 comments
Open

StormConfig converting uppercase keys to lowercase #157

sar009 opened this issue Feb 13, 2018 · 5 comments

Comments

@sar009
Copy link

sar009 commented Feb 13, 2018

else:
    # find first whitespace, and split there
    i = 0
    while (i < len(line)) and not line[i].isspace():
        i += 1
    if i == len(line):
        raise Exception('Unparsable line: %r' % line)
    key = line[:i].lower()
    value = line[i:].lstrip()

the key part in above peice of code from ssh_config_parser.StormConfig is converting config keys to lowercase. e.g. keys like RSAAuthentication are becoming rsaauthentication.

@emre
Copy link
Owner

emre commented Aug 7, 2018

Let's see if we remove that behavior without breaking anything.

@terrywang
Copy link

Experienced the same issue on 0.7.0 on both Linux (installed via pip) and macOS (via homebrew).

Lucky that keywords in per-user ssh_config are not case-sensitive (arguments are), it's bad behaviour and should be fixed (also bad for the eyes).

@StephenBrown2
Copy link

I've wondered if storm could keep a reference of all SSH config keys and their canonical capitalization, then fix them on write. Keeping them all lowercase internally makes it easier to lookup/sort/etc. This man page looks to be the latest, most complete listing of config options: https://man.openbsd.org/ssh_config

@StephenBrown2
Copy link

Scraping the page gives this list of config options:

['Host',
 'Match',
 'AddKeysToAgent',
 'AddressFamily',
 'BatchMode',
 'BindAddress',
 'BindInterface',
 'CanonicalDomains',
 'CanonicalizeFallbackLocal',
 'CanonicalizeHostname',
 'CanonicalizeMaxDots',
 'CanonicalizePermittedCNAMEs',
 'CASignatureAlgorithms',
 'CertificateFile',
 'ChallengeResponseAuthentication',
 'CheckHostIP',
 'Ciphers',
 'ClearAllForwardings',
 'Compression',
 'ConnectionAttempts',
 'ConnectTimeout',
 'ControlMaster',
 'ControlPath',
 'ControlPersist',
 'DynamicForward',
 'EnableSSHKeysign',
 'EscapeChar',
 'ExitOnForwardFailure',
 'FingerprintHash',
 'ForwardAgent',
 'ForwardX11',
 'ForwardX11Timeout',
 'ForwardX11Trusted',
 'GatewayPorts',
 'GlobalKnownHostsFile',
 'GSSAPIAuthentication',
 'GSSAPIDelegateCredentials',
 'HashKnownHosts',
 'HostbasedAuthentication',
 'HostbasedKeyTypes',
 'HostKeyAlgorithms',
 'HostKeyAlias',
 'Hostname',
 'IdentitiesOnly',
 'IdentityAgent',
 'IdentityFile',
 'IgnoreUnknown',
 'Include',
 'IPQoS',
 'KbdInteractiveAuthentication',
 'KbdInteractiveDevices',
 'KexAlgorithms',
 'LocalCommand',
 'LocalForward',
 'LogLevel',
 'MACs',
 'NoHostAuthenticationForLocalhost',
 'NumberOfPasswordPrompts',
 'PasswordAuthentication',
 'PermitLocalCommand',
 'Port',
 'PreferredAuthentications',
 'ProxyCommand',
 'ProxyJump',
 'ProxyUseFdpass',
 'PubkeyAcceptedKeyTypes',
 'PubkeyAuthentication',
 'RekeyLimit',
 'RemoteCommand',
 'RemoteForward',
 'RequestTTY',
 'RevokedHostKeys',
 'SecurityKeyProvider',
 'SendEnv',
 'ServerAliveCountMax',
 'ServerAliveInterval',
 'SetEnv',
 'StreamLocalBindMask',
 'StreamLocalBindUnlink',
 'StrictHostKeyChecking',
 'SyslogFacility',
 'TCPKeepAlive',
 'Tunnel',
 'TunnelDevice',
 'UpdateHostKeys',
 'User',
 'UserKnownHostsFile',
 'VerifyHostKeyDNS',
 'VisualHostKey',
 'XAuthLocation']

And to play along at home:

import re
import httpx
from bs4 import BeautifulSoup

ssh_config_man = httpx.get("https://man.openbsd.org/ssh_config")
soup = BeautifulSoup(ssh_config_man.text)
headers = soup.find_all("a", class_="permalink")

config_keys = [c.text for c in headers if re.match(r"[A-Z]+[a-z]+", c.text)]

@StephenBrown2
Copy link

StephenBrown2 commented Mar 24, 2020

Also, a PR similar to this has been open for a long time: #130
I've submitted #174 to implement my fix above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants