To remove GuardMode Agent from your SAMBA setup, paste the script below into your terminal:
remove_full_audit_from_shares(){FILE="${1}"STRING="vfs\s*objects\s*=\s*full_audit"ifgrep-q"${STRING}""${FILE}"&>/dev/null ;thensed-i":a;N;\$!ba;s#\n\s*${STRING}[^\n]*\n##g""${FILE}"sed-i"\#${STRING}#d"/etc/samba/smb.conffi}restore_smb_audit_conf(){remove_full_audit_from_shares"/etc/samba/smb.conf"xIFS=$IFS;IFS=$'\n'forINCLUDED_FILEin$(grep"^\s*include\s*="/etc/samba/smb.conf|cut-d=-f2|grep-o"^\s*\S*"|grep-v\"|grep-v\'|grep-v\\\\|-tr-d"[:blank:]")doremove_full_audit_from_shares"${INCLUDED_FILE}";doneforINCLUDED_FILEin$(grep"^\s*include\s*="/etc/samba/smb.conf|cut-d=-f2|grep-oP"^\s*\".*?\""|grep-o"\".*\""|tr-d'"')doremove_full_audit_from_shares"${INCLUDED_FILE}";doneforINCLUDED_FILEin$(grep"^\s*include\s*="/etc/samba/smb.conf|cut-d=-f2|grep-oP"^\s*'.*?'"|grep-o"'.*'"|tr-d"'")doremove_full_audit_from_shares"${INCLUDED_FILE}";doneIFS=$xIFSSTRING="include\s*=\s*/etc/samba/catalogic\.audit\.conf"ifgrep-q"${STRING}"/etc/samba/smb.conf&>/dev/null ;thensed-i":a;N;\$!ba;s#\n\s*${STRING}[^\n]*\n##g"/etc/samba/smb.confsed-i"\#${STRING}#d"/etc/samba/smb.conffirm-rf/etc/samba/catalogic.audit.conf}restore_smb_audit_confrm-rf/etc/systemd/journald.conf.d/99-catalogic.confrsyslog_selectors_info(){localCURRENT_SELECTOR="${1}"localORIGINAL_SELECTOR="${2}"localFILE="${3}"echoecho-e"The selector \"${CURRENT_SELECTOR}\" has been found in \"${FILE}\" file."echo-e"Possibly the result of a swap from the selector \"${ORIGINAL_SELECTOR}\" during configuration."echo-e"It can now be manually swapped back to the original selector \"${ORIGINAL_SELECTOR}\"."}check_rsyslog_selectors(){localFILE="${1}"localFOUND=falseifgrep-q"local5\.info""${FILE}"&>/dev/null ;thenrsyslog_selectors_info"local5.info""local5.debug""${FILE}";FOUND=truefiifgrep-q"local5\.\*;local5\.!=debug""${FILE}"&>/dev/null ;thenrsyslog_selectors_info"local5.*;local5.!=debug""local5.*""${FILE}";FOUND=truefiifgrep-q"\*\.\*;local5\.!=debug""${FILE}"&>/dev/null ;thenrsyslog_selectors_info"*.*;local5.!=debug""*.*""${FILE}";FOUND=truefiif"${FOUND}";thenechoecho"If you do not use rsyslog selectors for a specific purpose,"echo"you can either leave the file/files unchanged or restore it/them to its/their original state."fi}restore_rsyslog_conf(){STRING='$IncludeConfig /etc/rsyslog.d/catalogic.cfg'ifgrep-q"${STRING}""/etc/rsyslog.conf"&>/dev/null ;thensed-i":a;N;\$!ba;s#\n[^ \t]*\n[^ \t]*${STRING}#\n${STRING}#g""/etc/rsyslog.conf"sed-i":a;N;\$!ba;s#${STRING}[^ \t]*\n[^ \t]*\n#${STRING}\n#g""/etc/rsyslog.conf"sed-i":a;N;\$!ba;s#${STRING}\n[^ \t]*\$#${STRING}#""/etc/rsyslog.conf"sed-i"\#${STRING}#d""/etc/rsyslog.conf"firm-rf/etc/rsyslog.d/catalogic.cfgcheck_rsyslog_selectors"/etc/rsyslog.conf"forCONF_FILEin/etc/rsyslog.d/*.conf;doif[-s"${CONF_FILE}"];thencheck_rsyslog_selectors"${CONF_FILE}"fidone}set_selinux()#RED HAT 7yuminstallpolicycoreutils-python#RED HAT 8, 9yuminstallpolicycoreutils-python-utilssemanageport-d-tsyslogd_port_t-ptcp65432#Optional:#RED HAT 7yumremovepolicycoreutils-python#Optional:#RED HAT 8, 9yumremovepolicycoreutils-python-utilssystemctlrestartsmbsystemctlrestartsystemd-journaldsystemctlrestartrsyslog/opt/catalogic/guard-mode/agent/Catalogic.GuardMode.Agentconfigupdatesmb--enabledFalsesystemctlrestartCatalogic.GuardMode.Agent