mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-20 20:40:08 -08:00
70 lines
1.8 KiB
Bash
70 lines
1.8 KiB
Bash
#!/bin/bash
|
|
# info: Unlock previously locked WordPress files if they were potentially infected (somewhere) by PHP malware
|
|
# options: DOMAIN
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
whoami=$(whoami)
|
|
if [ "$whoami" != "root" ]; then
|
|
echo "You must be root to execute this script"
|
|
exit 1
|
|
fi
|
|
|
|
# Importing system environment
|
|
source /etc/profile
|
|
|
|
# Argument definition
|
|
domain=$1
|
|
|
|
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
|
|
USER=$user
|
|
|
|
# Includes
|
|
source /usr/local/vesta/func/main.sh
|
|
|
|
if [ -z "$user" ]; then
|
|
check_result $E_NOTEXIST "domain $domain doesn't exist"
|
|
fi
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '1' "$#" 'DOMAIN'
|
|
is_format_valid 'domain'
|
|
is_object_valid 'user' 'USER' "$user"
|
|
is_object_unsuspended 'user' 'USER' "$user"
|
|
|
|
if [ ! -d "/home/$user" ]; then
|
|
echo "User doesn't exist";
|
|
exit 1;
|
|
fi
|
|
|
|
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
|
|
echo "Domain doesn't exist";
|
|
exit 1;
|
|
fi
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
cd /home/$user/web/$domain
|
|
|
|
# lock files
|
|
chown -R $user:$user public_html/
|
|
|
|
rm public_html/wp-content/uploads/.htaccess
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
echo "v-unlock-wordpress: Done."
|
|
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|