Skip to content

Commit 0a6fa13

Browse files
committed
keepalived-sync: fix mkdir permission denied in rsync.sh
The rsync.sh script uses sudo for rsync but not for mkdir. After the first sync, rsync -a preserves root ownership on directories under the sync target. Subsequent syncs fail at the mkdir step because the keepalived user cannot create subdirectories inside root-owned directories. Add sudo to the mkdir command to match the existing sudo rsync usage. Also update the sudoers configuration in the postinst script to permit /bin/mkdir in addition to /usr/bin/rsync. Fixes: #28565 Signed-off-by: willjayyyy <willjayyyy@users.noreply.github.com>
1 parent f4aeec6 commit 0a6fa13

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

net/keepalived/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ mkdir -m 700 -p "$(USER_HOME)/.ssh"
350350
chown "$(USER)":"$(USER)" "$(USER_HOME)" -R
351351

352352
[ ! -d "$(SUDO_DIR)" ] && mkdir "$(SUDO_DIR)"
353-
echo "$(USER) ALL= NOPASSWD:/usr/bin/rsync" > "$(SUDO_FILE)"
353+
echo "$(USER) ALL= NOPASSWD:/usr/bin/rsync,/bin/mkdir" > "$(SUDO_FILE)"
354354
EOF
355355

356356
[ -z "$${IPKG_INSTROOT}" ] && [ -f "$${DEFAULT_SCRIPT}" ] && sh "$${DEFAULT_SCRIPT}"

net/keepalived/files/usr/share/keepalived/scripts/rsync.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ha_sync_send() {
5656
ssh_remote="$RSYNC_USER@$address"
5757

5858
# shellcheck disable=SC2086
59-
timeout 10 ssh $ssh_options $ssh_remote mkdir -m 755 -p "$dirs_list /tmp" || {
59+
timeout 10 ssh $ssh_options $ssh_remote sudo mkdir -m 755 -p "$dirs_list /tmp" || {
6060
log_err "can not connect to $address. check key or connection"
6161
update_last_sync_time "$cfg"
6262
update_last_sync_status "$cfg" "SSH Connection Failed"

0 commit comments

Comments
 (0)