[AntiDDoS] for ols1clk (OpenLitespeed Script) with vDDoS Proxy Protection

400 views
Skip to first unread message

Vo Duy dot Com

<voduydotcom@gmail.com>
unread,
Feb 16, 2023, 4:13:57 AM2/16/23
to voduydotcom@googlegroups.com

[AntiDDoS] for ols1clk (OpenLitespeed Script) with vDDoS Proxy Protection

image.png

STEP 1: Install ols1clk (OpenLitespeed Script) (CentOS)

wget https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh
wget https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Setup/vhsetup.sh
chmod 700 *.sh
./ols1clk.sh --listenport 88 --ssllistenport 999 --pure-mariadb --mariadbver 10.5 --lsphp 74  #(Change version MySQL/PHP as your need)

More documentation:
https://github.com/litespeedtech/ols1clk

Install Mysql Pass:

yum -y install zip unzip ; apt -y install zip unzip
DB_ROOT_PASSWORD=`cat /usr/local/lsws/password|grep mysql| tr [ " "|tr ] " "| tr . " " | awk {'print $5'}`
echo 'root_mysql_pass="'$DB_ROOT_PASSWORD'"' > /root/.db_password; cat /root/.db_password
cd /usr/local/lsws/Example/html && wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip
unzip phpMyAdmin-latest-all-languages.zip && rm -f phpMyAdmin-latest-all-languages.zip && mv phpMyAdmin-* phpmyadmin

Example Add a WordPress website:

domain=domain.com
./vhsetup.sh -d $domain -w

The code is contained in: /var/www/

image.png


STEP 2: Install vDDoS Proxy Protection

vDDoS Proxy Protection is free software to provide a Reverse Proxy Server HTTP(S) protocols. It act as a Layer 7 Firewall Filter & Mitigate DOS, DDOS, SYN Floods, or HTTP Floods attack to protect your website.

wget https://files.voduy.com/vDDoS-Proxy-Protection/latest.sh ; chmod 700 latest.sh ; bash latest.sh

More documentation:
https://vddos.voduy.com

STEP 3: Change OpenLiteSpeed Default Port

By default ols1clk uses OpenLiteSpeed running on port 80, 443. Because we have requested "--listenport 88 --ssllistenport 999" to reset HTTP/HTTPS port so now openlitespeed is running on these ports so that vDDoS can proxy on them.

Re-Check OpenLiteSpeed port:

[root@vDDoS-ols1clk ~]# netstat -lntup|grep openlitespeed

tcp        0      0 0.0.0.0:88              0.0.0.0:*               LISTEN      25625/openlitespeed
tcp        0      0 0.0.0.0:999             0.0.0.0:*               LISTEN      25625/openlitespeed
tcp        0      0 0.0.0.0:7080            0.0.0.0:*               LISTEN      25625/openlitespeed
udp        0      0 0.0.0.0:52396           0.0.0.0:*                           25627/openlitespeed
udp        0      0 0.0.0.0:7080            0.0.0.0:*                           25625/openlitespeed
udp        0      0 0.0.0.0:999             0.0.0.0:*                           25625/openlitespeed

Open Port:

systemctl stop firewalld
service lsws restart

STEP 4: Config vDDoS Proxy Protection

For example, the IP Addr of your server is 1.2.3.4:

nano /vddos/conf.d/website.conf

# Website       Listen               Backend                  Cache Security SSL-Prikey   SSL-CRTkey
default         http://0.0.0.0:80    http://1.2.3.4:88    no    no      no           no
default         https://0.0.0.0:443  https://1.2.3.4:999   no    no      /vddos/ssl/your-domain.com.pri /vddos/ssl/your-domain.com.crt

Restart vDDoS service after you have configured:

/usr/bin/vddos restart

STEP 5: Config vDDoS Auto Add

vDDoS Auto Add is a addon support for vDDoS Proxy Protection - Monitor Domains/Aliasdomains/Subdomains in Panel Hosting, Web Server, List Domain, Virtual Host... and automatically add them into the website.conf file.

nano /vddos/auto-add/setting.conf

# Default Setting for vddos-add command:

SSL				auto
DNS_sleep 		66
DNS_alias_mode	no
Cache			no
Security		no
HTTP_Listen		http://0.0.0.0:80
HTTPS_Listen	https://0.0.0.0:443
HTTP_Backend	http://1.2.3.4:88
HTTPS_Backend	https://1.2.3.4:999

Set Crontab:

echo '*/15 * * * * root /usr/bin/vddos-autoadd panel cyberpanel openlitespeed' >> /etc/crontab

STEP 6: Config vDDoS Auto Switch

vDDoS Auto Switch is a addon support for vDDoS Proxy Protection - Automatically identifies overloaded websites and changes their Security Mode.

nano /vddos/auto-switch/setting.conf

# This is the default configuration for "sensor-switch.sh" and "vddos-autoswitch.sh"

hostname="vDDoS Master"							#(Name this server, it will show up in Email notifications)

vddos_master_slave_mode="no"					#(Turn on "yes" if your system has slave servers, want to sync affter switch like master)
backend_url_check="no"			#(Put the URL of the backend. Ex: https://1.1.1.1:999/ (make sure Backend status response is "200"))

send_notifications="no"						#(Turn on "yes" if you want receive notification)
smtp_server="smtps://smtp.gmail.com"		#(SMTP Server)
smtp_username="x...@gmail.com"				#(Your Mail)
smtp_password="xxxxxxxxxxxxx" 				#(Get your Apps password for Gmail from https://security.google.com/settings/security/apppasswords)
send_notifications_to="xx...@gmail.com"		#(Your Email Address will receive notification)


maximum_allowable_delay_for_backend=2 			#(Means: If Backend (status response "200") is slower than 2s, vDDoS will enable challenge mode)
maximum_allowable_delay_for_website=2 			#(Means: If Website (status response "200") is slower than 2s, vDDoS will enable challenge mode)

default_switch_mode_not_attack="no"				#(Default Mode vDDoS use when it's not under attacked)
default_switch_mode_under_attack="high"			#(Default Mode vDDoS use when it's under attack)
default_waiting_time_to_release="60"			#(For example 60 minutes, release time from challenge)

Crontab vDDoS Auto Switch:

echo '*/5 * * * * root /usr/bin/vddos-autoswitch checkalldomain high' >> /etc/crontab
echo '0 */3 * * * root /usr/bin/vddos-switch allsite no && /usr/bin/vddos reload' >> /etc/crontab
echo '* * * * * root /usr/bin/vddos-sensor' >> /etc/crontab

More documentation:
https://github.com/duy13/vDDoS-Auto-Switch

Vo Duy dot Com

<voduydotcom@gmail.com>
unread,
Mar 4, 2023, 1:32:18 AM3/4/23
to voduydotcom@googlegroups.com

Automatically find and update htaccess if there are changes:

echo '* * * * * root if ! find /var/www/* -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name ".htaccess" -exec false {} +; then systemctl reload lsws; fi' >> /etc/crontab
Reply all
Reply to author
Forward
Message has been deleted
0 new messages