Monthly Archives: November 2019

litespeed WebP support for GD prestashop

Assuming you are using PHP 7.2 version standalone or with cyberpanel and you need add WebP support:

yum install -y lsphp72-devel gcc libjpeg-turbo-devel libpng-devel libXpm-devel freetype-devel libwebp-devel
wget https://www.php.net/distributions/php-7.2.24.tar.gz
tar xzvf php-7.2.24.tar.gz

cd php-7.2.24
cd ext/gd
/usr/local/lsws/lsphp72/bin/phpize
/usr/local/lsws/lsphp72/bin/php-config
./configure --with-php-config=/usr/local/lsws/lsphp72/bin/php-config --with-webp-dir=/usr/include/webp --with-freetype-dir=/usr/include/freetype2/freetype --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-xpm-dir=/usr/include
make
make install
pkill lsphp

This works for Google webP Image Converter Module

Restarting network (via systemctl): Job for network.service canceled

service network restart
Restarting network (via systemctl): Job for network.service canceled.
[FAILED]

systemctl restart network
Job for network.service canceled.

If cyberpanel server network is down (venet0: mtu 1500 qdisc noop state DOWN) after server reboot, make sure:

vi /etc/fstab
#/usr/.tempdisk /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0
#/tmp /var/tmp none bind 0 0

service network restart
Restarting network (via systemctl):
[ OK ]

monitor and block syn flood

Can help prevent SYN flood DDoS attack

[Mon Nov 4 17:35:53 2019] possible SYN flooding on ctid 0, port 465. Sending cookies.
[Mon Nov 4 19:23:41 2019] possible SYN flooding on ctid 0, port 25. Sending cookies

cat > SYN_RECV.sh << "END"

#!/bin/bash
netstat -natp | grep SYN_RECV | sort | awk '{ print $5 }' | sort | cut -d ":" -f1 | uniq -c | awk '{if ($1>100) system("iptables -I INPUT -s "$2" -j REJECT")}'
END

#ANsible copy and add to cron:

ansible -i inv.txt cpa -m copy -a "src=SYN_RECV.sh dest=/root/bin/SYN_RECV.sh mode=755 owner=root group=root"
ansible -i inv cpa -m cron -a "name=SYN_BLOCK job=/root/bin/SYN_RECV.sh user=root"