Skip to content

Commit 00681eb

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: willjay <723386252@qq.com>
1 parent f4aeec6 commit 00681eb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

net/keepalived/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
99

1010
PKG_NAME:=keepalived
1111
PKG_VERSION:=2.3.1
12-
PKG_RELEASE:=1
12+
PKG_RELEASE:=2
1313

1414
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
1515
PKG_SOURCE_URL:=https://www.keepalived.org/software
@@ -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)