PageRenderTime 27ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/README.md

https://gitlab.com/CORP-RESELLER/advanced-ssh-config
Markdown | 812 lines | 596 code | 216 blank | 0 comment | 0 complexity | a72e24d230228e8d96718fc5e2bd0c3f MD5 | raw file
  1. # assh - *Advanced SSH config*
  2. [![Travis](https://img.shields.io/travis/moul/advanced-ssh-config.svg)](https://travis-ci.org/moul/advanced-ssh-config)
  3. [![GoDoc](https://godoc.org/github.com/moul/advanced-ssh-config?status.svg)](https://godoc.org/github.com/moul/advanced-ssh-config)
  4. ![License](https://img.shields.io/github/license/moul/advanced-ssh-config.svg)
  5. [![GitHub release](https://img.shields.io/github/release/moul/advanced-ssh-config.svg)](https://github.com/moul/advanced-ssh-config/releases)
  6. <img src="https://raw.githubusercontent.com/moul/advanced-ssh-config/master/resources/assh.png" width="400" />
  7. #### Table of Contents
  8. 1. [Overview](#overview)
  9. 2. [Features](#features)
  10. * [Configuration features](#configuration-features)
  11. * [Using Gateway from command line](#using-gateway-from-command-line)
  12. * [Using Gateway from configuration file](#using-gateways-from-configuration-file)
  13. * [Under the hood features](#under-the-hood-features)
  14. * [Hooks](#hooks)
  15. 3. [Configuration](#configuration)
  16. 4. [Usage](#usage)
  17. * [Usage Examples](#usage-examples)
  18. 5. [Install](#install)
  19. * [Register the wrapper (optional)](#register-the-wrapper-optional)
  20. 6. [Getting started](#getting-started)
  21. 7. [Changelog](#changelog)
  22. 8. [Alternative version](#alternative-version)
  23. 9. [Troobleshooting](#troubleshooting)
  24. 10. [License](#license)
  25. ## Overview
  26. A *transparent wrapper* that adds **regex**, **aliases**, **gateways**, **includes**, **dynamic hostnames** to **SSH**.
  27. **Advanced SSH config** is wrapped in [lib-ssh](https://www.libssh.org) as a [ProxyCommand](https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts#ProxyCommand_with_Netcat), it means that it works seamlessly with:
  28. * [ssh](http://www.openbsd.org/cgi-bin/man.cgi?query=ssh&sektion=1)
  29. * [scp](http://www.openbsd.org/cgi-bin/man.cgi?query=scp&sektion=1)
  30. * [rsync](http://linuxcommand.org/man_pages/rsync1.html)
  31. * [git](https://www.kernel.org/pub/software/scm/git/docs/)
  32. * Desktop applications depending on `lib-ssh` or `ssh` (i.e: [Tower](http://www.git-tower.com), [Atom.io](https://atom.io), [SSH Tunnel Manager](http://projects.tynsoe.org/fr/stm/))
  33. ## Features
  34. ### Configuration features
  35. * **regex** support
  36. * **aliases** `gate` -> `gate.domain.tld`
  37. * **gateways** -> transparent ssh connection chaining
  38. * **includes**: split configuration in multiple files
  39. * **local command execution**: finally the reverse of **RemoteCommand**
  40. * **templates**: equivalent to host but you can't connect directly to a template, perfect for inheritance
  41. * **inheritance**: make hosts inherits from host hosts or templates
  42. * **variable expansion**: resolve variables from environment
  43. * **smart proxycommand**: RAW tcp connection when possible with `netcat` and `socat` as default fallbacks
  44. ### Using Gateway from command line
  45. *assh* can use the [ProxyCommand with netcat](https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts#ProxyCommand_with_Netcat) feature of OpenSSH **transparently** and without the pain of using long configuration.
  46. Connect to `hosta` using `hostb` as gateway.
  47. ```
  48. ┌─────┐
  49. │ YOU │─ ─ ─ ─ ─
  50. └─────┘ │
  51. ┃ ▽
  52. ┃ ┌─────┐
  53. firewall │hostb│
  54. ┃ └─────┘
  55. ▼ │
  56. ┌─────┐
  57. │hosta│◁─ ─ ─ ─ ┘
  58. └─────┘
  59. ```
  60. ```console
  61. $ ssh hosta/hostb
  62. user@hosta $
  63. ```
  64. Equivalent to `ssh -o ProxyCommand="ssh hostb nc %h %p" hosta`
  65. ---
  66. Connect to `hosta` using `hostb` as a gateway using `hostc` as a gateway.
  67. ```
  68. ┌─────┐ ┌─────┐
  69. │ YOU │─ ─ ─ ─ ─ ─ ─▷│hostc│
  70. └─────┘ └─────┘
  71. ┃ │
  72. firewall │
  73. ┃ │
  74. ▼ ▽
  75. ┌─────┐ ┌─────┐
  76. │hosta│◁─ ─ ─ ─ ─ ─ ─│hostb│
  77. └─────┘ └─────┘
  78. ```
  79. ```console
  80. $ ssh hosta/hostb/hostc
  81. user@hosta $
  82. ```
  83. Equivalent to `ssh -o ProxyCommand="ssh -o ProxyCommand='ssh hostc nc %h %p' hostb nc %h %p" hosta`
  84. ### Using Gateways from configuration file
  85. You can define an equivalent of the ["ProxyCommand with netcat"](https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts#ProxyCommand_with_Netcat) feature of OpenSSH, with a simpler syntax, more advanced workflows and a unique fallback feature.
  86. Let's consider the following `assh.yml` file
  87. ```yaml
  88. hosts:
  89. hosta:
  90. Hostname: 1.2.3.4
  91. hostb:
  92. Hostname: 5.6.7.8
  93. Gateways:
  94. - hosta
  95. hostc:
  96. Hostname: 9.10.11.12
  97. Gateways:
  98. - hostb
  99. hostd:
  100. Hostname: 13.14.15.16
  101. Gateways:
  102. - direct
  103. - hosta
  104. ```
  105. * `ssh hosta` -> `ssh 1.2.3.4`
  106. * `ssh hostb` -> `ssh -o ProxyCommand="ssh hostb nc %h %p" hosta`
  107. * `ssh hostc` -> `ssh -o ProxyCommand="ssh -o ProxyCommand='ssh hostc nc %h %p' hostb nc %h %p" hosta`
  108. * `ssh hostd` ->
  109. * assh will try to `ssh 13.14.15.16`
  110. * then, fallback on `ssh -o ProxyCommand="ssh hostd nc %h %p" hosta`
  111. * this method allows you to have the best performances when it is possible, but ensure your commands will work if you are outside of your company for instance
  112. ### Under the hood features
  113. * Automatically regenerates `~/.ssh/config` file when needed
  114. * Inspect parent process to determine log level (if you use `ssh -vv`, **assh** will automatically be ran in debug mode)
  115. * Automatically creates `ControlPath` directories so you can use *slashes* in your `ControlPath` option, can be disabled with the `NoControlMasterMkdir: true` configuration in host or globally.
  116. ### Hooks
  117. #### Events
  118. ##### OnConnect
  119. `OnConnect` is called as soon as assh is connected to the remote SSH port.
  120. Note: `OnConnect` is not aware of the authentication process and will always be raised.
  121. ---
  122. Example of Golang template variables:
  123. ```golang
  124. // Host: http://godoc.org/github.com/moul/advanced-ssh-config/pkg/config/#Host
  125. {{.Host.Name}} // localhost
  126. {{.Host.HostName}} // 127.0.0.1
  127. {{.Host.Port}} // 22
  128. {{.Host.User}} // moul
  129. {{.Host.Prototype}} // moul@127.0.0.1:22
  130. {{.Host}} // {"HostName":"localhost","Port":22","User":"moul","ControlPerist":"yes",...}
  131. {{printf "%s:%s" .Host.HostName .Host.Port}} // localhost:22
  132. // Stats: http://godoc.org/github.com/moul/advanced-ssh-config/pkg/commands/#ConnectionStats
  133. {{.Stats.ConnectedAt}} // 2016-07-20 11:19:23.467900594 +0200 CEST
  134. ```
  135. ##### OnDisconnect
  136. `OnDisconnect` is called as the assh socket is closed.
  137. ---
  138. Example of Golang template variables:
  139. ```golang
  140. // Host: http://godoc.org/github.com/moul/advanced-ssh-config/pkg/config/#Host
  141. {{.Host.Name}} // localhost
  142. {{.Host.HostName}} // 127.0.0.1
  143. {{.Host.Port}} // 22
  144. {{.Host.User}} // moul
  145. {{.Host.Prototype}} // moul@127.0.0.1:22
  146. {{.Host}} // {"HostName":"localhost","Port":22","User":"moul","ControlPersist":"yes",...}
  147. {{printf "%s:%s" .Host.HostName .Host.Port}} // localhost:22
  148. // Stats: http://godoc.org/github.com/moul/advanced-ssh-config/pkg/commands/#ConnectionStats
  149. {{.Stats.ConnectedAt}} // 2016-07-20 11:19:23.467900594 +0200 CEST
  150. {{.Stats.WrittenBytes}} // 3613
  151. {{.Stats.DisconnectAt}} // 2016-07-20 11:19:29,520515792 +0200 CEST
  152. {{.Stats.ConnectionDuration}} // 6.052615198s
  153. {{.Stats.AverageSpeed}} // 596.933bps
  154. ```
  155. #### Hooks drivers
  156. ##### Exec driver
  157. Exec driver uses [Golang's template system](https://golang.org/pkg/text/template/) to execute a shell command
  158. Usage: `exec <binary> [args...]`
  159. ```yaml
  160. defaults:
  161. Hooks:
  162. OnConnect:
  163. - exec echo '{{.Host}}' | jq .
  164. # executes: `echo '{"HostName":"localhost","Port":"22","User":"moul","ControlPersist":"yes",...}' | jq .
  165. # which results in printing a pretty JSON of the host
  166. # {
  167. # "HostName": "localhost",
  168. # "Port": "22",
  169. # "User": "moul",
  170. # "ControlPersist": "yes",
  171. # ...
  172. # }
  173. ```
  174. ```yaml
  175. defaults:
  176. Hooks:
  177. OnConnect:
  178. - exec echo 'New SSH connection to {{.Host.Prototype}}.' | mail -s "SSH connection journal" m+assh@42.am
  179. # send an email with the connection prototype
  180. ```
  181. ---
  182. The `exec` commands are blocking, a new driver for background tasks is planned. For now, you can run a job in background like this:
  183. ```yaml
  184. defaults:
  185. Hooks:
  186. OnConnect:
  187. - exec sleep 60 &
  188. # execute the `sleep 60` command in background (non-blocking)
  189. # if you quit your ssh connection, the process will continue in background.
  190. ```
  191. ##### Write driver
  192. Write driver uses [Golang's template system](https://golang.org/pkg/text/template/) to write out data to stdout
  193. Usage: `write <line:string...>`
  194. ```yaml
  195. defaults:
  196. Hooks:
  197. OnConnect:
  198. - write New SSH connection to {{.Host.Prototype}}.
  199. # writes: "New SSH connection to moul@127.0.0.1:22." on the terminal on connection
  200. ```
  201. ```yaml
  202. defaults:
  203. Hooks:
  204. OnDisconnect:
  205. - "write SSH connection to {{.Host.Name}} closed, {{ .Stats.WrittenBytes }} bytes written in {{ .Stats.ConnectionDuration }} ({{ .Stats.AverageSpeed }})"
  206. # writes: SSH connection to localhost closed, 40 bytes written.
  207. ```
  208. ##### Notify driver
  209. Notify driver uses [Golang's template system](https://golang.org/pkg/text/template/) to open Desktop notifications.
  210. Note: OS X only for now.
  211. Usage: `notify <line:string...>`
  212. ```yaml
  213. defaults:
  214. Hooks:
  215. OnConnect:
  216. - notify New SSH connection to {{.Host.Prototype}}.
  217. ```
  218. ```yaml
  219. defaults:
  220. Hooks:
  221. OnDisconnect:
  222. - "notify SSH connection to {{.Host.Name}} closed, {{ .Stats.WrittenBytes }} bytes written in {{ .Stats.ConnectionDuration }} ({{ .Stats.AverageSpeed }})"
  223. ```
  224. ## Configuration
  225. The `~/.ssh/config` file is now managed by `assh`, take care to keep a backup your `~/.ssh/config` file.
  226. `~/.ssh/assh.yml` is a [YAML](http://www.yaml.org/spec/1.2/spec.html) file containing:
  227. * an `hosts` dictionary containing multiple *HOST* definitions
  228. * a `defaults` section containing global flags
  229. * and an `includes` section containing path to other configuration files
  230. ```yaml
  231. hosts:
  232. homer:
  233. # ssh homer -> ssh 1.2.3.4 -p 2222 -u robert
  234. Hostname: 1.2.3.4
  235. User: robert
  236. Port: 2222
  237. bart:
  238. # ssh bart -> ssh 5.6.7.8 -u bart <- direct access
  239. # or ssh 5.6.7.8/homer -u bart <- using homer as a gateway
  240. Hostname: 5.6.7.8
  241. User: bart
  242. Gateways:
  243. - direct # tries a direct access first
  244. - homer # fallback on homer gateway
  245. maggie:
  246. # ssh maggie -> ssh 5.6.7.8 -u maggie <- direct access
  247. # or ssh 5.6.7.8/homer -u maggie <- using homer as a gateway
  248. User: maggie
  249. Inherits:
  250. - bart # inherits rules from "bart"
  251. bart-access:
  252. # ssh bart-access -> ssh home.simpson.springfield.us -u bart
  253. Inherits:
  254. - bart-template
  255. - simpson-template
  256. lisa-access:
  257. # ssh lisa-access -> ssh home.simpson.springfield.us -u lisa
  258. Inherits:
  259. - lisa-template
  260. - simpson-template
  261. marvin:
  262. # ssh marvin -> ssh marvin -p 23
  263. # ssh sad-robot -> ssh sad-robot -p 23
  264. # ssh bighead -> ssh bighead -p 23
  265. # aliases inherit everything from marvin, except hostname
  266. Port: 23
  267. Aliases:
  268. - sad-robot
  269. - bighead
  270. dolphin:
  271. # ssh dolphin -> ssh dolphin -p 24
  272. # ssh ecco -> ssh dolphin -p 24
  273. # same as above, but with fixed hostname
  274. Port: 24
  275. Hostname: dolphin
  276. Aliases:
  277. - ecco
  278. schooltemplate:
  279. User: student
  280. IdentityFile: ~/.ssh/school-rsa
  281. ForwardX11: yes
  282. schoolgw:
  283. # ssh school -> ssh gw.school.com -l student -o ForwardX11=no -i ~/.ssh/school-rsa
  284. Hostname: gw.school.com
  285. ForwardX11: no
  286. Inherits:
  287. - schooltemplate
  288. "expanded-host[0-7]*":
  289. # ssh somehost2042 -> ssh somehost2042.some.zone
  290. Hostname: "%h.some.zone"
  291. vm-*.school.com:
  292. # ssh vm-42.school.com -> ssh vm-42.school.com/gw.school.com -l student -o ForwardX11=yes -i ~/.ssh/school-rsa
  293. Gateways:
  294. - schoolgw
  295. Inherits:
  296. - schooltemplate
  297. # do not automatically create `ControlPath` -> may result in error
  298. NoControlMasterMkdir: true
  299. "*.shortcut1":
  300. ResolveCommand: /bin/sh -c "echo %h | sed s/.shortcut1/.my-long-domain-name.com/"
  301. "*.shortcut2":
  302. ResolveCommand: /bin/sh -c "echo $(echo %h | sed s/.shortcut2//).my-other-long-domain-name.com"
  303. "*.scw":
  304. # ssh toto.scw -> 1. dynamically resolves the IP address
  305. # 2. ssh {resolved ip address} -u root -p 22 -o UserKnownHostsFile=null -o StrictHostKeyChecking=no
  306. # requires github.com/scaleway/scaleway-cli
  307. ResolveCommand: /bin/sh -c "scw inspect -f {{.PublicAddress.IP}} server:$(echo %h | sed s/.scw//)"
  308. User: root
  309. Port: 22
  310. UserKnownHostsFile: /dev/null
  311. StrictHostKeyChecking: no
  312. my-env-host:
  313. User: user-$USER
  314. Hostname: ${HOSTNAME}${HOSTNAME_SUFFIX}
  315. templates:
  316. # Templates are similar to Hosts, you can inherits from them
  317. # but you cannot ssh to a template
  318. bart-template:
  319. User: bart
  320. lisa-template:
  321. User: lisa
  322. simpson-template:
  323. Host: home.simpson.springfield.us
  324. defaults:
  325. # Defaults are applied to each hosts
  326. ControlMaster: auto
  327. ControlPath: ~/tmp/.ssh/cm/%h-%p-%r.sock
  328. ControlPersist: yes
  329. Port: 22
  330. User: bob
  331. includes:
  332. - ~/.ssh/assh.d/*.yml
  333. - /etc/assh.yml
  334. - $ENV_VAR/blah-blah-*/*.yml
  335. ASSHBinaryPath: ~/bin/assh # optionally set the path of assh
  336. ```
  337. ---
  338. A *HOST* and the `defaults` section may
  339. ## Usage
  340. `assh` usage
  341. ```
  342. NAME:
  343. assh - advanced ssh config
  344. USAGE:
  345. assh [global options] command [command options] [arguments...]
  346. VERSION:
  347. 2.4.1 (HEAD)
  348. AUTHOR(S):
  349. Manfred Touron <https://github.com/moul/advanced-ssh-config>
  350. COMMANDS:
  351. info Display system-wide information
  352. config Manage ssh and assh configuration
  353. sockets Manage control sockets
  354. help, h Shows a list of commands or help for one command
  355. GLOBAL OPTIONS:
  356. --config value, -c value Location of config file (default: "~/.ssh/assh.yml") [$ASSH_CONFIG]
  357. --debug, -D Enable debug mode [$ASSH_DEBUG]
  358. --verbose, -V Enable verbose mode
  359. --help, -h show help
  360. --version, -v print the version
  361. ```
  362. ### Usage examples
  363. ##### `assh config build`
  364. Rewrites and replaces the existing ~/.ssh/config file.
  365. This action is automatically done by assh when detecting configuration changes.
  366. Running this command manually is useful to setup assh.
  367. ```console
  368. $ assh config build > ~/.ssh/config
  369. ```
  370. ##### `assh config list`
  371. List hosts and options.
  372. ```console
  373. $ assh config list
  374. Listing entries
  375. *.scw -> root@[hostname_not_specified]:22
  376. [custom options] StrictHostKeyChecking=no UserKnownHostsFile=/dev/null
  377. *.shortcut1 -> bob@[hostname_not_specified]:22
  378. *.shortcut2 -> bob@[hostname_not_specified]:22
  379. bart -> bart@5.6.7.8:22
  380. bart-access -> bob@[hostname_not_specified]:22
  381. dolphin -> bob@dolphin:24
  382. expanded-host[0-7]* -> bob@%h.some.zone:22
  383. homer -> robert@1.2.3.4:2222
  384. lisa-access -> bob@[hostname_not_specified]:22
  385. maggie -> maggie@[hostname_not_specified]:22
  386. marvin -> bob@[hostname_not_specified]:23
  387. my-env-host -> user-moul@[hostname_not_specified]:22
  388. schoolgw -> bob@gw.school.com:22
  389. [custom options] ForwardX11=no
  390. schooltemplate -> student@[hostname_not_specified]:22
  391. [custom options] ForwardX11=yes IdentityFile=~/.ssh/school-rsa
  392. vm-*.school.com -> bob@[hostname_not_specified]:22
  393. (*) General options:
  394. ControlMaster: auto
  395. ControlPath: ~/tmp/.ssh/cm/%h-%p-%r.sock
  396. ControlPersist: yes
  397. Port: 22
  398. User: bob
  399. ```
  400. ##### `assh config search <keyword>`
  401. Search for `<keyword>` in hosts and host options.
  402. ```console
  403. $ assh config search bart
  404. Listing results for bart:
  405. bart -> bart@5.6.7.8:22
  406. bart-access -> moul@[hostname_not_specified]:22
  407. ```
  408. ##### `assh info`
  409. Display system-wide information.
  410. ```console
  411. $ assh info
  412. Debug mode (client): false
  413. CLI Path: /path/to/assh
  414. Go version: go1.6.2
  415. OS/Arch: darwin/amd64
  416. RC files:
  417. - ~/.ssh/assh.yml
  418. - ~/.ssh/assh.d/hosts.yml
  419. - ~/.ssh/assh.d/moul.yml
  420. - ~/.ssh/assh.d/test.yml
  421. Statistics:
  422. - 299 hosts
  423. - 2 templates
  424. - 4 included files
  425. ```
  426. ##### `assh sockets list`
  427. List active control sockets.
  428. ```console
  429. $ assh sockets list
  430. 4 active control sockets in "~/.ssh/cm/":
  431. - bart/homer/lisa-22-root.sock (14 minutes)
  432. - bart/homer-22-root.sock (14 minutes)
  433. - bart-22-root.sock (14 minutes)
  434. - marge-22-bart.sock (1 hour)
  435. ```
  436. ##### `assh sockets flush`
  437. Close active control sockets.
  438. ```console
  439. $ assh sockets flush
  440. Closed 4 control sockets.
  441. ```
  442. ##### `assh sockets master`
  443. Create a master control sockets.
  444. ```console
  445. $ assh sockets master
  446. ```
  447. ## Install
  448. Get the latest version using GO (recommended way):
  449. ```bash
  450. go get -u github.com/moul/advanced-ssh-config/cmd/assh
  451. ```
  452. ---
  453. Get the latest released version using homebrew (Mac OS X):
  454. ```bash
  455. brew install assh
  456. ```
  457. Build the latest version
  458. ```bash
  459. brew install assh --HEAD
  460. ```
  461. ---
  462. Get a released version on: https://github.com/moul/advanced-ssh-config/releases
  463. ---
  464. #### Register the wrapper (optional)
  465. To improve experience when using advanced pattern matching, add the following at the end of your .bashrc or .zshrc:
  466. ```bash
  467. alias ssh="assh wrapper ssh"
  468. ```
  469. This step is not *mandatory* but highly *recommended*.
  470. ---
  471. **Note**: `ssh` does not understand advanced patterns;
  472. To bypass this limitation, `assh` maintains a list of *known hosts* and regenerate the `~/.ssh/config` with all those expanded *known hosts*.
  473. Without the wrapper, the `~/.ssh/config` risks to be outdated when connecting to a new host for the first time and you will need to launch the command again.
  474. With the wrapper, `ssh` will *always* be called with an updated `~/.ssh/config` file.
  475. ## Getting started
  476. 1. Backup your old `~/.ssh/config`: `cp ~/.ssh/config ~/.ssh/config.backup`
  477. 2. Create a new `~/.ssh/assh.yml` file
  478. 3. Run `assh config build > ~/.ssh/config` to validate the syntax of your `~/.ssh/assh.yml` file and automatically build your `~/.ssh/config` file
  479. 4. You are ready!
  480. ## Changelog
  481. ### master (unreleased)
  482. * Support of `OnConnect` and `OnDisconnect` hooks
  483. * Support of `write`, `notify` and `exec` hook drivers
  484. * Add `assh config json` command
  485. * Add `assh config {build,json} --expand` option
  486. [Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.4.1...master)
  487. ### v2.4.1 (2016-07-19)
  488. * Fix panic in `assh wrapper` ([#157](https://github.com/moul/advanced-ssh-config/issues/157))
  489. [Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.4.0...v2.4.1)
  490. ### v2.4.0 (2016-07-14)
  491. * Add a control socket manager `assh sockets {list,flush,master}` ([#152](https://github.com/moul/advanced-ssh-config/pull/152))
  492. * Add a `assh --config=/path/to/assh.yml` option
  493. * Add storm-like `assh config list` and `assh config search {keyword}` commands ([#151](https://github.com/moul/advanced-ssh-config/pull/151))
  494. * Add an optional `ASSHBinaryPath` variable in the `assh.yml` file ([#148](https://github.com/moul/advanced-ssh-config/issues/148))
  495. * Rename `assh proxy -> assh connect`
  496. * Hide `assh connect` and `assh wrapper` from the help
  497. * Support built-in ssh netcat mode, may fail with older SSH clients ([#146](https://github.com/moul/advanced-ssh-config/issues/146))
  498. [Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.3.0...v2.4.0)
  499. ### v2.3.0 (2016-04-27)
  500. * Add wrapper and `known_hosts` support to handle *advanced patterns* ([#122](https://github.com/moul/advanced-ssh-config/issues/122))
  501. * Add build information in .ssh/config header ([#49](https://github.com/moul/advanced-ssh-config/issues/49))
  502. * Add Autocomplete support ([#48](https://github.com/moul/advanced-ssh-config/issues/48))
  503. * Initial `Aliases` support ([#133](https://github.com/moul/advanced-ssh-config/issues/133))
  504. * Use args[0] as ProxyCommand ([#134](https://github.com/moul/advanced-ssh-config/issues/134))
  505. * Add `NoControlMasterMkdir` option to disable automatic creation of directories for gateways ([#124](https://github.com/moul/advanced-ssh-config/issues/124))
  506. * Fix: Allow `$(...)` syntax in the `ResolveCommand` function ([#117](https://github.com/moul/advanced-ssh-config/issues/117))
  507. * Printing the error of a failing `ResolveCommand` ([#117](https://github.com/moul/advanced-ssh-config/issues/117))
  508. * Fix: `Gateways` field is no longer ignored when the `HostName` field is present ([#102](https://github.com/moul/advanced-ssh-config/issues/102))
  509. * Ignore SIGHUP, close goroutines and export written bytes ([#112](https://github.com/moul/advanced-ssh-config/pull/112)) ([@QuentinPerez](https://github.com/QuentinPerez))
  510. * Various documentation improvements ([@ashmatadeen](https://github.com/ashmatadeen), [@loliee](https://github.com/loliee), [@cerisier](https://github.com/cerisier))
  511. * Support of new SSH configuration fields (`AskPassGUI`, `GSSAPIClientIdentity`, `GSSAPIKeyExchange`, `GSSAPIRenewalForcesRekey`, `GSSAPIServerIdentity`, `GSSAPITrustDns`, `KeychainIntegration`)
  512. [Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.2.0...v2.3.0)
  513. ### v2.2.0 (2016-02-03)
  514. * Avoid exiting when an included file contains errors ([#95](https://github.com/moul/advanced-ssh-config/issues/95))
  515. * Anonymize paths in `assh info`
  516. * Support of `assh proxy --dry-run` option
  517. * Fix: do not resolve variables in hostnames twice ([#103](https://github.com/moul/advanced-ssh-config/issues/103))
  518. [Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.1.0...v2.2.0)
  519. ### v2.1.0 (2015-10-05)
  520. * Expand environment variables ([#86](https://github.com/moul/advanced-ssh-config/issues/86))
  521. * Add homebrew support ([#73](https://github.com/moul/advanced-ssh-config/issues/73))
  522. * Add a 'ssh info' command ([#71](https://github.com/moul/advanced-ssh-config/issues/71))
  523. * Templates support ([#52](https://github.com/moul/advanced-ssh-config/issues/52))
  524. * Configuration is now case insensitive ([#51](https://github.com/moul/advanced-ssh-config/issues/51))
  525. * Fix: resolving host fields for gateways ([#79](https://github.com/moul/advanced-ssh-config/issues/79))
  526. * Fix: inheritance was not working for non assh-related fields ([#54](https://github.com/moul/advanced-ssh-config/issues/54))
  527. * Fix: expanding variables in HostName ([#56](https://github.com/moul/advanced-ssh-config/issues/56))
  528. [Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.0.0...v2.1.0)
  529. ### v2.0.0 (2015-09-07)
  530. * First Golang version
  531. * Compatibility issue: complete switch from `.ini` file format to `.yml`, the `~/.ssh/assh.yml` file needs to be manually crafted
  532. * Features
  533. * Parses `~/.ssh/assh.yml` and generates `~/.ssh/config` dynamically
  534. * CLI: Use gateways from CLI without any configuration needed
  535. * Config: Declares gateways in coniguration
  536. * Config: Host inheritance
  537. * Config: Support of `includes`
  538. * Config: Support of Regex
  539. * Config: Handling all sshconfig fields
  540. * Config: Support of host `ProxyCommand` (inception)
  541. * Under the hood: Inspecting parent process **verbose**/**debug** mode
  542. * Under the hook: dynamic proxy using **raw TCP**, **netcat**
  543. [Full commits list](https://github.com/moul/advanced-ssh-config/compare/be4fea1632b1e9f8aa60585187338777baaf1210...v2.0.0)
  544. ### [v1](https://github.com/moul/advanced-ssh-config/tree/v1.1.0) (2015-07-22)
  545. * Last Python version
  546. ### [POC](https://github.com/moul/advanced-ssh-config/commit/550f86c225d30292728ad24bc883b6d3a3e3f1b1) (2010-08-26)
  547. * First Python version (POC)
  548. ## Docker
  549. Experimental: `assh` may run in Docker, however you will have limitations:
  550. * The `assh` containers does not have any binaries except `assh`, you can't use `ProxyCommand`, `ResolveCommand`...
  551. * Docker may run on another host, `ssh localhost` will ssh to Docker host
  552. ```console
  553. docker run -it --rm -v ~/.ssh:/.ssh moul/assh --help
  554. ```
  555. `assh` in Docker is slower and has more limitations, but it may be useful for testing or if you plan to use a Docker host as a remote Gateway
  556. ## Alternative version
  557. * [v1](https://github.com/moul/advanced-ssh-config/tree/v1) (2009-2015) - The original implementation. It worked quite well, but was a lot slower, less portable, harder to install for the user and harder to work on to develop new features and fix bugs
  558. ## Troubleshooting
  559. #### I can't use gateways
  560. `assh` uses the [built-in netcat mode of OpenSSH (shipped with OpenSSH 5.4)](https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts#Passing_through_a_gateway_using_netcat_mode) by default.
  561. If your ssh client doesn't support this feature, you can configure a custom `ProxyCommand` configuration, i.e:
  562. ```yaml
  563. hosts:
  564. myserver:
  565. host: 1.2.3.4
  566. gateways:
  567. - mygateway
  568. # configure a custom proxycommand
  569. proxycommand: /bin/nc %h %p
  570. mygateway:
  571. host: 5.6.7.8
  572. ```
  573. ---
  574. You can configure this rule globally:
  575. ```yaml
  576. defaults:
  577. proxycommand: nc %h %p
  578. ```
  579. ---
  580. Also, be sure to have netcat installed on your system, or use an alternative proxy binary, i.e: `socat`.
  581. #### How to configure resolver to parse `/etc/hosts` and/or handle **mDNS** requests ?
  582. **assh** resolves hostnames using the system built-in resolver, depending on the OS, you can enable new features and/or change modules order.
  583. * [Linux - nsswitch documentation](http://man7.org/linux/man-pages/man5/nsswitch.conf.5.html)
  584. * [Linux - mDNS support (nss-mdns)](http://0pointer.de/lennart/projects/nss-mdns/)
  585. * [Mac OS X - `/etc/resolv.conf` documentation](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/resolver.5.html)
  586. #### `unix_listener: "/Users/.../.ssh/cm/..." too long for Unix domain socket`
  587. Starting with `OpenSSH v6.7` the socket name can be shortened by configuring `%C` for the name expansion.
  588. ```yaml
  589. defaults:
  590. ControlPath: ~/tmp/.ssh/cm/%C.sock
  591. ```
  592. `%C` is a unique identifier based on a hash of the tuple of (local host, remote user, hostname, port).
  593. ## License
  594. © 2009-2016 Manfred Touron - MIT License