NEW Package: freeRADIUS 2.x
-
Thanks for this great contribution.
I am currently testing pfsense 2.0.3 with freeradius2 in appliance only mode.
I think I've found a small bug, if a radius user is created with an email address .i.e "tom@example.com" and "Amount of traffic" is set, this user is unable to login.
I've added "@" to /usr/local/etc/raddb/scripts/datacounter_*.sh files on the line
USERNAME=`echo -n "$1" | sed 's/[^0-9a-zA-Z.:_-[color=red]@]/X/g'
I am able to log on with "tom@example.com", however traffic accounting completely stops, for all users not just ones with @ in their names, if I remove my changes from /usr/local/etc/raddb/scripts/datacounter_acct.sh, accounting works again but not for @ usernames.
Any help?
-
You probably need to modify that on both functions:
freeradius_datacounter_auth_resync() freeradius_datacounter_acct_resync()
Further you need to restart pfsense to recreate the .sh files.
Or you go to diagnostics –> command prompt:
require_once("/usr/local/pkg/freeradius.inc");
freeradius_datacounter_auth_resync();
freeradius_datacounter_acct_resync(); -
Thanks.
I had the same results, I even commented out the realms section where it denies @ logins, still nothing.
-
@Abdsalem:
Thanks.
I had the same results, I even commented out the realms section where it denies @ logins, still nothing.
Hmm, I am no coding expert so I am not sure why this is happening but I found the follwoing:
http://php.net/manual/de/language.operators.php
So it seems that @ is an operator in PHP.And in function:
function freeradius_modulesdatacounter_resync()
we need the username (%{request:User-Name}) from freeradius and this could perhaps cause problems.Is there a way to just get the value of %{request:User-Name} without doing any special with it ?
-
Thanks, Im no coder either :0)
It could be my regex skills are also crap, but I thought I'd mention it as I noticed 1 or 2 posts on this thread pointing to this symptom, Ive since moved to an external radius server, just need to work out all the correct configs for it.
But without @ username, the pfsense package worked great, I had 2 pfsense fr2 syncing with eachother with no problems.
Cheers
-
hello,
first @ is not operator in php.
second, both functions You mentioned are bash scripts, so it doesn't matter.USERNAME=`echo -n "\$1" | sed 's/[^0-9a-zA-Z.:_-@]/X/g' ```this changes special characters to X. But finally it's just name of file so it doesn't matter if you save it with X as tomXmail.com or tom@mail.com. I don't use this function, but I'll try to help: 1\. Do You have only one backslash before $1 in USERNAME? 2\. Give me ouput (You can cut it, but I need sample name of username file (path /var/log/radacct/datacounter/\$TIMERANGE/max-octets-\$USERNAME"): You can do this command and paste somewhere.
ls -lar /var/log/radacct/datacounter/ > /root/datacounterlist
3\. As Nachtfalke wrote it could be problem in other function. We need to look into it: in function freeradius_modulesdatacounter_resync we need to change $conf variable a little. change only exec datacounterdaily
exec datacounterdaily {
wait = yes
program = "/bin/sh $varFREERADIUS_BASE/etc/raddb/scripts/datacounter_acct.sh %{request:User-Name} daily %{request:Acct-Input-Octets} %{request:Acct-Output-Octets} && /bin/sh echo %{request:User-Name} >> /root/usernames"
}
...maybe we would know something more with those files ;)
-
Thanks very much guys for offering to help and sorry I have not got back to this asap, been a bit busy as I have migrated my entire setup to pfsense 2.1 (radius accounting works great btw), I've setup an external radius server that sits on my dmz and its authenticating and accouting correctly with all my users, including "@" usernames.
I am a little free now to help fix this problem for the community because its ideal and more practical in some cases to give users the option to sign up with their email addresses with the pfSense FR2 package.
I have also worked out how to give users custom replies for my own setup if they fail authentication for what ever reason, I know a few people were looking for this as the default gave inconsistant replies for their setup .i.e "You have entered the wrong credentials" for a user who has used up their data allowance, instead of something liike this "You have used up your data allowance for this month".
Ill setup another vm with pfsense 2.0.3 soon (I cant find where FR2 pkg resides on 2.1) and post the result of the commands pszafer wrote.
TIA
-
Maybe better to test it on pfSense 2.1, so possible problem will no be reproduced in the newest version.
-
Good news for those that use this package with eap-tls. Current version now includes certificate revocation list(CRL) on eap Tab.
Once you revoke a client certificate, it will not be able to login anymore. :) -
Hey guys having a funny issue…with freeradius . It doesn't want to seem to start the freeradius daemon?
-
Hey guys having a funny issue…with freeradius . It doesn't want to seem to start the freeradius daemon?
What you got on log files?
-
Apr 19 06:33:17 check_reload_status: Reloading filter
Apr 19 07:42:06 check_reload_status: Syncing firewall
Apr 19 07:42:06 php: /pkg_edit.php: The command '/usr/local/etc/rc.d/radiusd.sh stop' returned exit code '1', the output was 'radiusd not running?'
Apr 19 07:42:06 php: /pkg_edit.php: The command '/usr/local/etc/rc.d/radiusd.sh stop' returned exit code '1', the output was 'radiusd not running?'
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Attempting to connect to radius@localhost:3306/radius
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
Apr 19 07:42:09 radiusd[15668]: rlm_sql_mysql: Starting connect to MySQL server for #0
Apr 19 07:42:09 radiusd[15668]: rlm_sql_mysql: Couldn't connect socket to MySQL server radius@localhost:radius
Apr 19 07:42:09 radiusd[15668]: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Failed to connect DB handle #0
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0
Apr 19 07:42:09 radiusd[15668]: Failed to load clients from SQL.
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Closing sqlsocket 4
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Closing sqlsocket 3
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Closing sqlsocket 2
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Closing sqlsocket 1
Apr 19 07:42:09 radiusd[15668]: rlm_sql (sql): Closing sqlsocket 0
Apr 19 07:42:09 radiusd[15668]: /usr/pbi/freeradius-i386/etc/raddb/sql.conf[2]: Instantiation failed for module "sql"
Apr 19 07:42:09 radiusd[15668]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[185]: Failed to find "sql" in the "modules" section.
Apr 19 07:42:09 radiusd[15668]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[185]: Failed to parse "sql" entry.
Apr 19 07:42:09 radiusd[15668]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[69]: Errors parsing authorize section.
Apr 19 07:42:09 radiusd[15668]: Failed to load virtual server <default>Apr 19 07:42:23 check_reload_status: Syncing firewall
Apr 19 07:42:23 php: /pkg_edit.php: The command '/usr/local/etc/rc.d/radiusd.sh stop' returned exit code '1', the output was 'radiusd not running?'
Apr 19 07:42:23 php: /pkg_edit.php: The command '/usr/local/etc/rc.d/radiusd.sh stop' returned exit code '1', the output was 'radiusd not running?'
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Attempting to connect to radius@localhost:3306/radius
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
Apr 19 07:42:25 radiusd[23860]: rlm_sql_mysql: Starting connect to MySQL server for #0
Apr 19 07:42:25 radiusd[23860]: rlm_sql_mysql: Couldn't connect socket to MySQL server radius@localhost:radius
Apr 19 07:42:25 radiusd[23860]: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Failed to connect DB handle #0
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0
Apr 19 07:42:25 radiusd[23860]: Failed to load clients from SQL.
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Closing sqlsocket 4
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Closing sqlsocket 3
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Closing sqlsocket 2
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Closing sqlsocket 1
Apr 19 07:42:25 radiusd[23860]: rlm_sql (sql): Closing sqlsocket 0
Apr 19 07:42:25 radiusd[23860]: /usr/pbi/freeradius-i386/etc/raddb/sql.conf[2]: Instantiation failed for module "sql"
Apr 19 07:42:25 radiusd[23860]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[185]: Failed to find "sql" in the "modules" section.
Apr 19 07:42:25 radiusd[23860]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[185]: Failed to parse "sql" entry.
Apr 19 07:42:25 radiusd[23860]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[69]: Errors parsing authorize section.
Apr 19 07:42:25 radiusd[23860]: Failed to load virtual server <default>Apr 19 13:16:40 php: /diag_logs.php: Session timed out for user 'admin' from: 172.22.2.170
Apr 20 03:24:36 dhclient: RENEW
Apr 20 03:24:36 dhclient: Creating resolv.confthats the log..im running version 2.1 of the pfsense but it doesnt start in the older version either. I dont have the captive portal active but im trying to activate sql.</default></default>
-
When using MySQL with freeradius then you need an SQL server somewhere. FR2 does not have any - it just connects to a SQL server.
Further there is a problem that the configuration is working fpr freeradius 2.1.12 which installs on pfsense 2.0.x.
On pfsense 2.1 the developers updated the package to version 2.2.0. But this version is not represented in the freeradius.inc file. I posted this twice on the mailing list but the did not update the "old" version to 2.2.0, too.But this could be probably easily fix. Modify:
/usr/local/pkg/freeradius.inc
On lines 83 and 217.
Replace
freeradius-2.1.12
with
freeradius-2.2.0
Then restarting freeradius could do the trick and if it does not then restarting pfsense will do it.
-
I've also pushed a fix to check installed freeradius lib version. This may reduce config errors.
-
Updates pkg v1.6.7:
-
Added: Possibility to use pfsense's Certificate Revocation List (CRL) with freeradius. Thank you to marcelloc for the code contribution. I really appreciate that and this was I feature I would like to add a long time ago but never was able to code it.
-
Added: Check if freeradius version 2.1.12 is used or 2.2.0. Thanks again to marcelloc.
-
Removed: Unneeded possibility to export Client.p12 file from FR2 - EAP GUI. This can be done much more comfortable from pfsense Cert Manager.
Known bugs:
-
When using "stop/start accounting on CP then "Amount of Time/Amount of Traffic" isn't working correctly.
http://redmine.pfsense.org/issues/2164 -
When using CP + RADIUS + Vouchers and "reauthenticate every minute" is enabled then CP sends the voucher as username to RADIUS. This causes RADIUS to disconnect the "user/voucher" because of an unknown/wrong "username".
http://redmine.pfsense.org/issues/2155 -
When stop/start accounting on CP is enabled than the syslog shows many "wrong order" or "Login found bot no logout detected". This seems to not affect the usage of RADIUS but it is not 100% correct.
http://redmine.pfsense.org/issues/2143
-
-
how fast will that update show in the snapshot???i see its in the github ??
-
how fast will that update show in the snapshot???i see its in the github ??
The code is already pushed, just reinstall the package to get these fixes.
-
eish dont know if im doing something wrong but it looks a bit better but still no sql…I do see its still trying to connect to localhost even that I set it to ip of sql server.
Apr 20 20:45:37 php: /pkg_edit.php: The command '/usr/local/etc/rc.d/radiusd.sh stop' returned exit code '1', the output was 'radiusd not running?'
Apr 20 20:45:37 php: /pkg_edit.php: The command '/usr/local/etc/rc.d/radiusd.sh stop' returned exit code '1', the output was 'radiusd not running?'
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Attempting to connect to radius@localhost:3306/radius
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
Apr 20 20:45:39 radiusd[21851]: rlm_sql_mysql: Starting connect to MySQL server for #0
Apr 20 20:45:39 radiusd[21851]: rlm_sql_mysql: Couldn't connect socket to MySQL server radius@localhost:radius
Apr 20 20:45:39 radiusd[21851]: rlm_sql_mysql: Mysql error 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Failed to connect DB handle #0
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0
Apr 20 20:45:39 radiusd[21851]: Failed to load clients from SQL.
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Closing sqlsocket 4
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Closing sqlsocket 3
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Closing sqlsocket 2
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Closing sqlsocket 1
Apr 20 20:45:39 radiusd[21851]: rlm_sql (sql): Closing sqlsocket 0
Apr 20 20:45:39 radiusd[21851]: /usr/pbi/freeradius-i386/etc/raddb/sql.conf[2]: Instantiation failed for module "sql"
Apr 20 20:45:39 radiusd[21851]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[185]: Failed to find "sql" in the "modules" section.
Apr 20 20:45:39 radiusd[21851]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[185]: Failed to parse "sql" entry.
Apr 20 20:45:39 radiusd[21851]: /usr/pbi/freeradius-i386/etc/raddb/sites-enabled/default[69]: Errors parsing authorize section.
Apr 20 20:45:39 radiusd[21851]: Failed to load virtual server <default></default> -
@skoenman
there was a small typo in the freeradius.inc file. Try to reinstall the package and please try again. -
I have successfully setup WPA2 Enterprise with EAP-TLS. Is there a way to create a user, that is not allowed to login with a password? I just want to use certificates and I have noticed that I can login (via MSCHAPv2 I guess) without certificates by just providing the user/password combo I created. Leaving the password entry empty allows the user to login without any password, so that is not an option.
For a test, I removed "Cleartext-Password :=" leaving just the username in the file "users". That seems to prevent the user from logging in with an empty password while still allowing login using certificates.
Is there a more elegant way to do this? Don't know if it is a supported option to just put a user in "users" without any option afterwards. But if it was, could it be made an option in the in users sections of the freeradius2 package?