x-ui icon indicating copy to clipboard operation
x-ui copied to clipboard

ip limit for inbound (vmess & vless implemented)

Open hossinasaadi opened this issue 2 years ago • 233 comments

Vmess implemented :1st_place_medal: Vless implemented :1st_place_medal:

- to enable this feature set access log in config.json

this feature doesn’t let users connect more than the limit number in every inbound option.

the job runs every 1 min. read access.log and process log by email. (if you want to enable limit ip, should fill email field). set the limit ip to 0 to disable it. vmess protocol limit ip is implemented. in the future, I try to implement other protocols :) @vaxilu

note : It's better to set the limit IP to 3, cause maybe the user switch between wifi and cellular within 1 min, and inbound get disabled.

install :

install

hossinasaadi avatar Oct 29 '22 16:10 hossinasaadi

@hossinasaadi I appreciate your great work, Thank you man. Do you think it is possible to consider an automatic process to clear the log to prevent the disk from filling up?

userisamir avatar Oct 29 '22 21:10 userisamir

@hossinasaadi I appreciate your great work, Thank you man. Do you think it is possible to consider an automatic process to clear the log to prevent the disk from filling up?

Hi , the job runs every 1 min and automatically purge access log to prevent the file size problem.

hossinasaadi avatar Oct 29 '22 21:10 hossinasaadi

I enabled the access.log in xray-panel setting > xray configuration template, and restart the panel. "log": { "access": "/usr/local/x-ui/bin/access.log", "loglevel": "info" } but email and limit ip field not showing up in inbound form, what's wrong?

userisamir avatar Oct 29 '22 22:10 userisamir

I enabled the access.log in xray-panel setting > xray configuration template, and restart the panel. "log": { "access": "/usr/local/x-ui/bin/access.log", "loglevel": "info" } but email and limit ip field not showing up in inbound form, what's wrong?

yeah you should install it manually , so i create a release for it can install by bash : sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

hossinasaadi avatar Oct 30 '22 09:10 hossinasaadi

Hi , I installed it and the email box was activated for me, but I have a problem saving the email in the panel

How did you install it?

saeed1024 avatar Oct 30 '22 12:10 saeed1024

.

testme1236 avatar Oct 30 '22 12:10 testme1236

I enabled the access.log in xray-panel setting > xray configuration template, and restart the panel. "log": { "access": "/usr/local/x-ui/bin/access.log", "loglevel": "info" } but email and limit ip field not showing up in inbound form, what's wrong?

yeah you should install it manually , so i create a release for it can install by bash : sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

Thank you for providing bash install. So i tried, and it works very well, For example i set the ip limit to 1 and when second ip tried to connect, the inbound config disabled successfully (in GUI), But it "does not prevent reconnection" to inbound and client can still be connected. I tested enabling and disabling inbound manually and it worked.

userisamir avatar Oct 30 '22 12:10 userisamir

Hi , I installed it and the email box was activated for me, but I have a problem saving the email in the panel

How did you install it?

sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

Error: No such file or directory

saeed1024 avatar Oct 30 '22 12:10 saeed1024

Hi , I installed it and the email box was activated for me, but I have a problem saving the email in the panel

How did you install it?

sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

Error: No such file or directory try this bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

Thank you

saeed1024 avatar Oct 30 '22 13:10 saeed1024

but I have a problem saving the email in the panel

I enabled the access.log in xray-panel setting > xray configuration template, and restart the panel. "log": { "access": "/usr/local/x-ui/bin/access.log", "loglevel": "info" } but email and limit ip field not showing up in inbound form, what's wrong?

yeah you should install it manually , so i create a release for it can install by bash : sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

Thank you for providing bash install. So i tried, and it works very well, For example i set the ip limit to 1 and when second ip tried to connect, the inbound config disabled successfully (in GUI), But it "does not prevent reconnection" to inbound and client can still be connected. I tested enabling and disabling inbound manually and it worked.

I check this problem, its occurs cause need to restart after disabling inbound. I'm working on it :)

hossinasaadi avatar Oct 30 '22 13:10 hossinasaadi

I check this problem, its occurs cause need to restart after disabling inbound. I'm working on it :)

It would be great if we can recognize the inbound that disabled because of reached ip limit. e.g append a short text to 'remark' field. Kindly Thanks to you and looking forward for updates 🥇

userisamir avatar Oct 30 '22 13:10 userisamir

xray restart bug fixed , you can check and clear ip log now :) Screenshot from 2022-10-30 12-26-11

for install : sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

hossinasaadi avatar Oct 30 '22 16:10 hossinasaadi

xray restart bug fixed , you can check and clear ip log now :)

Checked it and works like a charm :) Pashm be tanam namoond, damet garm 👍

Just for clearify; I think the rules of disabling have changed and it is done based on the new log. And not based on the synchronicity of IPs within 1 minute in 'access.log', And this causes wrong disabling. Correct me if I am wrong.

userisamir avatar Oct 30 '22 17:10 userisamir

"bash: /dev/fd/63: No such file or directory"

this error shown when i wnat to install script please explain how i can enable user ip count limit on v2ray panel

mahansalimi avatar Oct 30 '22 17:10 mahansalimi

how can enable access log in config.jason?

mahansalimi avatar Oct 30 '22 18:10 mahansalimi

xray restart bug fixed , you can check and clear ip log now :)

Checked it and works like a charm :) Pashm be tanam namoond, damet garm +1

Just for clearify; I think the rules of disabling have changed and it is done based on the new log. And not based on the synchronicity of IPs within 1 minute in 'access.log', And this causes wrong disabling. Correct me if I am wrong.

your welcome :) you are right. it was fixed and now just keep IPs Within 1 min in logs.

hossinasaadi avatar Oct 30 '22 18:10 hossinasaadi

سلام من نسخه شمارو نصب کردم ایمیل هم وارد میکنم اما محدودیت ایجاد نمیشه . ادیت هم ک میزنم ایمیلی ک زدم نیست تعداد یوزریم ک گذاشتم نیس

aroniran avatar Oct 30 '22 20:10 aroniran

xray restart bug fixed , you can check and clear ip log now :) Screenshot from 2022-10-30 12-26-11

for install : sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

is there any extra setting we must do because I can't see this box and there is no limitation here I install it using sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

amir-valizadeh avatar Oct 30 '22 21:10 amir-valizadeh

You can make all users work with one port, for example, 443, because the more the number of active ports on the server increases, the more filtering is possible.

if use one port we can use cdn and hide ip

miladrajabi2002 avatar Oct 30 '22 22:10 miladrajabi2002

xray restart bug fixed , you can check and clear ip log now :) Screenshot from 2022-10-30 12-26-11 for install : sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

is there any extra setting we must do because I can't see this box and there is no limitation here I install it using sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

install it again from bash, the bug is fixed

hossinasaadi avatar Oct 30 '22 22:10 hossinasaadi

image "bash: /dev/fd/63: No such file or directory"

this error shown when i wnat to install script

miladrajabi2002 avatar Oct 30 '22 22:10 miladrajabi2002

image "bash: /dev/fd/63: No such file or directory"

this error shown when i wnat to install script

just google it bro :) wget https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh then : sudo bash install.sh

hossinasaadi avatar Oct 30 '22 22:10 hossinasaadi

image "bash: /dev/fd/63: No such file or directory" this error shown when i wnat to install script

just google it bro :) wget https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh then : sudo bash install.sh

installed can you add multi-user one-port ?

miladrajabi2002 avatar Oct 30 '22 22:10 miladrajabi2002

@hossinasaadi what's your opinion about ip detection accuracy? For example if client switch cellular data to wifi, and the ip limit is 1, so inbound will disable. Do you think it is possible to run the cron job every second instead of 1 minute?

userisamir avatar Oct 30 '22 23:10 userisamir

@hossinasaadi what's your opinion about ip detection accuracy? For example if client switch cellular data to wifi, and the ip limit is 1, so inbound will disable. Do you think it is possible to run the cron job every second instead of 1 minute?

can`t find active ip? if find active ip from user can limit user

miladrajabi2002 avatar Oct 30 '22 23:10 miladrajabi2002

@userisamir I think it would be more useful if IP limitation is more like current connected Device Limitation. this way if the client has the key(or server access), they could be connected form one or x number of devices. as you mentioned IPs are dynamic and could change if the user tried to switch networks or Turn off/on the network.

AliSawari avatar Oct 30 '22 23:10 AliSawari

@AliSawari @miladrajabi2002 Due to the limitations of xray/v2ray, we don't have any client information except ip in the log.

userisamir avatar Oct 30 '22 23:10 userisamir

The added features were enabled for me the email and IP restrictions were saved in the panel but when multiple devices are connected, the IP log is empty and does not disable the connection

testme1236 avatar Oct 31 '22 07:10 testme1236

sudo bash <(curl -Ls https://raw.githubusercontent.com/hossinasaadi/x-ui/dev/install.sh)

@hossinasaadi i think job dosen't run correctly every 1 min image

amir-valizadeh avatar Oct 31 '22 07:10 amir-valizadeh

what's your opinion about ip detection accuracy?

for better detection, if inbound create for a single user you should consider 2 IPs (cellular and wifi), so if the user switches between them within 1 min nothing happens.

hossinasaadi avatar Oct 31 '22 08:10 hossinasaadi