Linguist: Language ssh-config

Created on 1 Feb 2017  路  6Comments  路  Source: github/linguist

Hi, I'm using ssh-config files (usually found in ~/.ssh/config) I'd be happy to see syntax highlighting available on github for this. I did not take the time to see how this could be done yet. Sometimes I share ssh configs in wikis.

https://github.com/github/linguist/blob/master/CONTRIBUTING.md#adding-a-language

There's a grammar available here:
https://github.com/lalyos/ssh-config/blob/master/grammars/ssh-config.cson

That would be awesome :)
Or let me know if it's already available and I did not see it :+1:

Add Language Good First Issue

Most helpful comment

Backtick Shorthand

What's the backtick shorthand for this?

Will this work?

~~~

Host my-nickname
  Hostname my-nickname.example.com
  User me

~~~

Testing...

Hmm... let's see

sshconfig:

Host my-nickname
  Hostname my-nickname.example.com
  User me

ssh-config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

ssh_config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

sshdconfig:

Host my-nickname
  Hostname my-nickname.example.com
  User me

sshd-config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

sshd_config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

Result

Looks like ssh-config is the winner.

All 6 comments

Hi, i see you are using a lot textmate highlights

so here is a good grammar with correct licence

https://github.com/textmate/ssh-config.tmbundle

Thanks

I want to work on this issue , as a Good First Contributor, @GabLeRoux can you give link to any of your repos where you have a sshconfig committed , for testing ?

I don't have a repo, but here's an example of what I have locally in ~/.ssh/config:

# quick handy copy paste
#PreferredAuthentications=password
#PubkeyAuthentication=no

# proxycommand with SOCKS5: https://www.cyberciti.biz/faq/linux-unix-ssh-proxycommand-passing-through-one-host-gateway-server/
# proxycommand: https://starkandwayne.com/blog/setting-up-an-ssh-tunnel-with-ssh-config/
# proxyjump: https://www.madboa.com/blog/2017/11/02/ssh-proxyjump/
# proxyjump: https://wiki.gentoo.org/wiki/SSH_jump_host

# bitbucket
Host bitbucket bitbucket.org
Hostname bitbucket.org
User git
IdentityFile ~/.ssh/bitbucket_rsa
IdentitiesOnly yes

# github
Host github github.com gist.github.com
Hostname github.com
User git
IdentityFile ~/.ssh/github_rsa
IdentitiesOnly yes

# gitlab
Host gitlab.com
Hostname gitlab.com
User git
IdentityFile ~/.ssh/gitlab_rsa
IdentitiesOnly yes

# local test gitlab
Host gitlab.local
Hostname gitlab.local
User git
Port 2222
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes

# Router
Host 192.168.1.1 tomato
#Hostname tomato
Hostname 192.168.1.1
IdentityFile ~/.ssh/tomato_rsa
IdentitiesOnly yes
User root
KexAlgorithms +diffie-hellman-group1-sha1

# Some password only server example
Host 192.168.0.100 example
Hostname 192.168.0.100
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
User root
PreferredAuthentications=password
PubkeyAuthentication=no

# Example server
Host client-roomserver01
Hostname 255.255.255.255
User root
Port 22
IdentitiesOnly no
PreferredAuthentications=password
#ProxyCommand ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no client-proxy-server nc %h %p %r -e
#ProxyCommand ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no client-proxy-server nc %h %p
ProxyJump client-proxy-server

# Some vagrant box
Host client-vagrant
  HostName 127.0.0.1
  User vagrant
  Port 2200
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/gableroux/somewhere/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

# Example ProxyCommand
Host client-roomserver02
Hostname 255.255.255.255
User root
Port 22
IdentitiesOnly no
PreferredAuthentications=password
ProxyCommand ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no client-proxy-server nc %h %p %r -e
ProxyCommand ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no client-proxy-server nc %h %p
#ProxyJump client-proxy-server

edit: updated to use ssh-config backtick shorthand

Here you go mate. I smashed together an SSH config you can use. The grammar repository is already added to Linguist (vendor/grammars/language-etc), so you'll simply need to update the submodule locally. 馃憤

@atakanyenel Go for it! 馃槈

4429 has been merged, so we can now close this issue.

You guys will start seeing highlighted SSH-configs on GitHub.com once the next release of Linguist has been cut.

Backtick Shorthand

What's the backtick shorthand for this?

Will this work?

~~~

Host my-nickname
  Hostname my-nickname.example.com
  User me

~~~

Testing...

Hmm... let's see

sshconfig:

Host my-nickname
  Hostname my-nickname.example.com
  User me

ssh-config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

ssh_config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

sshdconfig:

Host my-nickname
  Hostname my-nickname.example.com
  User me

sshd-config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

sshd_config:

Host my-nickname
  Hostname my-nickname.example.com
  User me

Result

Looks like ssh-config is the winner.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arfon picture arfon  路  6Comments

d4nyll picture d4nyll  路  3Comments

oliviertassinari picture oliviertassinari  路  5Comments

philiparvidsson picture philiparvidsson  路  4Comments

lucasrodes picture lucasrodes  路  6Comments