mirror of
https://github.com/Burnett01/rsync-deployments.git
synced 2026-11-18 20:55:23 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 37c76ba59c | |||
| 7abe7ad2ed | |||
| fb178094f6 | |||
| 458d542ef0 | |||
| 72af351b83 | |||
| a45ed8d36c | |||
| b6ac3fe34e | |||
| 2292b0b93b |
@@ -62,9 +62,11 @@ jobs:
|
||||
|
||||
- `switches`* - The first is for any initial/required rsync flags, eg: `-avzr --delete`
|
||||
|
||||
- `rsh` - Remote shell commands
|
||||
- `rsh` - Custom remote shell SSH parameters via Rsync.
|
||||
|
||||
- `strict_hostkeys_checking` - Enables support for strict hostkeys (fingerprint) checking. ("true" / "false") - Default: "false"
|
||||
- `strict_hostkeys_checking` - Enables support for strict hostkeys (fingerprint) checking. ("true" / "false") - Default: "false" - **DEPRECATED (use 'known_hosts')!**
|
||||
|
||||
- `known_hosts` - Trusted host keys of the remote server, one per line (pinning). Enables strict hostkeys checking. Takes precedence over `strict_hostkeys_checking` - Default: "" - [See guide](#pinning-trusted-host-keys-known_hosts)
|
||||
|
||||
- `legacy_allow_rsa_hostkeys` - Enables support for legacy RSA host keys on OpenSSH 8.8+. ("true" / "false") - Default: "false"
|
||||
|
||||
@@ -122,7 +124,7 @@ jobs:
|
||||
remote_key: ${{ secrets.REMOTE_PRIVATE_KEY }}
|
||||
```
|
||||
|
||||
Advanced (with filters etc):
|
||||
Advanced (with filters etc) use ``switches``:
|
||||
|
||||
```yml
|
||||
jobs:
|
||||
@@ -134,12 +136,7 @@ jobs:
|
||||
uses: burnett01/rsync-deployments@v9
|
||||
with:
|
||||
switches: -avzr --delete --exclude="" --include="" --filter=""
|
||||
path: src/
|
||||
remote_path: ${{ secrets.REMOTE_PATH }} # ex: /var/www/html/
|
||||
remote_host: ${{ secrets.REMOTE_HOST }} # ex: example.com
|
||||
remote_port: ${{ secrets.REMOTE_PORT }} # ex: 22
|
||||
remote_user: ${{ secrets.REMOTE_USER }} # ex: ubuntu
|
||||
remote_key: ${{ secrets.REMOTE_PRIVATE_KEY }}
|
||||
[...redacted...]
|
||||
```
|
||||
|
||||
If your private key is passphrase protected you should use:
|
||||
@@ -153,19 +150,54 @@ jobs:
|
||||
- name: rsync deployments
|
||||
uses: burnett01/rsync-deployments@v9
|
||||
with:
|
||||
switches: -avzr --delete
|
||||
path: src/
|
||||
remote_path: ${{ secrets.REMOTE_PATH }} # ex: /var/www/html/
|
||||
remote_host: ${{ secrets.REMOTE_HOST }} # ex: example.com
|
||||
remote_port: ${{ secrets.REMOTE_PORT }} # ex: 22
|
||||
remote_user: ${{ secrets.REMOTE_USER }} # ex: ubuntu
|
||||
[...redacted...]
|
||||
remote_key: ${{ secrets.REMOTE_PRIVATE_KEY }}
|
||||
remote_key_pass: ${{ secrets.REMOTE_PRIVATE_KEY_PASS }}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Legacy RSA Hostkeys support for OpenSSH Servers >= 8.8+
|
||||
## Pinning trusted host keys (known_hosts)
|
||||
|
||||
By default the action accepts any host key the server presents. With ``strict_hostkeys_checking: "true"`` (deprecated)
|
||||
the key is fetched via `ssh-keyscan` right before the deployment, which only protects against
|
||||
the key changing during the run, not against a server that is already spoofed at that moment.
|
||||
|
||||
To actually verify the server, pass its host key(s) via ``known_hosts``. The action then enables strict checking and skips `ssh-keyscan`. If the server presents
|
||||
a different key, the deployment fails.
|
||||
|
||||
Get the public host key on the server itself (not over the network):
|
||||
|
||||
```sh
|
||||
cat /etc/ssh/ssh_host_ed25519_key.pub
|
||||
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... user@server
|
||||
```
|
||||
|
||||
Store the output in a secret (e.g. `REMOTE_HOST_KEYS`) and pass it to the action:
|
||||
|
||||
```yml
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: rsync deployments
|
||||
uses: burnett01/rsync-deployments@v9
|
||||
with:
|
||||
[...redacted...]
|
||||
known_hosts: ${{ secrets.REMOTE_HOST_KEYS }}
|
||||
```
|
||||
|
||||
Accepted formats, one entry per line (blank lines and lines starting with `#` are ignored):
|
||||
|
||||
- Bare key, e.g. `ssh-ed25519 AAAAC3...`. It is bound to `remote_host` (and `remote_port`, if not 22) automatically.
|
||||
- Full known_hosts line, e.g. `example.com ssh-ed25519 AAAAC3...` or a hashed `|1|...` line. Used as is, so the host part must match `remote_host`.
|
||||
|
||||
Multiple keys (e.g. ed25519 and ecdsa) can be listed on separate lines.
|
||||
|
||||
---
|
||||
|
||||
## Legacy RSA Hostkeys support for OpenSSH Servers >= 8.8+
|
||||
|
||||
If your remote OpenSSH Server still uses RSA hostkeys, then you have to
|
||||
manually enable legacy support for this by using ``legacy_allow_rsa_hostkeys: "true"``.
|
||||
@@ -179,21 +211,15 @@ jobs:
|
||||
- name: rsync deployments
|
||||
uses: burnett01/rsync-deployments@v9
|
||||
with:
|
||||
switches: -avzr --delete
|
||||
[...redacted...]
|
||||
legacy_allow_rsa_hostkeys: "true"
|
||||
path: src/
|
||||
remote_path: ${{ secrets.REMOTE_PATH }} # ex: /var/www/html/
|
||||
remote_host: ${{ secrets.REMOTE_HOST }} # ex: example.com
|
||||
remote_port: ${{ secrets.REMOTE_PORT }} # ex: 22
|
||||
remote_user: ${{ secrets.REMOTE_USER }} # ex: ubuntu
|
||||
remote_key: ${{ secrets.REMOTE_PRIVATE_KEY }}
|
||||
```
|
||||
|
||||
See [#49](https://github.com/Burnett01/rsync-deployments/issues/49) and [#24](https://github.com/Burnett01/rsync-deployments/issues/24) for more information.
|
||||
|
||||
**Note:** Only use this if necessary. It's recommended to upgrade your remote OpenSSH server instead.
|
||||
|
||||
--
|
||||
---
|
||||
|
||||
## Advanced Rsync switches/flags/options
|
||||
|
||||
|
||||
+40
-7
@@ -2,6 +2,8 @@
|
||||
|
||||
The Docker image and code quality are regularly checked for vulnerabilities and CVEs by Snyk and CodeQL.
|
||||
|
||||
Additionally, we run linter and BATS suite tests to ensure stable compatibility.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The following versions are currently being supported with security updates:
|
||||
@@ -9,18 +11,18 @@ The following versions are currently being supported with security updates:
|
||||
| Version | Supported | Rsync version | Alpine version | Support Until |
|
||||
| ------- | ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| (``v9``) 9.0.4 | :white_check_mark: | >= 3.5.2-r1 | 3.24.4 | LTS (2028-*) |
|
||||
| 9.0.3 | :white_check_mark: | >= 3.5.1-r0 | 3.24.3 | LTS (2028-*) |
|
||||
| 9.0.3 | :white_check_mark: | >= 3.5.1-r0 | 3.24.3 | LTS (Jan, 8th 2028) |
|
||||
| 9.0.2 | :white_check_mark: | >= 3.5.1-r0 | 3.24.2 | LTS (Jan, 8th 2028) |
|
||||
| 9.0.1 | :white_check_mark: | >= 3.5.0-r0 | 3.24.1 | LTS (Jan, 8th 2028) |
|
||||
| 9.0.0 | :white_check_mark: | >= 3.4.3-r1 | 3.24.1 | LTS (Jan, 8th 2028) |
|
||||
| (``v8``) 8.0.5 | :white_check_mark: | >= 3.4.1-r1 | 3.23.4 | ESU (Apr, 1st 2027) |
|
||||
| 8.0.4 | :warning: DEPRECATED | >= 3.4.1-r1 | 3.23.3 | Dec, 6th 2026 |
|
||||
| 8.0.3 | :warning: DEPRECATED | >= 3.4.1-r1 | 3.23.2 | Dec, 6th 2026 |
|
||||
| 8.0.2 | :warning: DEPRECATED | >= 3.4.1-r1 | 3.23.0 | Dec, 6th 2026 |
|
||||
| (``v8``) 8.0.5 | ⚠️ ESU | >= 3.4.1-r1 | 3.23.4 | Apr, 1st 2027 ([esu notice](https://github.com/Burnett01/rsync-deployments/discussions/120)) |
|
||||
| 8.0.4 | :warning: DEPRECATED | >= 3.4.1-r1 | 3.23.3 | Dec, 6th 2026 ([eol notice](https://github.com/Burnett01/rsync-deployments/discussions/120)) |
|
||||
| 8.0.3 | :warning: DEPRECATED | >= 3.4.1-r1 | 3.23.2 | Dec, 6th 2026 ([eol notice](https://github.com/Burnett01/rsync-deployments/discussions/120)) |
|
||||
| 8.0.2 | :warning: DEPRECATED | >= 3.4.1-r1 | 3.23.0 | Dec, 6th 2026 ([eol notice](https://github.com/Burnett01/rsync-deployments/discussions/120)) |
|
||||
| 8.0.1 | :x: EOL | >= 3.4.1-r1 | 3.23.0 | † Apr, 1st 2026 |
|
||||
| 8.0.0 | :x: EOL (due to regression #90) | >= 3.4.1-r1 | 3.23.0 | † Dec, 6th 2025 |
|
||||
| 7.1.0 | :x: EOL | >= 3.4.1-r0 | 3.22.1 | † June, 1st 2026 ([deprecation notice](https://github.com/Burnett01/rsync-deployments/discussions/96)) |
|
||||
| 7.0.2 | :x: EOL | >= 3.4.0-r0 | 3.22.1 | † June, 1st 2026 ([deprecation notice](https://github.com/Burnett01/rsync-deployments/discussions/96)) |
|
||||
| 7.1.0 | :x: EOL | >= 3.4.1-r0 | 3.22.1 | † June, 1st 2026 ([eol notice](https://github.com/Burnett01/rsync-deployments/discussions/96)) |
|
||||
| 7.0.2 | :x: EOL | >= 3.4.0-r0 | 3.22.1 | † June, 1st 2026 ([eol notice](https://github.com/Burnett01/rsync-deployments/discussions/96)) |
|
||||
| 7.0.1 | :x: EOL | < 3.4.0 | 3.22.1 | † Dec, 6th 2025 |
|
||||
| 7.0.0 | :x: EOL | < 3.4.0| 3.19.1 | † Dec, 6th 2025 |
|
||||
| 6.x | :x: EOL |< 3.4.0| 3.17.2 | † 2024 |
|
||||
@@ -36,6 +38,37 @@ EOL = End of life (no support/no updates)
|
||||
|
||||
DEPRECATED = Close to EOL (support/no updates)
|
||||
|
||||
ESU = Close to DEPRECATED (support/updates)
|
||||
|
||||
## Release cycles
|
||||
|
||||
Our aim is to follow the [Alpine Linux release cycles](https://alpinelinux.org/releases/).
|
||||
|
||||
Whenever a new Alpine version is released, we will release a new action version.
|
||||
|
||||
You can indicate the Alpine minor-version in our major-version number:
|
||||
|
||||
| Alpine Version | Action Version |
|
||||
| ------- | ------------------ |
|
||||
| 3.**24**.4 | **9**.0.4 |
|
||||
| 3.**24**.3 | **9**.0.3 |
|
||||
|
||||
You can indicate the Alpine patch-version in our patch-version number:
|
||||
|
||||
| Alpine Version | Action Version |
|
||||
| ------- | ------------------ |
|
||||
| 3.24.**4** | 9.0.**4** |
|
||||
| 3.24.**3** | 9.0.**3** |
|
||||
|
||||
If we release an OOB patch for a specific package update, our minor-version number increases:
|
||||
|
||||
| Alpine Version | Action Version |
|
||||
| ------- | ------------------ |
|
||||
| 3.24.4 | 9.**1**.4 |
|
||||
| 3.24.3 | 9.**2**.3 |
|
||||
|
||||
**Note:** This is subject to change because we want to align our versioning with Alpines versioning.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
You can report a vulnerability by creating an issue.
|
||||
|
||||
+9
-1
@@ -13,8 +13,12 @@ inputs:
|
||||
description: 'Enables support for legacy RSA host keys on OpenSSH 8.8+'
|
||||
required: false
|
||||
default: 'false'
|
||||
known_hosts:
|
||||
description: 'Enables strict host keys checking against the hostkey you set.'
|
||||
required: false
|
||||
default: ''
|
||||
strict_hostkeys_checking:
|
||||
description: 'Controls strict host keys checking'
|
||||
description: 'DEPRECATED: Controls strict host keys checking'
|
||||
required: false
|
||||
default: 'false'
|
||||
path:
|
||||
@@ -45,6 +49,10 @@ inputs:
|
||||
description: 'Debug the action'
|
||||
required: false
|
||||
default: 'false'
|
||||
log_level:
|
||||
description: 'The log-level that is used in the rsh-switch'
|
||||
required: false
|
||||
default: 'ERROR'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
|
||||
+33
-3
@@ -2,8 +2,11 @@
|
||||
|
||||
set -eu
|
||||
|
||||
LOG_LEVEL="${INPUT_LOGLEVEL:-ERROR}"
|
||||
|
||||
if [ "${INPUT_DEBUG:-false}" = "true" ]; then
|
||||
set -x
|
||||
LOG_LEVEL=""
|
||||
fi
|
||||
|
||||
if [ -z "$(echo "$INPUT_REMOTE_PATH" | awk '{$1=$1};1')" ]; then
|
||||
@@ -26,7 +29,11 @@ if [ "${INPUT_LEGACY_ALLOW_RSA_HOSTKEYS:-false}" = "true" ]; then
|
||||
fi
|
||||
|
||||
STRICT_HOSTKEYS_CHECKING="-o StrictHostKeyChecking=no"
|
||||
if [ "${INPUT_STRICT_HOSTKEYS_CHECKING:-false}" = "true" ]; then
|
||||
# If no 'known_hosts' input is provided and 'strict_hostkeys_checking: true',
|
||||
# then use exisiting keyscan functionality. DEPRECATED: Will be no-op in next major.
|
||||
if [[ -z "${INPUT_KNOWN_HOSTS:-}" && "${INPUT_STRICT_HOSTKEYS_CHECKING:-false}" = "true" ]]; then
|
||||
echo "::warning title=DEPRECATION::Input 'strict_hostkeys_checking' will be a no-op in the next major version! Use 'known_hosts'."
|
||||
|
||||
STRICT_HOSTKEYS_CHECKING="-o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes"
|
||||
|
||||
key="$(ssh-keyscan -p "$INPUT_REMOTE_PORT" "$INPUT_REMOTE_HOST" 2>/dev/null | sed '/^#/d')" || key=""
|
||||
@@ -36,12 +43,35 @@ if [ "${INPUT_STRICT_HOSTKEYS_CHECKING:-false}" = "true" ]; then
|
||||
# add to known hosts
|
||||
echo "$key" | while IFS= read -r line; do hosts-add "$line"; done
|
||||
else
|
||||
echo "Warning: failed to fetch host key for $INPUT_REMOTE_HOST" >&2
|
||||
echo "Warning: failed to fetch host key for remote host" >&2
|
||||
exit 1
|
||||
fi
|
||||
# If 'known_hosts' is provided, strict hostkeys checking is auto enforced:
|
||||
elif [ -n "${INPUT_KNOWN_HOSTS:-}" ]; then
|
||||
STRICT_HOSTKEYS_CHECKING="-o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes"
|
||||
|
||||
if [ "$INPUT_REMOTE_PORT" = "22" ]; then
|
||||
host_pattern="$INPUT_REMOTE_HOST"
|
||||
else
|
||||
host_pattern="[$INPUT_REMOTE_HOST]:$INPUT_REMOTE_PORT"
|
||||
fi
|
||||
|
||||
printf '%s\n' "$INPUT_KNOWN_HOSTS" | tr -d '\r' | while IFS= read -r line; do
|
||||
line="$(echo "$line" | awk '{$1=$1};1')"
|
||||
case "$line" in
|
||||
''|'#'*) continue ;;
|
||||
ssh-*|ecdsa-*|sk-*) hosts-add "$host_pattern $line" ;;
|
||||
*) hosts-add "$line" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! ssh-keygen -lf "$HOME/.ssh/known_hosts" >/dev/null 2>&1; then
|
||||
echo "Error: Input 'known_hosts' contains no valid host key" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
RSH="ssh $STRICT_HOSTKEYS_CHECKING $LEGACY_RSA_HOSTKEYS -p $INPUT_REMOTE_PORT $INPUT_RSH"
|
||||
RSH="ssh $LOG_LEVEL $STRICT_HOSTKEYS_CHECKING $LEGACY_RSA_HOSTKEYS -p $INPUT_REMOTE_PORT $INPUT_RSH"
|
||||
LOCAL_PATH="$GITHUB_WORKSPACE/$INPUT_PATH"
|
||||
DSN="$INPUT_REMOTE_USER@$INPUT_REMOTE_HOST"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user