From e0e6800c3ce3071eb0a7228468c5b59db4eabcab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 28 May 2019 13:59:01 +0200 Subject: [PATCH] Prefix sudoers related to backuppc with BACKUP_ --- client/fix_backuppc_linux_sudo.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/fix_backuppc_linux_sudo.sh b/client/fix_backuppc_linux_sudo.sh index 7ba411b..4984580 100755 --- a/client/fix_backuppc_linux_sudo.sh +++ b/client/fix_backuppc_linux_sudo.sh @@ -11,10 +11,10 @@ DEBUG=1 USER_ID=$(id -u) BACKUP_USER_LOGIN="backup" -SUDOERS_LINE_REGEXP="backuppc.*ALL.*=.*(ALL:ALL).*NOEXEC:NOPASSWD:.*/usr/bin/rsync" -SUDOERS_LINE="backup ALL=(ALL:ALL) NOEXEC:NOPASSWD: /usr/bin/rsync +BACKUP_SUDOERS_LINE_REGEXP="backuppc.*ALL.*=.*(ALL:ALL).*NOEXEC:NOPASSWD:.*/usr/bin/rsync" +BACKUP_SUDOERS_LINE="backup ALL=(ALL:ALL) NOEXEC:NOPASSWD: /usr/bin/rsync backuppc ALL=(ALL:ALL) NOEXEC:NOPASSWD: /usr/bin/rsync" -SUDOERS_FILE="/etc/sudoers.d/backuppc_noexec" +BACKUP_SUDOERS_FILE="/etc/sudoers.d/backuppc_noexec" # ]]] # Functions [[[ @@ -78,16 +78,16 @@ fi is_user "${BACKUP_USER_LOGIN}" # Test if sudoers conf is already set -if ! is_sudoers_line "${SUDOERS_LINE_REGEXP}" +if ! is_sudoers_line "${BACKUP_SUDOERS_LINE_REGEXP}" then - [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : First try — ${SUDOERS_LINE_REGEXP} was not found in sudo configuration." + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : First try — ${BACKUP_SUDOERS_LINE_REGEXP} was not found in sudo configuration." ## Add sudoers configuration - add_sudoers_conf "${SUDOERS_LINE}" "${SUDOERS_FILE}" + add_sudoers_conf "${BACKUP_SUDOERS_LINE}" "${BACKUP_SUDOERS_FILE}" ## Test if sudoers conf was successfully modified - if ! is_sudoers_line "${SUDOERS_LINE_REGEXP}" + if ! is_sudoers_line "${BACKUP_SUDOERS_LINE_REGEXP}" then - [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Second try — ${SUDOERS_LINE_REGEXP} was not found in sudo configuration." + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Second try — ${BACKUP_SUDOERS_LINE_REGEXP} was not found in sudo configuration." printf '\e[1;31m%-6s\e[m\n' "ERROR : The sudo configuration was not successfully modified." printf '\e[1;31m%-6s\e[m\n' "ERROR : Please contact your administrator." exit "${ERROR}"