Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language ssh-config #3450

Closed
GabLeRoux opened this issue Feb 1, 2017 · 6 comments
Closed

Language ssh-config #3450

GabLeRoux opened this issue Feb 1, 2017 · 6 comments
Labels
Add Language Good First Issue This is a great opportunity to start contributing to Linguist

Comments

@GabLeRoux
Copy link

GabLeRoux commented Feb 1, 2017

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 👍

@tattali
Copy link

tattali commented Jan 1, 2018

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

@lildude lildude added the Good First Issue This is a great opportunity to start contributing to Linguist label Jan 25, 2018
@atakanyenel
Copy link
Contributor

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 ?

@GabLeRoux
Copy link
Author

GabLeRoux commented Feb 19, 2019

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

Alhadis added a commit to Alhadis/language-etc that referenced this issue Feb 19, 2019
@Alhadis
Copy link
Collaborator

Alhadis commented Feb 19, 2019

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! 😉

@Alhadis
Copy link
Collaborator

Alhadis commented May 10, 2019

#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.

@Alhadis Alhadis closed this as completed May 10, 2019
@coolaj86
Copy link

coolaj86 commented Dec 17, 2019

Backtick Shorthand

What's the backtick shorthand for this?

Will this work?

```ssh-config
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Add Language Good First Issue This is a great opportunity to start contributing to Linguist
Projects
None yet
Development

No branches or pull requests

7 participants