2021-04-14 12:10:42 -07:00
|
|
|
#!/bin/bash
|
2022-08-22 14:01:24 -07:00
|
|
|
#
|
|
|
|
# wordpress-tools
|
|
|
|
# https://git.stack-source.com/msb/wordpress-tools
|
|
|
|
# Copyright (c) 2022 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>\
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
2021-04-14 12:10:42 -07:00
|
|
|
|
|
|
|
if [ "${EUID}" -ne 0 ]; then
|
|
|
|
echo "You must be root to run this installer."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# download & install wp-cli
|
|
|
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
|
|
sudo mv wp-cli.phar /usr/local/bin/wp
|
|
|
|
chmod +x /usr/local/bin/wp
|
|
|
|
|
|
|
|
# configure wp-cli bash completion
|
2022-11-16 15:01:35 -08:00
|
|
|
cp bash_completion.d/wp-cli /etc/bash_completion.d/
|
2021-04-14 12:10:42 -07:00
|
|
|
chmod 644 /etc/bash_completion.d/wp-cli
|
|
|
|
|
|
|
|
# install wp user scripts
|
2022-11-16 15:01:35 -08:00
|
|
|
cp bin/wp-* /usr/local/bin
|
2021-04-15 12:50:06 -07:00
|
|
|
chmod 755 /usr/local/bin/wp-*
|
2021-04-14 12:10:42 -07:00
|
|
|
|
|
|
|
# install & enable wp systemd cron
|
2022-11-16 15:01:35 -08:00
|
|
|
cp sbin/wp-cron.sh /usr/local/sbin/
|
2021-04-14 12:10:42 -07:00
|
|
|
chmod 755 /usr/local/sbin/wp-cron.sh
|
2022-10-20 11:51:42 -07:00
|
|
|
if [[ ! -d /usr/local/lib/systemd/system ]]; then
|
|
|
|
mkdir -p /usr/local/lib/systemd/system
|
|
|
|
fi
|
2022-11-16 15:01:35 -08:00
|
|
|
cp systemd/wp-cron.* /usr/local/lib/systemd/system/
|
2022-10-20 11:51:42 -07:00
|
|
|
chmod 644 /usr/local/lib/systemd/system/wp-cron.*
|
2022-03-28 09:50:13 -07:00
|
|
|
systemctl enable wp-cron.timer
|
2021-04-14 12:10:42 -07:00
|
|
|
systemctl start wp-cron.timer
|
2022-11-16 14:25:10 -08:00
|
|
|
|
|
|
|
# fail2ban wordpress configs
|
|
|
|
if [[ -d /etc/fail2ban/ ]]; then
|
2022-11-16 15:01:35 -08:00
|
|
|
chmod 644 fail2ban/filter.d/*
|
|
|
|
cp -a fail2ban/filter.d/* /etc/fail2ban/filter.d/
|
2022-12-12 09:16:55 -08:00
|
|
|
chmod 644 fail2ban/jail.d/*
|
2022-11-16 15:01:35 -08:00
|
|
|
cp -a fail2ban/jail.d/* /etc/fail2ban/jail.d/
|
2022-11-16 14:25:10 -08:00
|
|
|
systemctl restart fail2ban
|
|
|
|
else
|
|
|
|
echo "Fail2ban not installed, skipping fail2ban wordpress configs."
|
|
|
|
fi
|