Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Commit 0e5f893

Browse files
committed
docs: review the Readme so it can be read easily
1 parent 2dba5fd commit 0e5f893

File tree

3 files changed

+54
-54
lines changed

3 files changed

+54
-54
lines changed

README.md

+36-50
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can:
1414

1515
This Github action is rather young and it might not be as stable and battle-tested as you need: use it at your own risk.
1616

17-
## Usage
17+
## Usage examples
1818

1919
### Basic usage
2020

@@ -54,58 +54,57 @@ steps:
5454
echo "...multiple commands"
5555
```
5656
57-
### SSH config<a name="ssh-config"></a>
58-
59-
You can specify a `ssh_config` input with a compliant SSH config ([`man ssh_config`](https://linux.die.net/man/5/ssh_config)) which will be dumped as is in `~/.ssh/config`.
60-
61-
Among other things, this will allow you to use a bastion or jump hosts or change the behaviour of the knock sequence.
62-
63-
In such case, beware:
64-
- the `user` input is ignored, specify the `User` in `ssh_config`
65-
- the `port` input is ignored, specify the `Port` in `ssh_config` if it's not standard
66-
- the `knock_sequence` input is ignored, specify a `ProxyCommand` in `ssh_config` if you need it
67-
+ Example: `ProxyCommand /bin/sh -c 'until nc -zv %h %p -w 1 2>&1 ; do knock %h 111 222 333 ; done; exec nc %h %p'`
68-
- do not declare the `IdentityFile` as its location is hard-coded (`~/.ssh/id_rsa`)
57+
## Inputs
6958
70-
### Port
59+
| Parameter | Required | Description |
60+
|-------------------------------------|-------------------------------------------|----------------------------------------------------------------------|
61+
| [`hosts`](#hosts) | Yes | Remote host(s) to connect to |
62+
| `commands` | Yes | One or multiple commands to run on the remote host(s) |
63+
| `user` | [Sometimes](#ssh-config--optional-inputs) | Remote user to connect with |
64+
| `port` | [Sometimes](#ssh-config--optional-inputs) | Remote port to connect to (_default: `22`_) |
65+
| [`private_key`](#private-key) | [Sometimes](#password-or-private-key) | Private SSH key to connect with |
66+
| `password` | [Sometimes](password-or-private-key) | Password to connect with |
67+
| [`known_hosts`](#known-hosts) | No | Known hosts keys that SSH can rely on to connect to the remote hosts |
68+
| [`knock_sequence`](#knock-sequence) | No | Knock sequence performed onto remote host(s) before connecting to it |
69+
| [`ssh_config`](#ssh-config) | No | SSH config to use to connect to remote host(s) |
7170

72-
If your port is not standard (`22`), you can specify it through the `port` input.
71+
## Outputs
7372

74-
Note it is ignored if you declare an `ssh_config` input.
73+
_No output is generated._
7574

76-
### Authentication
75+
## Configuration
7776

78-
#### Private SSH key<a name="private-key"></a>
77+
### Hosts<a name="hosts"></a>
7978

80-
To authenticate yourself, you can use a private SSH key with the `private_key` input.
79+
Specify the remote host(s) - [they all must share the same authentication](#one-auth-for-all-hosts) - to run the `commands` on via the `hosts` input.
8180

82-
The script dumps the SSH private key to `~/.ssh/id_rsa`.
81+
### Private SSH key<a name="private-key"></a>
8382

84-
Note if you both `password` and `private_key`, `password` will be ignored.
83+
To authenticate yourself, you can use a private SSH key with the `private_key` input [**using a PEM format**](#not-a-valid-rsa-private-key). The script will dump the SSH private key to `~/.ssh/id_rsa`.
8584

86-
Beware you need to use a PEM-formatted SSH key because `paramiko`, one of the library behind this action, does not support the newest key formats [[reference](https://github.com/paramiko/paramiko/issues/340#issuecomment-492448662)].
85+
Note if you both `password` and `private_key`, `password` will be ignored.<a name="password-or-private-key"></a>
8786

88-
#### Password
87+
### Known hosts<a name="known-hosts"></a>
8988

90-
To authenticate yourself, you can use a `password`.
89+
You can specify explicit one or multiple known hosts keys using the `known_host` input.
9190

92-
The script passes the password to the SSH CLI through `sshpass`
91+
When not specifying `known_hosts`, the option `StrictHostKeyChecking=no` is added in the `ssh_config`: in such cases, you are exposing yourself to security risks! ⚠️
9392

94-
#### Known hosts
93+
### Knock sequence<a name="knock-sequence"></a>
9594

96-
You can specify explicit one or multiple (for jump host for example) known hosts keys using the `known_host` input.
95+
If your remote host needs a knocking sequence (see [`man knock`](https://linux.die.net/man/1/knock)), you can specify the sequence through the `knock_sequence` input.
9796

98-
If you do not specify the `known_hosts` input, the option `StrictHostKeyChecking=no` will be put in the SSH config file.
97+
For example, with a `knock_sequence` of `111 222 333`, the action will create an SSH config with a `ProxyCommand` that will knock the `host` until it is reachable or will fail after 10 attemps.
9998

100-
⚠️ Be aware that by not specifying `known_hosts`, you would be exposing yourself to security risks.
99+
You can change this behaviour by specifying your own SSH config (see the [**SSH config**](#ssh-config) section).
101100

102-
#### Knock sequence
101+
### SSH config<a name="ssh-config"></a>
103102

104-
If your remote host needs a knocking sequence (see [`man knock`](https://linux.die.net/man/1/knock)), you can specify the sequence through the `knock_sequence` input.
103+
To have complete control over the connection behaviour, you can specify a `ssh_config` input with a compliant SSH config ([`man ssh_config`](https://linux.die.net/man/5/ssh_config)) which will be dumped as is in `~/.ssh/config`.
105104

106-
For example, with a `knock_sequence` of `111 222 333`, the action will create an SSH config with a `ProxyCommand` that will knock the `host` until it is reachable or will fail after 10 attemps.
105+
Beware, the `user`, `port` & `knock_sequence` inputs will be ignored, specify them explicitely in your `ssh_config`. Also note that you cannot declare the `IdentityFile` as its location is hard-coded (`~/.ssh/id_rsa`).<a name="ssh-config--optional-inputs"></a>
107106

108-
You can change this behaviour by specifying your own SSH config (see the [**SSH config**](#ssh-config) section).
107+
## Limitations
109108

110109
### Use environment variables
111110

@@ -128,29 +127,16 @@ steps:
128127
# [...]
129128
```
130129

131-
## Configuration
130+
### One authentication for every hosts<a name="one-auth-for-all-hosts"></a>
132131

133-
See [`action.yaml`](./action.yaml).
132+
You cannot have multiple SSH keys or passwords for all the `hosts`: they must share the same authentication method **AND** the same credential (i.e. same `password` or same `private_key`).
134133

135134
## Troubleshooting
136135

137-
### "Not a valid RSA private key file"
136+
### "Not a valid RSA private key file"<a name="not-a-valid-rsa-private-key"></a>
138137

139-
See the [**Private SSH key**](#private-key) section, you need to use a PEM-formatted SSH key:
138+
You need to use a PEM-formatted SSH private key because `paramiko`, one of the library behind this action, does not support the newest key formats [[reference](https://github.com/paramiko/paramiko/issues/340#issuecomment-492448662)]:
140139

141140
```shell
142141
ssh-keygen -t rsa -b 4096 -C "[email protected]" -m PEM
143142
```
144-
145-
## Todo
146-
147-
- Add pipenv integration in Dockerfile
148-
- Add Contributing guidelines
149-
- Add better disclaimer and manage expectation
150-
- Add more dependencies/implementation details
151-
- Add changelog
152-
- Add release(s)
153-
- Document Docker repo
154-
- Publish to marketplace
155-
- Tests
156-
- CI

TODO.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Todo
2+
3+
_Todo list to reach a stable 1.0.0 version_
4+
5+
- Add pipenv integration in Dockerfile
6+
- Add Contributing guidelines
7+
- Add better disclaimer and manage expectation
8+
- Add more dependencies/implementation details
9+
- Add changelog
10+
- Add release(s)
11+
- Document Docker repo
12+
- Publish to marketplace
13+
- Tests
14+
- CI

action.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ inputs:
77
description: Remote host(s) to connect to
88
required: true
99
commands:
10-
description: One or multiple commands to run on the remote hosts
10+
description: One or multiple commands to run on the remote host(s)
1111
required: true
1212
user:
13-
description: Remot user to connect with
13+
description: Remote user to connect with
1414
required: true
1515
port:
1616
description: Remote port to connect to
@@ -23,13 +23,13 @@ inputs:
2323
description: Password to connect with
2424
required: false
2525
known_hosts:
26-
description: Known hosts keys that SSH can rely on to connect to the remote host
26+
description: Known hosts keys that SSH can rely on to connect to the remote host(s)
2727
required: false
2828
knock_sequence:
2929
description: Knock sequence performed onto the remote host before connecting to it
3030
required: false
3131
ssh_config:
32-
description: SSH config to use to connect to the remote host
32+
description: SSH config to use to connect to the remote host(s)
3333
required: false
3434

3535
outputs: {}

0 commit comments

Comments
 (0)