__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#!/bin/sh
# Script to be run before package is installed / upgraded
SYSTEMD_CAT="`which systemd-cat 2>/dev/null || true`"
print_error() {
errorstr="ESET Server Security Error: $1"
echo "$errorstr" 1>&2
if [ -n "$SYSTEMD_CAT" ]; then
echo -n "$errorstr" | $SYSTEMD_CAT -t "efs" -p err
fi
}
# Check for previous EFS product
if [ -d "/opt/eset/esets/" ] && /opt/eset/esets/sbin/esets_lic --list-fmt='%pname%\n' | grep -q ESETFS; then
print_error 'Previous ESET Security product v4.5 with EFS license found. New EFS product is not compatible with the old one.'
if [ "$1" != "upgrade" ]; then
# Fail installation except on deb upgrade, where this would leave product in inconsistent state
exit 1
fi
fi
# Check for UTF-8 support
if ! localectl list-locales | grep -E -i "UTF-?8" 1>/dev/null 2>&1; then
print_error "UTF-8 locale is not present, please install it."
if [ "$1" != "upgrade" ]; then
# Fail installation except on deb upgrade, where this would leave product in inconsistent state
exit 1
fi
fi
# Check if eset paths exists, and change access rights accordingly
# Some rhel hardened installations with eraagent installed before installing security product had problems with permissions.
chmod 0755 "/opt/" 1>/dev/null 2>&1 || true
chmod 0755 "/var/" 1>/dev/null 2>&1 || true
chmod 0755 "/var/log/" 1>/dev/null 2>&1 || true
chmod 0755 "/var/opt/" 1>/dev/null 2>&1 || true
chmod 0755 "/etc/" 1>/dev/null 2>&1 || true
chmod 0755 "/etc/opt/" 1>/dev/null 2>&1 || true
if [ -d "/opt/eset/" ]; then
chmod 0755 "/opt/eset/" 1>/dev/null 2>&1 || true
fi
if [ -d "/var/log/eset/" ]; then
chmod 0755 "/var/log/eset/" 1>/dev/null 2>&1 || true
fi
if [ -d "/var/opt/eset/" ]; then
chmod 0755 "/var/opt/eset/" 1>/dev/null 2>&1 || true
fi
if [ -d "/etc/opt/eset/" ]; then
chmod 0755 "/etc/opt/eset/" 1>/dev/null 2>&1 || true
fi
if [ -d "/opt/eset/RemoteAdministrator/Agent/" ]; then
chmod 0755 "/opt/eset/RemoteAdministrator/" 1>/dev/null 2>&1 || true
chmod 0755 "/opt/eset/RemoteAdministrator/Agent/" 1>/dev/null 2>&1 || true
fi
################################## New install ##################################
# Check if selinux policy is present
if [ "$1" = "install" ] || [ "$1" = "1" ]; then
if selinuxenabled > /dev/null 2>&1; then
if semodule -l | grep '^eset_efs\>' > /dev/null 2>&1; then
print_error "selinux policy eset_efs is present, remove it with \"semodule -r eset_efs\". Package won't be installed."
exit 1
fi
fi
fi
#################################### Upgrade ####################################
if [ "$1" = "upgrade" ] || [ "$1" = "2" ]; then
# stop service
if systemctl --version >/dev/null 2>/dev/null; then
systemctl stop efs 2>/dev/null || true
else
service efs stop 2>/dev/null || true
fi
#try to disable selinux policy
if selinuxenabled > /dev/null 2>&1; then
if semodule -l | grep '^eset_efs\>' > /dev/null 2>&1; then
if ! semodule -d eset_efs; then
print_error "selinux policy eset_efs is used by another policy, try to remove it with \"semodule -r eset_efs\". Package won't be upgraded."
exit 1
fi
#enable back selinux policy
semodule -e eset_efs > /dev/null 2>&1 || true
fi
fi
# stop and unregister old product
/opt/eset/efs/lib/install_scripts/unregister_service.sh
# convert product license file name to newer format
if [ -f /var/opt/eset/efs/licensed/license.lf ]; then
mv /var/opt/eset/efs/licensed/license.lf /var/opt/eset/efs/licensed/license_309.lf
fi
if [ -f /var/opt/eset/efs/licensed/license_cfg.json ]; then
mv /var/opt/eset/efs/licensed/license_cfg.json /var/opt/eset/efs/licensed/license_cfg_309.json
fi
# convert product license file names to the even newer, name-based format
for code_stem in 323_edtd 322_eei 341_vapm 10000_plg; do
code="$(echo "$code_stem" | cut -d'_' -f1)"
stem="$(echo "$code_stem" | cut -d'_' -f2)"
if [ -f "/var/opt/eset/efs/licensed/license_${code}.lf" ]; then
mv "/var/opt/eset/efs/licensed/license_${code}.lf" "/var/opt/eset/efs/licensed/license_${stem}.lf"
fi
if [ -f "/var/opt/eset/efs/licensed/license_cfg_${code}.json" ]; then
mv "/var/opt/eset/efs/licensed/license_cfg_${code}.json" "/var/opt/eset/efs/licensed/license_cfg_${stem}.json"
fi
done
if [ -f '/var/opt/eset/efs/licensed/license_309.lf' ]; then
mv '/var/opt/eset/efs/licensed/license_309.lf' '/var/opt/eset/efs/licensed/license_product.lf'
fi
if [ -f '/var/opt/eset/efs/licensed/license_cfg_309.json' ]; then
mv '/var/opt/eset/efs/licensed/license_cfg_309.json' '/var/opt/eset/efs/licensed/license_cfg_product.json'
fi
fi