Skip to content

Commit

Permalink
consolidating repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
vpapakir committed Jul 27, 2024
1 parent 3977932 commit af7bb7f
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
23 changes: 23 additions & 0 deletions db/mariadb/ubuntu/01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

## Software maintenance
apt-get -y install vim htop nmap nload mariadb-server iotop mariadb-client samba cifs-utils
apt-get upgrade
#######################

## Mount external disks
mkdir -pv /mnt/backup
IS_MOUNTED=$(cat /etc/fstab | grep ${CIFS_USERNAME} | wc -l)
if [[ ${IS_MOUNTED} -lt 1 ]]; then
echo "//136.243.27.235/backup/${HOME_SITE} /mnt/backup cifs username=${CIFS_USERNAME},password=${CIFS_PASSWORD},uid=www-data,gid=www-data,rw,cache=loose,file_mode=0600,dir_mode=0777,vers=3.0 0 0" >> /etc/fstab
else
echo "[INFO] backup is already mounted"
fi
mount -a -v
df -h
#######################

## Backup database
tstamp=$(date +'%s')
mysqldump -h localhost -u root -p${MYSQL_PASSWORD} dn1 > /mnt/backup/dn1.${tstamp}.sql
#######################
47 changes: 47 additions & 0 deletions security/01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

cd /root/php-malware-scanner

git config pull.rebase false

git pull

./scan -E \
--base64 \
-d /var/www/ \
-s \
-a \
-x \
-b \
-n \
-k \
-c \
-t

find ${WEB_PATH} -type f -name '*.php' ! -name "scss.inc.php" | xargs grep -l " *@include *" | xargs -I {} mv -v {} /root/dev/attacks/
find ${WEB_PATH} -type f -name "*.*.ico*" ! -name "Litespeed*" | xargs -I {} mv -v {} /root/dev/attacks/

index_php_size=$(stat ${WEB_PATH}index.php | grep Size | awk '{print $2}')
wp_settings_php_size=$(stat ${WEB_PATH}wp-settings.php | grep Size | awk '{print $2}')
wp_config_php_size=$(stat ${WEB_PATH}wp-config.php | grep Size | awk '{print $2}')

if [[ ${index_php_size} -ne 405 ]]; then
rm -v ${WEB_PATH}index.php
cp -v /root/index.php.healthy ${WEB_PATH}index.php
else
echo "[INFO] index.php is ok"
fi

if [[ ${wp_settings_php_size} -ne 22297 ]]; then
rm -v ${WEB_PATH}wp-settings.php
cp -v /root/wp-settings.php.healthy ${WEB_PATH}wp-settings.php
else
echo "[INFO] wp-settings.php is ok"
fi

if [[ ${wp_config_php_size} -ne 3593 ]]; then
rm -v ${WEB_PATH}wp-config.php
cp -v /root/wp-config.php.healthy ${WEB_PATH}wp-config.php
else
echo "[INFO] wp-config.php is ok"
fi

0 comments on commit af7bb7f

Please sign in to comment.