Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consolidating repositories #15

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading