So I spent a lot of time looking for a way to allow anonymous users to a coova chilli hotspot. Anonymous in the sense that a user can just click a button and get 30 min Internet access without having to type a password and what not. It made complete sense to use the MAC address as the users ID, but this only worked if you entered the MAC already. And NO where did I find that you could accept any new MAC address as a new user. Eventually I learnt enough about coova chilli to do this myself. The trick is to change the function dologin in the haserl script /etc/chilli/www/config-local.sh (use your password instead of XXXX) to
dologin() { res="$(echo "select username from radcheck where username ='$REMOTE_MAC';" | mysql -u root -pXXXX radius)" if [ "$res" = "" ] then echo "insert into radcheck (username, attribute, op, value) values ('$REMOTE_MAC', 'Cleartext-Password', ':=', 'password');" | mysql -u root -pXXXX radius echo "insert into radusergroup (username, groupname) values ('$REMOTE_MAC', '30min');" | mysql -u root -pXXXX radius fi # url=$(chi_login_url "$FORM_username" "$FORM_password" "$FORM_userurl") url=$(chi_login_url "$REMOTE_MAC" "password" "$FORM_userurl") cat <<ENDHTML <html><head> <meta http-equiv="refresh" content="0;url=$url"/> </head></html> ENDHTML wisprLoginResultsURL "$url" }
Once you have done this, every time a new device logs into your web page, the script will check if the MAC address exists or not. If not it will require any username. I changed my login page to just be a button and made the other fields hidden, like so edit /etc/chilli/www/login_form.tmpl :
<!-- -- The login form --> <div id="login-form"> <table> <tr> <!-- <td>Usernamebb</td> --> <td><INPUT NAME="username" VALUE="user1" TYPE="hidden"></td> </tr> <tr> <!-- <td>Password</td> --> <td><INPUT NAME="password" VALUE="password" TYPE="hidden" TYPE="password"></td> </tr> <tr> <td colspan="2" nowrap align="center"> <input type="submit" name="button" value="Login & Accept Terms"> </td> </tr> </table> </div>