Welcome to World of IPTV

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Forum Rules

Our Rules: Read to avoid getting banned!

Advertising

Introduce Yourself to the World with Us!

Resource Database

Find the newest resources around IPTV!

Account upgrade

Upgrade your account to unlock more benefits!

Tutorial XtreamUi protection with File2ban

mister no

Extended Member
Ext. Member
Joined
Oct 1, 2019
Messages
44
Reaction score
760
Points
94
Location
CH
First create a conf file /etc/fail2ban/filter.d/xtream.conf or whatever you want to call the configuration,


then in jail.local create a conf file with data on the duration of ban ip etc.


bantime = -1 permanent ban

Remember in /home/xtreamcodes/iptv_xtream_codes/nginx/conf/nginx.conf you must grant access.log

Tested on ubuntu 16 04 and works great !!!

 
Last edited:
First create a conf file /etc/fail2ban/filter.d/xtream.conf or whatever you want to call the configuration,
No quote

then in jail.local create a conf file with data on the duration of ban ip etc.
No quote

bantime = -1 permanent ban

Remember in /home/xtreamcodes/iptv_xtream_codes/nginx/conf/nginx.conf you must grant access.log

Tested on ubuntu 16 04 and works great !!!

Can you post also your log_format in nginx.conf?
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
Can you post also your log_format in nginx.conf?
ubuntu 18
acces.log

ip - - [19/Apr/2021:12:32:33 +0000] "GET /portal.php?action=handshake&type=stb&token=&mac= HTTP/1.1" 200 51 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ip Safari/537.36"

error.log

2021/04/18 21:07:51 [error] 4073#4073: *260 limiting requests, excess: 8.200 by zone "one", client: ip, server: , request: "GET /portal.php?token=&type=stb&action=handshake HTTP/1.1", host: "ip:8000"
 
That not working, need right format for failregex
 
Can you post also your log_format in nginx.conf?
I pointed out that it works in ubuntu 16 04 and for 18 I don't know I haven't tested it .




I think you have an overview here, here is the situation from yesterday, how many new IPs are blocked :)

GET /portal.php?action=handshake&type=stb&token=&mac=
GET \/portal\.php\?type=stb&action=(?:handshake&token=&prehash=0&JsHttpRequest=1\-xml|get_profile

in regex there is no mac option with me
 
Last edited:
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
On ubuntu 18.04 must added datepattern = \[(%%d/%%b/%%Y:%%H:%%M:%%S %%z)\] to work because will get error "Please try setting a custom date pattern (see man page jail.conf(5))"...
but still need more effective failregex =
 
On ubuntu 18.04 must added datepattern = \[(%%d/%%b/%%Y:%%H:%%M:%%S %%z)\] to work because will get error "Please try setting a custom date pattern (see man page jail.conf(5))"...
but still need more effective failregex =
It has nothing to do with a better effect with blocked ip but only shows the time and date when which ip is blocked !
 
^<HOST> .* /.* 4\d\d .*$


Add this option to regex in a new row below the existing regex and all ip with error 404 will be blocked
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
Friend with that will ban not only 404, will ban all 4**.
Customers get error 406 when not have some channel in their bouquet, with that will ban all if delete some channel.

may be:
failregex = ^<HOST> .* 404 .*
 
Code:
# Fail2Ban filter for xtream
#
[INCLUDES]

before = xtream.conf

[Definition]


failregex = ^<HOST> -.* "GET \/portal\.php\?type=stb&action=(?:handshake&token=&prehash=0&JsHttpRequest=1\-xml|get_profile) HTTP\/1\.1" 200 .*
           

ignoreregex =

Code:
[xtream]
enabled = true
filter = xtream
action = iptables-allports[xtream, port="http,https", protocol=tcp]
logpath = /home/xtreamcodes/iptv_xtream_codes/logs/main.log
bantime = 60m
maxretry = 5

ubuntu 18 ok
thank you

test later
 
Code:
# Fail2Ban filter for xtream
#
[INCLUDES]

before = xtream.conf

[Definition]


failregex = ^<HOST> -.* "GET \/portal\.php\?type=stb&action=(?:handshake&token=&prehash=0&JsHttpRequest=1\-xml|get_profile) HTTP\/1\.1" 200 .*
          

ignoreregex =

Code:
[xtream]
enabled = true
filter = xtream
action = iptables-allports[xtream, port="http,https", protocol=tcp]
logpath = /home/xtreamcodes/iptv_xtream_codes/logs/main.log
bantime = 60m
maxretry = 5

ubuntu 18 ok
thank you

test later
Is this working Right ? on Ubuntu 18.04 ? Thank you.
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
Friend with that will ban not only 404, will ban all 4**.
Customers get error 406 when not have some channel in their bouquet, with that will ban all if delete some channel.

may be:
failregex = ^<HOST> .* 404 .*
also 404 not recommended because some devices have wired requests GET /images/c877d859.....5083d5.jpg HTTP/1.1" 404
it's possible because of the apps that they use
 
on main server:

failregex = ^<HOST> - .* 404 0 .*

on proxy servers:

failregex = ^<HOST> - .* 404 5 .*
 
I made some experiments:

[xtream]

enabled = true
action = iptables-allports[protocol=all, blocktype=DROP]
filter = xtream
logpath = /home/xtreamcodes/iptv_xtream_codes/logs/main.access.log
maxretry = 2
bantime = 3600
ignoreip = 127.0.0.1,add your ip

in crontab add:

0 */1 * * * echo "" > /home/xtreamcodes/iptv_xtream_codes/logs/main.access.log


Still try to made best config for error 404, if someone can help, will be great.
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
I made some experiments:



in crontab add:




Still try to made best config for error 404, if someone can help, will be great.
Try this
^<HOST>.*"(GET|POST).*" (404|444|403|400) .*$

ignoreip = 127.0.0.1 add your ip
(space only , without , )

ignoreip = search and edit in jail.conf I did so and it works

results in 3 days
 
hi,

1 - can anyone give the final conf ?
2- how can test to make sure it works?

thanks all for your work
 
I made some experiments:



in crontab add:




Still try to made best config for error 404, if someone can help, will be great.
i tried many conf from forum but simply didnt get to work, probably i missing something any sugestion would be helpful Thanks.
 
Channels MatchTime Unblock CDN Offshore Server Contact
100 cnx / 90€ 5Gbps / 180€ 48CPU-256GRAM 10Gbps 569€ Skype live:giefsl
500 cnx / 350€ 10Gbps / 350€ 48CPU-128GRAM 5Gbps / 349€ TG @changcdn
1000 cnx / 500€ 20Gbps / 700€ 40CPU-128GRAM 20Gbps / €980 http://coronaserver.com
Try this
^<HOST>.*"(GET|POST).*" (404|444|403|400) .*$

ignoreip = 127.0.0.1 add your ip
(space only , without , )

ignoreip = search and edit in jail.conf I did so and it works

results in 3 days
I made some experiments:



in crontab add:




Still try to made best config for error 404, if someone can help, will be great.


Hi, can you please help me with config? I tried your config but my http://portal:ip/portal.php?type=stb&action=get_profile is still accessible.

Thank you alot!
 
Try this
^<HOST>.*"(GET|POST).*" (404|444|403|400) .*$

ignoreip = 127.0.0.1 add your ip
(space only , without , )

ignoreip = search and edit in jail.conf I did so and it works

results in 3 days

How can I add your failregex to existing one:
failregex = ^<HOST> -.* "GET \/portal\.php\?type=stb&action=(?:handshake&token=&prehash=0&JsHttpRequest=1\-xml|get_profile) HTTP\/1\.1" 200 .*
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top