You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+36-50
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ You can:
14
14
15
15
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.
16
16
17
-
## Usage
17
+
## Usage examples
18
18
19
19
### Basic usage
20
20
@@ -54,58 +54,57 @@ steps:
54
54
echo "...multiple commands"
55
55
```
56
56
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
| [`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) |
71
70
72
-
If your port is not standard (`22`), you can specify it through the `port` input.
71
+
## Outputs
73
72
74
-
Note it is ignored if you declare an `ssh_config` input.
73
+
_No output is generated._
75
74
76
-
### Authentication
75
+
## Configuration
77
76
78
-
#### Private SSH key<a name="private-key"></a>
77
+
### Hosts<a name="hosts"></a>
79
78
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.
81
80
82
-
The script dumps the SSH private key to `~/.ssh/id_rsa`.
81
+
### Private SSH key<a name="private-key"></a>
83
82
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`.
85
84
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>
87
86
88
-
#### Password
87
+
### Known hosts<a name="known-hosts"></a>
89
88
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.
91
90
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! ⚠️
93
92
94
-
#### Known hosts
93
+
### Knock sequence<a name="knock-sequence"></a>
95
94
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.
97
96
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.
99
98
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).
101
100
102
-
#### Knock sequence
101
+
### SSH config<a name="ssh-config"></a>
103
102
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`.
105
104
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>
107
106
108
-
You can change this behaviour by specifying your own SSH config (see the [**SSH config**](#ssh-config) section).
107
+
## Limitations
109
108
110
109
### Use environment variables
111
110
@@ -128,29 +127,16 @@ steps:
128
127
# [...]
129
128
```
130
129
131
-
## Configuration
130
+
### One authentication for every hosts<a name="one-auth-for-all-hosts"></a>
132
131
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`).
134
133
135
134
## Troubleshooting
136
135
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>
138
137
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 privatekey 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)]:
0 commit comments