|
1 | 1 | # sshush |
2 | 2 |
|
3 | | -## Documentation |
4 | | - |
5 | 3 | Full docs can be found here: https://sshush.bencromwell.com |
6 | 4 |
|
7 | 5 | ## Intro |
8 | 6 |
|
9 | | -Takes a YAML defined set of SSH configs and produces an SSH config file from it. |
| 7 | +Sshush takes a bunch of `YAML` and produces an SSH config file. |
| 8 | + |
| 9 | +### Defaults |
| 10 | + |
| 11 | +- *Source*: `~/.ssh/config.yml` |
| 12 | +- *Destination*: `~/.ssh/config` |
| 13 | + |
| 14 | +### Premise |
| 15 | + |
| 16 | +I wanted a way to manage my SSH config file based on inheritance. |
| 17 | + |
| 18 | +This lets you group together hosts and common options, that can be optionally and selectively overridden. |
10 | 19 |
|
11 | | -Defaults to `~/.ssh/config.yml` for the source and `~/.ssh/config` for the destination. |
| 20 | +For example: |
12 | 21 |
|
13 | | -#### Premise |
| 22 | +- All my servers at cloud provider have the same port. |
| 23 | +- All my servers at other cloud provider share a common username. |
| 24 | +- All my local Unifi devices share a specific SSH key. |
| 25 | +- All my ancient Cisco hardware at work shares an outdated Cipher configuration. |
14 | 26 |
|
15 | | -I wanted a way to manage my SSH config file that allowed me to define an inheritance based structure. This allows you to group hosts together, apply common options and be able to override the options if needs be. For example, maybe you have everything in DigitalOcean on a particular port with a particular user and SSH key, but everything in AWS is different. Or they share ports but not keys. |
| 27 | +## Installation |
16 | 28 |
|
17 | | -#### Globals |
| 29 | +Download a release from the GitHub releases page. Place it somewhere in your `$PATH`. |
| 30 | + |
| 31 | +## Configuration |
| 32 | + |
| 33 | +### Globals |
18 | 34 |
|
19 | 35 | Options that apply to the catch-all `Host *`. |
20 | 36 |
|
21 | | -#### Defaults |
| 37 | +### Defaults |
22 | 38 |
|
23 | | -Basic options such as a default User or IdentityFile. Can be overridden by group or individual host entries. |
| 39 | +Basic options such as a default `User` or `IdentityFile`. |
24 | 40 |
|
25 | | -#### Example |
| 41 | +Can be overridden by group or individual host entries. |
26 | 42 |
|
27 | | -Example config demonstrating the use of the global and default options: |
| 43 | +### Example |
28 | 44 |
|
29 | | -```yaml |
| 45 | +This example demonstrates global and defaults: |
30 | 46 |
|
| 47 | +```yaml |
31 | 48 | --- |
32 | 49 | global: |
33 | 50 | UseRoaming: "no" |
@@ -71,10 +88,75 @@ work: |
71 | 88 |
|
72 | 89 | ``` |
73 | 90 |
|
74 | | -#### Installation |
| 91 | +This results in: |
| 92 | + |
| 93 | +```text |
| 94 | +# Generated by sshush v2.1.0 |
| 95 | +# From path/to/readme.yaml |
| 96 | +
|
| 97 | +# web_servers |
| 98 | +Host projects-aws |
| 99 | + HostName projects-aws.example.com |
| 100 | + IdentityFile ~/.ssh/aws |
| 101 | + Port 2201 |
| 102 | + User ben |
| 103 | +
|
| 104 | +Host projects-do-1 |
| 105 | + HostName projects-do-1.example.com |
| 106 | + IdentityFile ~/.ssh/digital_ocean |
| 107 | + Port 2201 |
| 108 | + User ben |
| 109 | +
|
| 110 | +Host projects-do-2 |
| 111 | + HostName projects-do-2.example.com |
| 112 | + IdentityFile ~/.ssh/digital_ocean |
| 113 | + Port 2201 |
| 114 | + User ben |
| 115 | +
|
| 116 | +# raspberry_pis |
| 117 | +Host pi1 |
| 118 | + HostName 192.168.0.107 |
| 119 | + IdentityFile ~/.ssh/id_rsa |
| 120 | + User pi |
| 121 | +
|
| 122 | +Host pi2 |
| 123 | + HostName 192.168.0.108 |
| 124 | + IdentityFile ~/.ssh/id_rsa |
| 125 | + User pi |
| 126 | +
|
| 127 | +# local |
| 128 | +Host kodi |
| 129 | + HostName 192.168.0.200 |
| 130 | + IdentityFile ~/.ssh/id_rsa |
| 131 | + User ben |
| 132 | +
|
| 133 | +Host router |
| 134 | + HostName 192.168.0.1 |
| 135 | + IdentityFile ~/.ssh/id_rsa |
| 136 | + User root |
| 137 | +
|
| 138 | +# work |
| 139 | +Host gitlab |
| 140 | + HostName 10.0.0.30 |
| 141 | + IdentityFile ~/.ssh/id_rsa |
| 142 | + User bcromwell |
| 143 | +
|
| 144 | +Host jenkins |
| 145 | + HostName 10.0.0.20 |
| 146 | + IdentityFile ~/.ssh/id_rsa |
| 147 | + User bcromwell |
| 148 | +
|
| 149 | +Host workpc |
| 150 | + HostName 10.0.0.80 |
| 151 | + IdentityFile ~/.ssh/id_rsa |
| 152 | + User bcromwell |
| 153 | +
|
| 154 | +# Global config |
| 155 | +Host * |
| 156 | + UseRoaming no |
75 | 157 |
|
76 | | -Grab a release from the GitHub releases page. |
| 158 | +``` |
77 | 159 |
|
78 | | -### Notes |
| 160 | +## Notes |
79 | 161 |
|
80 | 162 | This was originally written in Python, which can be found in the 1.x branch. |
0 commit comments