All Projects → kevinburke → Ssh_config

kevinburke / Ssh_config

Licence: other
Go parser for ssh_config files

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Ssh config

tinkerun
A new way of Running Tinker. Simplify the Web Artisan's workflow.
Stars: ✭ 266 (+1.53%)
Mutual labels:  ssh
PyFiSync
Python (+ rsync or rclone) based intelligent file sync with automatic backups and file move/delete tracking.
Stars: ✭ 88 (-66.41%)
Mutual labels:  ssh
Weasel Pageant
Deprecated: An ssh-agent compatible helper for interacting with Pageant from processes running on the Windows Subsystem for Linux.
Stars: ✭ 256 (-2.29%)
Mutual labels:  ssh
teamcity-deployer-plugin
Deployer plugin for TeamCity CI server
Stars: ✭ 37 (-85.88%)
Mutual labels:  ssh
rsp
Rapid SSH Proxy
Stars: ✭ 223 (-14.89%)
Mutual labels:  ssh
httpshell
SSH like Shell via http protocol
Stars: ✭ 13 (-95.04%)
Mutual labels:  ssh
ssh-python
Python bindings for libssh C library.
Stars: ✭ 19 (-92.75%)
Mutual labels:  ssh
Sshb0t
A bot for keeping your ssh authorized_keys up to date with user's GitHub keys, **only** use if you enable 2FA & keep your keys updates.
Stars: ✭ 260 (-0.76%)
Mutual labels:  ssh
python3-docker-devenv
Docker Start Guide with Python Development Environment
Stars: ✭ 13 (-95.04%)
Mutual labels:  ssh
gpu-monitor
Script to remotely check GPU servers for free GPUs
Stars: ✭ 85 (-67.56%)
Mutual labels:  ssh
Shodan-RPi
A simple SSH bruteforce script targeting (not necessarily) Raspbian devices.
Stars: ✭ 13 (-95.04%)
Mutual labels:  ssh
re-mote
Re-mote operations using SSH and Re-gent
Stars: ✭ 61 (-76.72%)
Mutual labels:  ssh
omnitty
Omnitty: Multiple-Machine SSH Multiplexer
Stars: ✭ 20 (-92.37%)
Mutual labels:  ssh
golddrive
Windows ssh network drive
Stars: ✭ 30 (-88.55%)
Mutual labels:  ssh
Php Svg
Vector graphics (SVG) library for PHP
Stars: ✭ 256 (-2.29%)
Mutual labels:  parser
gost
GO Simple Tunnel - a simple tunnel written in golang
Stars: ✭ 8,395 (+3104.2%)
Mutual labels:  ssh
rtc-ssh
WebRTC wrapper for SSH connect
Stars: ✭ 95 (-63.74%)
Mutual labels:  ssh
Tomo
A friendly CLI for deploying Rails apps ✨
Stars: ✭ 260 (-0.76%)
Mutual labels:  ssh
Colab Ssh
Connect to Google Colab using SSH
Stars: ✭ 249 (-4.96%)
Mutual labels:  ssh
sshcopy
自动化拷贝ssh密钥程序, 支持并发设置服务器免密
Stars: ✭ 24 (-90.84%)
Mutual labels:  ssh

ssh_config

This is a Go parser for ssh_config files. Importantly, this parser attempts to preserve comments in a given file, so you can manipulate a ssh_config file from a program, if your heart desires.

It's designed to be used with the excellent x/crypto/ssh package, which handles SSH negotiation but isn't very easy to configure.

The ssh_config Get() and GetStrict() functions will attempt to read values from $HOME/.ssh/config and fall back to /etc/ssh/ssh_config. The first argument is the host name to match on, and the second argument is the key you want to retrieve.

port := ssh_config.Get("myhost", "Port")

You can also load a config file and read values from it.

var config = `
Host *.test
  Compression yes
`

cfg, err := ssh_config.Decode(strings.NewReader(config))
fmt.Println(cfg.Get("example.test", "Port"))

Some SSH arguments have default values - for example, the default value for KeyboardAuthentication is "yes". If you call Get(), and no value for the given Host/keyword pair exists in the config, we'll return a default for the keyword if one exists.

Manipulating SSH config files

Here's how you can manipulate an SSH config file, and then write it back to disk.

f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
cfg, _ := ssh_config.Decode(f)
for _, host := range cfg.Hosts {
    fmt.Println("patterns:", host.Patterns)
    for _, node := range host.Nodes {
        // Manipulate the nodes as you see fit, or use a type switch to
        // distinguish between Empty, KV, and Include nodes.
        fmt.Println(node.String())
    }
}

// Print the config to stdout:
fmt.Println(cfg.String())

Spec compliance

Wherever possible we try to implement the specification as documented in the ssh_config manpage. Unimplemented features should be present in the issues list.

Notably, the Match directive is currently unsupported.

Errata

This is the second comment-preserving configuration parser I've written, after an /etc/hosts parser. Eventually, I will write one for every Linux file format.

Donating

Donations free up time to make improvements to the library, and respond to bug reports. You can send donations via Paypal's "Send Money" feature to [email protected]. Donations are not tax deductible in the USA.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].