New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computer Account / MAC address doesn't work #171

Open
tnaefken opened this Issue Nov 15, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@tnaefken
Copy link

tnaefken commented Nov 15, 2017

Last week I installed Grase Hotspot 3.8.0. When I tried to use the "Computer Account" functionality, it didn't work.
In detail:
I created a Computer Account by inputting the MAC address of my device - and, yes, following the hint I used "-" instead of ":" and uppercase letters in the hexadecimal values (why aren't they converted automatically to uppercase ?).
When I connected my device to Grase Hotspot, I got the login page, but I exspected to get the Internet access without login.

After some research I found the user entry in the database table radius.radcheck: there the MAC address is the 'username'. But it is stored with LOWERCASE letters. After changing that into UPPERCASE letters (also in the tables radusercomment und radusergroup), it worked !

Further research showed me in DatabaseFunctions.class.php at line 916 the function createUser, and in line 926 (=first line of the function) there is a call

$username = mb_strtolower($username);

So, the letters in a MAC address (which had to be uppercase in the input field) become lowercase and are then stored in the database.
My assumption is, that these lowercase-values won't match with the MAC address of a device, which has a uppercase representation in the software.
My first idea was to change "mb_strtolower" into "mb_strtoupper" in line 926, but that would affect the normal usernames also, which are globally used in lowercase.

Next idea: I can let run a script which converts the MAC adresses in the database tables, but that's no solution, it's only a workaround.

I would like to convert the MAC address of the device just before "comparing" it with the database entry, but I'm not shure where to do it.

Have you any ideas or solutions ?

@timwhite

This comment has been minimized.

Copy link
Contributor

timwhite commented Nov 16, 2017

Can you please collect some support data as stated at https://grasehotspot.org/support/collecting-support-information/
I've recently done some testing of MAC auth for a private project, and didn't have this problem. I'll do some more testing when I'm on my dev machine next.

@tnaefken

This comment has been minimized.

Copy link

tnaefken commented Nov 17, 2017

Again I tried with a second device. By using the Web Admin Interface to create a computer account, the generated "UserName" entries in the "radius" databse became a lowercase MAC address - and using this for login didn't work.
Then I converted the mac address manually in the tables "radius.radcheck" and "radius.radusergroup" to UPPERCASE MAC address, and - voil#a! - it worked !


I uploaded the requested data to
https://paste.grasehotspot.org/view/7e219c32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment