wifidog / wifidog-auth-laravel

Rework wifidog-auth by Laravel
Other
102 stars 40 forks source link

Need support for disconnecting user after logout #112

Closed SohailAsghar236 closed 2 weeks ago

SohailAsghar236 commented 2 weeks ago

@sinkcup Are you still providing support for this repo or abandoned it? Please at least update.

sinkcup commented 2 weeks ago

yes, I am here

sinkcup commented 2 weeks ago

I have check the code, after you click logout from the auth server web, you will be redirected to gateway's logout page, is it OK?

https://github.com/wifidog/wifidog-auth-laravel/blob/756b5fd0071008b759c68d737ddbd0bf0a196981/app/Http/Controllers/Auth/LoginController.php#L77

sinkcup commented 2 weeks ago

I found that this function has been implemented in #67

Did you encounter any error?

SohailAsghar236 commented 2 weeks ago

@sinkcup Thank you for your response. Yes, I got error. The logout didn't complete. I was stuck on IP:2060 page. The user is never disconnected after logging out. Internet connection stays alive.

SohailAsghar236 commented 2 weeks ago

I would also like to know how to apply timeout, upload and download rate to a user?

sinkcup commented 2 weeks ago

what is the error?

debug wifidog: edit /usr/bin/wifidog-init, change "start" section's "wifidog $OPTIONS" to "wifidog -f -d 9"

SohailAsghar236 commented 2 weeks ago

I am using WiFiDog Auth Laravel as authentication server with Ruijie AP. The AP is acting as gateway. I have not setup a gateway server. The authentication process is working (token verification and internet access after authentication) but I don't get portal page loaded to show that internet is connected and if I manually try to logout from auth server, I get error.

image_1731505523436_dthig1731505523439 image_1731505538625_b43no1731505538627

sinkcup commented 2 weeks ago

the second image means you can not connect to Ruijie AP port 2060, try 80

https://www.ruijienetworks.com/support/documents/slide_rg-wlan-series-access-points-web-based-configuration-guide-en/?page=html&keyworks=wifidog

SohailAsghar236 commented 2 weeks ago

I have tried the 80 port and it didn't work either. This is the URL sent to auth server from AP when I connect to the WiFi SSID for which authentication is enable:

https://wifidog.appcraftr.com/login/?gw_id=G1QPBCJ099868&gw_sn=G1QPBCJ099868&gw_address=192.168.23.1&gw_port=2060&ip=192.168.23.2&mac=7c:5c:f8:ca:2e:25&apmac=9c2b.a6a2.e075&ssid=.%40%40WiFidog&url=http%3A%2F%2Fwww.msftconnecttest.com%2Fredirect&vlanid=233

The login page loads and I am able to login with valid credentials and token is generated:

http://192.168.23.1:2060/wifidog/auth?token=17a8a0a86a4beee7f8be959e1959fd9d

Internet access is opened but I can't see the portal page or any status page. I manually tried to logout and even that is not working.

SohailAsghar236 commented 2 weeks ago

@sinkcup When I run this command for Ruijie AP (RG AP-820-L (V2)):

show web-auth rdport

I get this response: Rd-Port: 80 443

sinkcup commented 2 weeks ago
  1. screenshot of browser open http://192.168.23.1:2060/wifidog/auth?token=xxx

  2. command run:

curl -I http://192.168.23.1:2060/wifidog/auth?logout=1&token=xxx
SohailAsghar236 commented 2 weeks ago

@sinkcup

Take a look please:

image

image

SohailAsghar236 commented 2 weeks ago
  1. screenshot of browser open http://192.168.23.1:2060/wifidog/auth?token=xxx

image

  1. command run:

curl -I http://192.168.23.1:2060/wifidog/auth?logout=1&token=xxx

Response: Error: Failure when receiving data from the peer

sinkcup commented 2 weeks ago

Redirection HTTP Port: 80 is fine, it will redirect to login page when user access internet by http 80.

443 is optional, 2060 is wrong.

sinkcup commented 2 weeks ago

browser open http://192.168.23.1:2060/wifidog/auth?token=xxx

but your screenshot is http://192.168.23.1/wifidog/auth?token=xxx

SohailAsghar236 commented 2 weeks ago

Redirection HTTP Port: 80 is fine, it will redirect to login page when user access internet by http 80.

443 is optional, 2060 is wrong.

I removed 2060. Just added for checking if WiFiDog is using it.

SohailAsghar236 commented 2 weeks ago

browser open http://192.168.23.1:2060/wifidog/auth?token=xxx

but your screenshot is http://192.168.23.1/wifidog/auth?token=xxx

@sinkcup Apologies for the mistake. Here is the correct screenshot:

image

sinkcup commented 2 weeks ago

is your config right?

image
SohailAsghar236 commented 2 weeks ago

@sinkcup Please check:

image

Telnet command output:

web-auth template wifidog1 wifidog ip 106.0.62.78 nas-ip 192.168.23.1 url https://wifidog.appcraftr.com/ redirect js !

SohailAsghar236 commented 2 weeks ago

@sinkcup Should I setup a WiFiDog gateway virtual machine on same subnet as AP and add VM's IP as NAS-IP?

sinkcup commented 2 weeks ago
  1. change url to https://wifidog.appcraftr.com/login
  2. Ruijie AP wifidog port 2060 reset is not a good news, contact Ruijie for wifidog debug log, or virtual a Linux as router, or use a cheap OpenWrt router to test.
sinkcup commented 2 weeks ago

in the wifidog protocol v1, there is no NAS, I don't known what is it, maybe it cause error?

https://github.com/wifidog/wifidog-auth-laravel/wiki/WiFiDog-Protocol-V1

SohailAsghar236 commented 2 weeks ago

@sinkcup Thank you for the feedback. Let me check and get back to you.

Is the timeout, upload and download rate work is not done in auth server? What should I do if I want to allow a user just 10 minutes of internet?

SohailAsghar236 commented 2 weeks ago

@sinkcup I modified the LoginController to change code for token. The authentication wasn't working before. It worked after I made the token 32 bit.

image

SohailAsghar236 commented 2 weeks ago

@sinkcup Please respond on timeout point. I need help with that.

sinkcup commented 2 weeks ago

OMG! the token is too long?

I will reappear it in tests.

SohailAsghar236 commented 2 weeks ago

@sinkcup Yes, the token is too long and is being rejected by gateway. I borrowed the hash code from original WiFiDog auth code that is written in core PHP.

Please responsd how to add a timeout, upload and download rate parameters?

SohailAsghar236 commented 2 weeks ago

@sinkcup Please response to timeout, upload and download rate parameters and if this is implemented? Do I need to create a new issue for this?

sinkcup commented 2 weeks ago

yes, you should create a new issue for it.

it's a new feature, now it does not exist.