Make sure that your key algorithm of choice is supported. On Ubuntu 20.04 or later you must explicitly allow the use of the ssh-rsa algorithm. Add the following line to your OpenSSH daemon file (which is either `/etc/ssh/sshd_config` or a drop-in file under
`/etc/ssh/sshd_config.d/`):
```bash
CASignatureAlgorithms +ssh-rsa
```
Alternatively, `ed25519` keys are accepted by default in OpenSSH. You could use this instead of rsa if needed:
```bash
ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
```
### Example
Executing remote ssh commands using password.
#### Executing remote ssh commands using password
```yaml
- name:executing remote ssh commands using password
uses:appleboy/ssh-action@master
uses:appleboy/ssh-action@v0.1.6
with:
host:${{ secrets.HOST }}
username:${{ secrets.USERNAME }}
@ -92,11 +199,11 @@ Executing remote ssh commands using password.
script:whoami
```
Using private key
#### Using private key
```yaml
- name:executing remote ssh commands using ssh key
uses:appleboy/ssh-action@master
uses:appleboy/ssh-action@v0.1.6
with:
host:${{ secrets.HOST }}
username:${{ secrets.USERNAME }}
@ -105,11 +212,11 @@ Using private key
script:whoami
```
Multiple Commands
#### Multiple Commands
```yaml
- name:multiple command
uses:appleboy/ssh-action@master
uses:appleboy/ssh-action@v0.1.6
with:
host:${{ secrets.HOST }}
username:${{ secrets.USERNAME }}
@ -122,11 +229,11 @@ Multiple Commands

Multiple Hosts
#### Multiple Hosts
```diff
- name: multiple host
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v0.1.6
with:
- host: "foo.com"
+ host: "foo.com,bar.com"
@ -138,11 +245,26 @@ Multiple Hosts
ls -al
```
Synchronous execution on multiple hosts
#### Multiple hosts with different port
```diff
- name: multiple host
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v0.1.6
with:
- host: "foo.com"
+ host: "foo.com:1234,bar.com:5678"
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
whoami
ls -al
```
#### Synchronous execution on multiple hosts
```diff
- name: multiple host
uses: appleboy/ssh-action@v0.1.6
with:
host: "foo.com,bar.com"
+ sync: true
@ -154,11 +276,11 @@ Synchronous execution on multiple hosts
ls -al
```
Pass environment variable to shell script
#### Pass environment variable to shell script
```diff
- name: pass environment
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v0.1.6
+ env:
+ FOO: "BAR"
+ BAR: "FOO"
@ -168,18 +290,22 @@ Pass environment variable to shell script
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
+ envs: FOO,BAR
+ envs: FOO,BAR,SHA
script: |
echo "I am $FOO"
echo "I am $BAR"
echo "sha: $SHA"
```
Stop script after first failure. ex: missing `abc` folder
_Inside `env` object, you need to pass every environment variable as a string, passing `Integer` data type or any other may output unexpected results._
#### Stop script after first failure
> ex: missing `abc` folder
```diff
- name: stop script if command error
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v0.1.6
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
@ -204,7 +330,7 @@ err: mkdir: cannot create directory ‘abc/def’: No such file or directory
##[error]Docker run failed with exit code 1
```
How to connect remote server using `ProxyCommand`?
#### How to connect remote server using `ProxyCommand`?
```bash
+--------+ +----------+ +-----------+
@ -228,11 +354,11 @@ Host FooServer
ProxyCommand ssh -q -W %h:%p Jumphost
```
How to convert to YAML format of GitHubActions.
#### How to convert to YAML format of GitHubActions
```diff
- name: ssh proxy command
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v0.1.6
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
@ -247,11 +373,15 @@ How to convert to YAML format of GitHubActions.
ls -al
```
Protecting a Private Key. The purpose of the passphrase is usually to encrypt the private key. This makes the key file by itself useless to an attacker. It is not uncommon for files to leak from backups or decommissioned hardware, and hackers commonly exfiltrate files from compromised systems.
#### Protecting a Private Key
The purpose of the passphrase is usually to encrypt the private key.
This makes the key file by itself useless to an attacker.
It is not uncommon for files to leak from backups or decommissioned hardware, and hackers commonly exfiltrate files from compromised systems.
```diff
- name: ssh key passphrase
uses: appleboy/ssh-action@master
uses: appleboy/ssh-action@v0.1.6
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
@ -262,3 +392,37 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th
whoami
ls -al
```
#### Using host fingerprint verification
Setting up SSH host fingerprint verification can help to prevent Person-in-the-Middle attacks. Before setting this up, run the command below to get your SSH host fingerprint. Remember to replace `ed25519` with your appropriate key type (`rsa`, `dsa`, etc.) that your server is using and `example.com` with your host.
In modern OpenSSH releases, the _default_ key types to be fetched are `rsa` (since version 5.1), `ecdsa` (since version 6.0), and `ed25519` (since version 6.7).
description:'include more ciphers with use_insecure_cipher'
default:false
cipher:
description:'the allowed cipher algorithms. If unspecified then a sensible'
timeout:
description:'timeout for ssh to host'
default:"30s"
@ -51,6 +53,8 @@ inputs:
description:'path of ssh proxy private key'
proxy_fingerprint:
description:'sha256 fingerprint of the proxy host public key'
proxy_cipher:
description:'the allowed cipher algorithms. If unspecified then a sensible'
proxy_use_insecure_cipher:
description:'include more ciphers with use_insecure_cipher'
default:false
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.