diff --git a/agent/bin/datasid-netmon.sh b/agent/bin/datasid-netmon.sh index d29c1abb86ca3a607ccd74a197719bc034dc216c..e0c31389dcfc99cf7477453ed0946e22c1bd3590 100755 --- a/agent/bin/datasid-netmon.sh +++ b/agent/bin/datasid-netmon.sh @@ -81,11 +81,6 @@ if test -z "${PREFIX}"; then exit 2 fi -# If the user is not in the sudoers(1) -if ! sudo -v &> /dev/null; then - exit 0 -fi - cd ${DATADIR} # Collected data from the current day @@ -105,7 +100,7 @@ IPTABLES=$(which iptables) test $? -ne 0 && IPTABLES="/sbin/iptables" test -x $IP || exit 1 -test -x $IPTABLES || exit 1 +test -x $IPTABLES || (IPTABLES="/usr/sbin/iptables" && test -x $IPTABLES) || exit 1 #------------------------------------------------------------------------------ diff --git a/agent/bootstrap/install b/agent/bootstrap/install index c25d256611048fa24ed456331e58ba33275c9aa9..17e4da90a1f8bf151df4254201f4a5fd80fcbd23 100644 --- a/agent/bootstrap/install +++ b/agent/bootstrap/install @@ -196,11 +196,16 @@ printf "Adquirindo permissões nescessárias... " >&3 # Remove any possible line containing a rule for datasid user before adding # root permissions in the sudoers file TMPFILE=$(mktemp) -sed '/^datasid/d' /etc/sudoers > "${TMPFILE}" +sed '/^\(Defaults:\)\?datasid/d' /etc/sudoers > "${TMPFILE}" # Add root permissions to datasid echo -e "datasid\tALL=(ALL) NOPASSWD: ALL" >> "${TMPFILE}" +# Remove on Fedora the requirement of tty for sudo +if grep -q "Fedora" /etc/issue; then + echo -e 'Defaults:datasid\t!requiretty' >> "${TMPFILE}" +fi + # Check if modified sudoers file is valid and apply it if ! visudo -cf "${TMPFILE}" || ! mv "${TMPFILE}" /etc/sudoers \ || ! chmod 440 /etc/sudoers; then