Compare commits

...

5 Commits

Author SHA1 Message Date
Steven 0c902521b8 Release/8.0.2 (#93)
* fix: only attempt to create dir if not yet exists

On self-hosted runners it can happen that an action (docker container) is cached. This leads to the script trying to create the .ssh dir despite it already existing. The action then fails.

* fix: only attempt to create file if it doesn't exist yet

On self-hosted runners it can happen that an action (docker container) is cached, resulting in aborting this script because the know_hosts file already exists. 
This if clause fixes it.
Setting permissions is intentionally outside the if clause because in all cases we want to reset perms.

* fix: reverting printf in favor of echo

Like in commit 2c22263 we are using echo again instead of printf because some runners can't function properly with it.

* chore: 8.0.2

* chore: readme changes
2025-12-07 12:59:02 +01:00
Steven 68d1fd5150 chore: 8.0.1 2025-12-06 21:44:40 +00:00
Steven 2c22263f9c fix: regression - using echo instead of printf again #90
It was found via #90 and #89 that using printf causes problems.
In the previous version 7.1.0 we used echo instead of printf - hence we are bringing this back for version 8.0.x
2025-12-06 22:33:01 +01:00
Steven 8a39558686 feat: add README for SSH agent and known_hosts management scripts 2025-12-06 19:19:48 +00:00
Steven 0f1cb7924d fix: permissions of docker-rsync scripts 2025-12-06 19:19:26 +00:00
8 changed files with 61 additions and 8 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ RUN apk update && apk add --no-cache --upgrade rsync openssh openssl busybox
RUN rm -rf /var/cache/apk/*
COPY docker-rsync/* /bin/
RUN chmod +x /bin/agent-*
RUN chmod +x /bin/agent-* /bin/ssh-* /bin/hosts-*
FROM base AS build
+8 -2
View File
@@ -53,14 +53,14 @@ This action needs secret variables for the ssh private key of your key pair. The
For simplicity, we are using `REMOTE_*` as the secret variables throughout the examples.
## Current Version: v8 (8.0.0)
## Current Version: v8 (8.0.2)
### Release channels:
| Version | Purpose | Immutable |
| ------- | ------------------ | ------------------ |
| ``v8`` | latest release (pointer to 8.x.x) | no, points to latest MINOR,PATCH |
| 8.0.0 | latest major release | yes |
| 8.0.2 | latest major release | yes |
| 7.1.0 | previous release | yes |
Check [SECURITY.md](SECURITY.md) for support cycles.
@@ -277,6 +277,12 @@ sudo apk add rsync
## Versions
## Version 8.0.0 (EOL due to regression -> fixed via 8.0.1 & 8.0.2)
Check here:
- https://github.com/Burnett01/rsync-deployments/tree/8.0.0 (alpine 3.23.0)
## Version 7.1.0
Check here:
+3 -1
View File
@@ -8,7 +8,9 @@ The following versions are currently being supported with security updates:
| Version | Supported | Rsync version | Alpine version |
| ------- | ------------------ | ------------------ | ------------------ |
| 8.0.0 | :white_check_mark: | >= 3.4.1-r1 | 3.23.0 |
| 8.0.2 | :white_check_mark: | >= 3.4.1-r1 | 3.23.0 |
| 8.0.1 | :white_check_mark: | >= 3.4.1-r1 | 3.23.0 |
| 8.0.0 | :x: EOL (due to regression #90) | >= 3.4.1-r1 | 3.23.0 |
| 7.1.0 | :white_check_mark: | >= 3.4.1-r0 | 3.22.1 |
| 7.0.2 | :warning: DEPRECATED | >= 3.4.0-r0 | 3.22.1 |
| 7.0.1 | :x: EOL | < 3.4.0 | 3.22.1 |
+40
View File
@@ -0,0 +1,40 @@
# Scripts
Shell-scripts to help with managing SSH agents and known hosts files.
### SSH Management
#### ssh-init
This command create the ``$HOME/.ssh`` folder with default permissions ``700``.
### SSH-Agent Management
#### agent-start
This command starts the SSH agent, if it isn't already started (SSH_AGENT_PID set or ssh agent ID file found).
It takes one optional argument, for the name of the agent to be started. Defaults to "default".
This program needs to be source'd to work correctly.
`source agent-start "default"`
#### agent-stop
This command stops the SSH agent, if it is started (SSH_AGENT_PID set or ssh agent ID file found).
It takes one optional argument, for the name of the agent to be stopped. Defaults to "default".
`agent-stop "my-agent-name"`
#### agent-add
This command adds a key to the currently running SSH agent. The key is taken from stdin, and the agent used is that in SSH_AGENT_PID.
#### agent-askpass
This command is called by ssh-add when the [SSH_ASKPASS](https://man.openbsd.org/ssh-add.1#ENVIRONMENT) variable is set active. The command returns the SSH_PASS to [ssh-askpass(1)](https://man.openbsd.org/ssh-askpass.1).
This command is ignored by ssh-add if the key does not require a passphrase.
### known_hosts management
#### hosts-init
This command creates the known_hosts file (``$HOME/.ssh/known_hosts``) with default permission ``600``.
#### hosts-add
This command adds an entry to the known hosts file, and ensures its permissions are correct. It takes one argument, which is the new key to add.
#### hosts-clear
This command truncates the known_hosts file.
+1 -1
View File
@@ -2,4 +2,4 @@
set -eu
printf '%s\n' "$@" >> $HOME/.ssh/known_hosts
echo "$@" >> $HOME/.ssh/known_hosts
+4 -1
View File
@@ -2,5 +2,8 @@
set -eu
touch $HOME/.ssh/known_hosts
if [ ! -f "$HOME/.ssh/known_hosts" ]; then
touch $HOME/.ssh/known_hosts
fi
chmod 600 $HOME/.ssh/known_hosts
+3 -1
View File
@@ -2,4 +2,6 @@
set -eu
mkdir -m 700 $HOME/.ssh
if [ ! -d "$HOME/.ssh" ]; then
mkdir -m 700 $HOME/.ssh
fi
+1 -1
View File
@@ -17,7 +17,7 @@ source hosts-init
# Start the SSH agent and load key.
source agent-start "$GITHUB_ACTION"
printf '%s' "$INPUT_REMOTE_KEY" | SSH_PASS="${INPUT_REMOTE_KEY_PASS}" agent-add >/dev/null 2>&1
echo "$INPUT_REMOTE_KEY" | SSH_PASS="$INPUT_REMOTE_KEY_PASS" agent-add
# Variables.
LEGACY_RSA_HOSTKEYS=""