Hi guys, I am beginner in FR. I want to be able to delay the activation of the login. For example i can create an user monday, but i just want allow him to connect only from friday to logon on my network. I tried to use the attribute acct-session-start on the user, but when i use it one user, the user can never log. I get this from the log: Thu May 28 16:18:16 2015 : Info: Ready to process requests. rad_recv: Access-Request packet from host 127.0.0.1 port 39465, id=155, length=277 ChilliSpot-Version = "1.3.0" User-Name = "day2" User-Password = "day2" Service-Type = Login-User Acct-Session-Id = "5567077800000003" Framed-IP-Address = 10.10.4.200 NAS-Port-Type = Wireless-802.11 NAS-Port = 3 NAS-Port-Id = "00000003" Calling-Station-Id = "00-1B-77-16-34-1A" Called-Station-Id = "00-50-56-B2-BF-8D" NAS-IP-Address = 10.10.4.254 NAS-Identifier = "vlan4" WISPr-Location-ID = "isocc=,cc=,ac=,network=Coova,Vlan4_ssid" WISPr-Location-Name = "Vlan_4" WISPr-Logoff-URL = " http://10.10.4.254:3990/logoff " Message-Authenticator = 0xee48deacd07a8f3d13df74480fa48198 Thu May 28 16:19:09 2015 : Info: # Executing section authorize from file /etc/freeradius/sites-enabled/default Thu May 28 16:19:09 2015 : Info: +- entering group authorize {...} Thu May 28 16:19:09 2015 : Info: ++? if (!NAS-IP-Address) Thu May 28 16:19:09 2015 : Info: ? Evaluating !(NAS-IP-Address) -> FALSE Thu May 28 16:19:09 2015 : Info: ++? if (!NAS-IP-Address) -> FALSE Thu May 28 16:19:09 2015 : Info: ++[preprocess] returns ok Thu May 28 16:19:09 2015 : Info: ++[chap] returns noop Thu May 28 16:19:09 2015 : Info: ++[mschap] returns noop Thu May 28 16:19:09 2015 : Info: ++[digest] returns noop Thu May 28 16:19:09 2015 : Info: [suffix] No '@' in User-Name = "day2", looking up realm NULL Thu May 28 16:19:09 2015 : Info: [suffix] No such realm "NULL" Thu May 28 16:19:09 2015 : Info: ++[suffix] returns noop Thu May 28 16:19:09 2015 : Info: [eap] No EAP-Message, not doing EAP Thu May 28 16:19:09 2015 : Info: ++[eap] returns noop Thu May 28 16:19:09 2015 : Info: [sql] expand: %{User-Name} -> day2 Thu May 28 16:19:09 2015 : Info: [sql] sql_set_user escaped user --> 'day2' Thu May 28 16:19:09 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 3 Thu May 28 16:19:09 2015 : Info: [sql] expand: SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id -> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'day2' ORDER BY id Thu May 28 16:19:09 2015 : Info: [sql] expand: SELECT groupname FROM usergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority -> SELECT groupname FROM usergroup WHERE username = 'day2' ORDER BY priority Thu May 28 16:19:09 2015 : Info: [sql] expand: SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = '%{Sql-Group}' ORDER BY id -> SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'vlan_4' ORDER BY id Thu May 28 16:19:09 2015 : Debug: rlm_sql (sql): Released sql socket id: 3 Thu May 28 16:19:09 2015 : Info: [sql] User day2 not found Thu May 28 16:19:09 2015 : Info: ++[sql] returns notfound Thu May 28 16:19:09 2015 : Debug: rlm_sqlcounter: Entering module authorize code Thu May 28 16:19:09 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Thu May 28 16:19:09 2015 : Info: ++[chillispot_max_bytes] returns noop Thu May 28 16:19:09 2015 : Debug: rlm_sqlcounter: Entering module authorize code Thu May 28 16:19:09 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Thu May 28 16:19:09 2015 : Info: ++[noresetcounter] returns noop Thu May 28 16:19:09 2015 : Debug: rlm_sqlcounter: Entering module authorize code Thu May 28 16:19:09 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Thu May 28 16:19:09 2015 : Info: ++[dailycounter] returns noop Thu May 28 16:19:09 2015 : Info: ++[expiration] returns noop Thu May 28 16:19:09 2015 : Info: ++[logintime] returns noop Thu May 28 16:19:09 2015 : Info: [pap] WARNING! No "known good" password found for the user. Authentication may fail because of this. Thu May 28 16:19:09 2015 : Info: ++[pap] returns noop Thu May 28 16:19:09 2015 : Info: ERROR: No authenticate method (Auth-Type) found for the request: Rejecting the user Thu May 28 16:19:09 2015 : Info: Failed to authenticate the user. Thu May 28 16:19:09 2015 : Info: Using Post-Auth-Type Reject Thu May 28 16:19:09 2015 : Info: # Executing group from file /etc/freeradius/sites-enabled/default Thu May 28 16:19:09 2015 : Info: +- entering group REJECT {...} Thu May 28 16:19:09 2015 : Info: [sql] expand: %{User-Name} -> day2 Thu May 28 16:19:09 2015 : Info: [sql] sql_set_user escaped user --> 'day2' Thu May 28 16:19:09 2015 : Info: [sql] expand: %{User-Password} -> day2 Thu May 28 16:19:09 2015 : Info: [sql] expand: INSERT INTO radpostauth (user, pass, reply, date) VALUES ( '%{User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply acket-Type}', '%S') -> INSERT INTO radpostauth (user, pass, reply, date) VALUES ( 'day2', 'day2', 'Access-Reject', ' 2015-05-28 16 :19:09') Thu May 28 16:19:09 2015 : Debug: rlm_sql (sql) in sql_postauth: query is INSERT INTO radpostauth (user, pass, reply, date) VALUES ( 'day2', 'day2', 'Access-Reject', ' 2015-05-28 16 :19:09') Thu May 28 16:19:09 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 2 Thu May 28 16:19:09 2015 : Debug: rlm_sql (sql): Released sql socket id: 2 Thu May 28 16:19:09 2015 : Info: ++[sql] returns ok Thu May 28 16:19:09 2015 : Info: [attr_filter.access_reject] expand: %{User-Name} -> day2 Thu May 28 16:19:09 2015 : Debug: attr_filter: Matched entry DEFAULT at line 11 But if i dont give him, the attribute he can logon. If somone has any clue ? Thanks
On May 28, 2015, at 10:51 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Hi guys, I am beginner in FR. I want to be able to delay the activation of the login. For example i can create an user monday, but i just want allow him to connect only from friday to logon on my network. I tried to use the attribute acct-session-start on the user, but when i use it one user, the user can never log.
There is no Acct-Session-Start attribute. Delete it from your SQL database. What you want is the Current-Time attribute: http://wiki.freeradius.org/config/Users Check that the Current-Time is smaller than a particular date. Alan DeKok.
Hi, thanks for the help, So I added in policy.conf this check_validity { update control { Current-Time := "%l" } if (Date > control:Current-Time) { update reply { Reply-Message := "account not yet active" } reject } } I created the attribute date, but when i tried to logon, i receive reject response This is freeradius -XXX rad_recv: Access-Request packet from host 127.0.0.1 port 36099, id=237, length=277 ChilliSpot-Version = "1.3.0" User-Name = "day2" User-Password = "day2" Service-Type = Login-User Acct-Session-Id = "55680ead00000005" Framed-IP-Address = 10.10.4.200 NAS-Port-Type = Wireless-802.11 NAS-Port = 5 NAS-Port-Id = "00000005" Calling-Station-Id = "00-1B-77-16-34-1A" Called-Station-Id = "00-50-56-B2-BF-8D" NAS-IP-Address = 10.10.4.254 NAS-Identifier = "vlan4" WISPr-Location-ID = "isocc=,cc=,ac=,network=Coova,Vlan4_ssid" WISPr-Location-Name = "Vlan_4" WISPr-Logoff-URL = "http://10.10.4.254:3990/logoff" Message-Authenticator = 0x844feffa98bf807597e7e264e9d3b4c4 Fri May 29 10:23:34 2015 : Info: # Executing section authorize from file /etc/freeradius/sites-enabled/default Fri May 29 10:23:34 2015 : Info: +- entering group authorize {...} Fri May 29 10:23:34 2015 : Info: ++? if (!NAS-IP-Address) Fri May 29 10:23:34 2015 : Info: ? Evaluating !(NAS-IP-Address) -> FALSE Fri May 29 10:23:34 2015 : Info: ++? if (!NAS-IP-Address) -> FALSE Fri May 29 10:23:34 2015 : Info: ++- entering policy check_validity {...} Fri May 29 10:23:34 2015 : Debug: WARNING: You are modifying the value of virtual attribute Current-Time. This is not supported. Fri May 29 10:23:34 2015 : Info: expand: %l -> 1432887814 Fri May 29 10:23:34 2015 : Info: +++[control] returns notfound Fri May 29 10:23:34 2015 : Info: +++? if (Date > control:Current-Time) Fri May 29 10:23:34 2015 : Info: (Attribute Date was not found) Fri May 29 10:23:34 2015 : Info: ? Evaluating (Date > control:Current-Time) -> FALSE Fri May 29 10:23:34 2015 : Info: +++? if (Date > control:Current-Time) -> FALSE Fri May 29 10:23:34 2015 : Info: ++- policy check_validity returns notfound Fri May 29 10:23:34 2015 : Info: ++[preprocess] returns ok Fri May 29 10:23:34 2015 : Info: ++[chap] returns noop Fri May 29 10:23:34 2015 : Info: ++[mschap] returns noop Fri May 29 10:23:34 2015 : Info: ++[digest] returns noop Fri May 29 10:23:34 2015 : Info: [suffix] No '@' in User-Name = "day2", looking up realm NULL Fri May 29 10:23:34 2015 : Info: [suffix] No such realm "NULL" Fri May 29 10:23:34 2015 : Info: ++[suffix] returns noop Fri May 29 10:23:34 2015 : Info: [eap] No EAP-Message, not doing EAP Fri May 29 10:23:34 2015 : Info: ++[eap] returns noop Fri May 29 10:23:34 2015 : Info: [sql] expand: %{User-Name} -> day2 Fri May 29 10:23:34 2015 : Info: [sql] sql_set_user escaped user --> 'day2' Fri May 29 10:23:34 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 3 Fri May 29 10:23:34 2015 : Info: [sql] expand: SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id -> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'day2' ORDER BY id Fri May 29 10:23:34 2015 : Info: [sql] expand: SELECT groupname FROM usergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority -> SELECT groupname FROM usergroup WHERE username = 'day2' ORDER BY priority Fri May 29 10:23:34 2015 : Info: [sql] expand: SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = '%{Sql-Group}' ORDER BY id -> SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'vlan_4' ORDER BY id Fri May 29 10:23:34 2015 : Debug: rlm_sql (sql): Released sql socket id: 3 Fri May 29 10:23:34 2015 : Info: [sql] User day2 not found Fri May 29 10:23:34 2015 : Info: ++[sql] returns notfound Fri May 29 10:23:34 2015 : Debug: rlm_sqlcounter: Entering module authorize code Fri May 29 10:23:34 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Fri May 29 10:23:34 2015 : Info: ++[chillispot_max_bytes] returns noop Fri May 29 10:23:34 2015 : Debug: rlm_sqlcounter: Entering module authorize code Fri May 29 10:23:34 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Fri May 29 10:23:34 2015 : Info: ++[noresetcounter] returns noop Fri May 29 10:23:34 2015 : Debug: rlm_sqlcounter: Entering module authorize code Fri May 29 10:23:34 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Fri May 29 10:23:34 2015 : Info: ++[dailycounter] returns noop Fri May 29 10:23:34 2015 : Info: ++[expiration] returns noop Fri May 29 10:23:34 2015 : Info: ++[logintime] returns noop Fri May 29 10:23:34 2015 : Info: [pap] WARNING! No "known good" password found for the user. Authentication may fail because of this. Fri May 29 10:23:34 2015 : Info: ++[pap] returns noop Fri May 29 10:23:34 2015 : Info: ERROR: No authenticate method (Auth-Type) found for the request: Rejecting the user Fri May 29 10:23:34 2015 : Info: Failed to authenticate the user. Fri May 29 10:23:34 2015 : Info: Using Post-Auth-Type Reject Fri May 29 10:23:34 2015 : Info: # Executing group from file /etc/freeradius/sites-enabled/default Fri May 29 10:23:34 2015 : Info: +- entering group REJECT {...} Fri May 29 10:23:34 2015 : Info: [sql] expand: %{User-Name} -> day2 Fri May 29 10:23:34 2015 : Info: [sql] sql_set_user escaped user --> 'day2' Fri May 29 10:23:34 2015 : Info: [sql] expand: %{User-Password} -> day2 Fri May 29 10:23:34 2015 : Info: [sql] expand: INSERT INTO radpostauth (user, pass, reply, date) VALUES ( '%{User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S') -> INSERT INTO radpostauth (user, pass, reply, date) VALUES ( 'day2', 'day2', 'Access-Reject', '2015-05-29 10:23:34') Fri May 29 10:23:34 2015 : Debug: rlm_sql (sql) in sql_postauth: query is INSERT INTO radpostauth (user, pass, reply, date) VALUES ( 'day2', 'day2', 'Access-Reject', '2015-05-29 10:23:34') Fri May 29 10:23:34 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 2 Fri May 29 10:23:34 2015 : Debug: rlm_sql (sql): Released sql socket id: 2 Fri May 29 10:23:34 2015 : Info: ++[sql] returns ok Fri May 29 10:23:34 2015 : Info: [attr_filter.access_reject] expand: %{User-Name} -> day2 Fri May 29 10:23:34 2015 : Debug: attr_filter: Matched entry DEFAULT at line 11 Fri May 29 10:23:34 2015 : Info: ++[attr_filter.access_reject] returns updated Fri May 29 10:23:34 2015 : Info: Delaying reject of request 0 for 1 seconds Fri May 29 10:23:34 2015 : Debug: Going to the next request ----- Mail original ----- De: "Alan DeKok" <aland@deployingradius.com> À: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Envoyé: Jeudi 28 Mai 2015 16:56:21 Objet: Re: acct-session-start attribute ? On May 28, 2015, at 10:51 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Hi guys, I am beginner in FR. I want to be able to delay the activation of the login. For example i can create an user monday, but i just want allow him to connect only from friday to logon on my network. I tried to use the attribute acct-session-start on the user, but when i use it one user, the user can never log.
There is no Acct-Session-Start attribute. Delete it from your SQL database. What you want is the Current-Time attribute: http://wiki.freeradius.org/config/Users Check that the Current-Time is smaller than a particular date. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On May 29, 2015, at 4:29 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Hi, thanks for the help, So I added in policy.conf this check_validity { update control { Current-Time := "%l"
Don't do that. Current-Time is automatically set.
} if (Date > control:Current-Time) {
Don't do that. What's "Date" ?
update reply { Reply-Message := "account not yet active" } reject } } I created the attribute date, but when i tried to logon, i receive reject response
No, you didn't create the attribute Date.
This is freeradius -XXX ... Fri May 29 10:23:34 2015 : Debug: WARNING: You are modifying the value of virtual attribute Current-Time. This is not supported.
Does that message have any meaning for you?
Fri May 29 10:23:34 2015 : Info: (Attribute Date was not found)
And that message? Instead, do: if (Current-Time < "1 January 2015") { ... } i.e. use a DATE. A real, humanly readable date. Not the string "Date". Alan DeKok.
Thanks, But I think i miss something, When I create an user, i want to be able to put a date when this user will be able to logon I added this in the file dictionnary ATTRIBUTE Date 3003 string And i want to compare this date with the current date, but i think i have to add sql request to get this, can i do my query in the police.conf file ? ----- Mail original ----- De: "Alan DeKok" <aland@deployingradius.com> À: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Envoyé: Vendredi 29 Mai 2015 13:23:44 Objet: Re: acct-session-start attribute ? On May 29, 2015, at 4:29 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Hi, thanks for the help, So I added in policy.conf this check_validity { update control { Current-Time := "%l"
Don't do that. Current-Time is automatically set.
} if (Date > control:Current-Time) {
Don't do that. What's "Date" ?
update reply { Reply-Message := "account not yet active" } reject } } I created the attribute date, but when i tried to logon, i receive reject response
No, you didn't create the attribute Date.
This is freeradius -XXX ... Fri May 29 10:23:34 2015 : Debug: WARNING: You are modifying the value of virtual attribute Current-Time. This is not supported.
Does that message have any meaning for you?
Fri May 29 10:23:34 2015 : Info: (Attribute Date was not found)
And that message? Instead, do: if (Current-Time < "1 January 2015") { ... } i.e. use a DATE. A real, humanly readable date. Not the string "Date". Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On May 29, 2015, at 8:27 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
When I create an user, i want to be able to put a date when this user will be able to logon I added this in the file dictionnary ATTRIBUTE Date 3003 string
That defines an attribute name, and a data type. You want it to have data type "date", not "string". You should give it a more descriptive name, like "Account-Start-Date". That makes policies easier to understand.
And i want to compare this date with the current date, but i think i have to add sql request to get this, can i do my query in the police.conf file ?
Yes. But you can't just say "use SQL". You have to understand the process. Where are the user credentials stored? i.e. name, password, etc. SQL? If so, put the Account-Start-Date attribute in SQL, along with the other user information. Use the ":=" operator to set the value of the attribute. And give it a value which is a date. Then in your policy (which has to run AFTER the sql module), compare the attributes. In v2: if (Account-Start-Date < "%{Current-Time}") { reject } Alan DeKok.
Thanks, but i still got a problem, Whatever I give for my date attribut , I match the if(for the date) so I cant logon Maybe I don't give a good date format ? I use this kind of date " May 29 2015 14:38:27 CEST " rad_recv: Access-Request packet from host 127.0.0.1 port 52328, id=51, length=277 ChilliSpot-Version = "1.3.0" User-Name = "day2" User-Password = "day2" Service-Type = Login-User Acct-Session-Id = "55686fb900000005" Framed-IP-Address = 10.10.4.200 NAS-Port-Type = Wireless-802.11 NAS-Port = 5 NAS-Port-Id = "00000005" Calling-Station-Id = "00-1B-77-16-34-1A" Called-Station-Id = "00-50-56-B2-BF-8D" NAS-IP-Address = 10.10.4.254 NAS-Identifier = "vlan4" WISPr-Location-ID = "isocc=,cc=,ac=,network=Coova,Vlan4_ssid" WISPr-Location-Name = "Vlan_4" WISPr-Logoff-URL = "http://10.10.4.254:3990/logoff" Message-Authenticator = 0x71c57c2e60e12e1854af8e9c7ff95db0 Fri May 29 15:57:33 2015 : Info: # Executing section authorize from file /etc/freeradius/sites-enabled/default Fri May 29 15:57:33 2015 : Info: +- entering group authorize {...} Fri May 29 15:57:33 2015 : Info: ++? if (!NAS-IP-Address) Fri May 29 15:57:33 2015 : Info: ? Evaluating !(NAS-IP-Address) -> FALSE Fri May 29 15:57:33 2015 : Info: ++? if (!NAS-IP-Address) -> FALSE Fri May 29 15:57:33 2015 : Info: ++[preprocess] returns ok Fri May 29 15:57:33 2015 : Info: ++[chap] returns noop Fri May 29 15:57:33 2015 : Info: ++[mschap] returns noop Fri May 29 15:57:33 2015 : Info: ++[digest] returns noop Fri May 29 15:57:33 2015 : Info: [suffix] No '@' in User-Name = "day2", looking up realm NULL Fri May 29 15:57:33 2015 : Info: [suffix] No such realm "NULL" Fri May 29 15:57:33 2015 : Info: ++[suffix] returns noop Fri May 29 15:57:33 2015 : Info: [eap] No EAP-Message, not doing EAP Fri May 29 15:57:33 2015 : Info: ++[eap] returns noop Fri May 29 15:57:33 2015 : Info: [sql] expand: %{User-Name} -> day2 Fri May 29 15:57:33 2015 : Info: [sql] sql_set_user escaped user --> 'day2' Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 3 Fri May 29 15:57:33 2015 : Info: [sql] expand: SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id -> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'day2' ORDER BY id Fri May 29 15:57:33 2015 : Info: [sql] User found in radcheck table Fri May 29 15:57:33 2015 : Info: [sql] expand: SELECT id, username, attribute, value, op FROM radreply WHERE username = '%{SQL-User-Name}' ORDER BY id -> SELECT id, username, attribute, value, op FROM radreply WHERE username = 'day2' ORDER BY id Fri May 29 15:57:33 2015 : Info: [sql] expand: SELECT groupname FROM usergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority -> SELECT groupname FROM usergroup WHERE username = 'day2' ORDER BY priority Fri May 29 15:57:33 2015 : Info: [sql] expand: SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = '%{Sql-Group}' ORDER BY id -> SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'vlan_4' ORDER BY id Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Released sql socket id: 3 Fri May 29 15:57:33 2015 : Info: ++[sql] returns ok Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: Entering module authorize code Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Fri May 29 15:57:33 2015 : Info: ++[chillispot_max_bytes] returns noop Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: Entering module authorize code Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Fri May 29 15:57:33 2015 : Info: ++[noresetcounter] returns noop Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: Entering module authorize code Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: Could not find Check item value pair Fri May 29 15:57:33 2015 : Info: ++[dailycounter] returns noop Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: Entering module authorize code Fri May 29 15:57:33 2015 : Debug: WARNING: Please replace '%k' with '${key}' Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: 'SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date'' Fri May 29 15:57:33 2015 : Info: [Acc-start-date] expand: SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date' -> SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' Fri May 29 15:57:33 2015 : Debug: WARNING: Please replace '%S' with '${sqlmod-inst}' Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: '%{sql:SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date'}' Fri May 29 15:57:33 2015 : Info: [Acc-start-date] sql_xlat Fri May 29 15:57:33 2015 : Info: [Acc-start-date] expand: %{User-Name} -> day2 Fri May 29 15:57:33 2015 : Info: [Acc-start-date] sql_set_user escaped user --> 'day2' Fri May 29 15:57:33 2015 : Info: [Acc-start-date] expand: SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' -> SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 2 Fri May 29 15:57:33 2015 : Info: [Acc-start-date] sql_xlat finished Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Released sql socket id: 2 Fri May 29 15:57:33 2015 : Info: [Acc-start-date] expand: %{sql:SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date'} -> May 29 2015 14:38:27 CEST Fri May 29 15:57:33 2015 : Debug: rlm_sqlcounter: No integer found in string "May 29 2015 14:38:27 CEST" Fri May 29 15:57:33 2015 : Info: ++[Acc-start-date] returns noop Fri May 29 15:57:33 2015 : Info: ++- entering policy check_validity {...} Fri May 29 15:57:33 2015 : Info: +++? if (Acc-start-date > "%{Current-Time}") Fri May 29 15:57:33 2015 : Info: expand: %{Current-Time} -> Fri May 29 15:57:33 2015 : Debug: WARNING: Please replace '%k' with '${key}' Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: 'SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date'' Fri May 29 15:57:33 2015 : Info: expand: SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date' -> SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' Fri May 29 15:57:33 2015 : Debug: WARNING: Please replace '%S' with '${sqlmod-inst}' Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: '%{sql:SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date'}' Fri May 29 15:57:33 2015 : Info: sql_xlat Fri May 29 15:57:33 2015 : Info: expand: %{User-Name} -> day2 Fri May 29 15:57:33 2015 : Info: sql_set_user escaped user --> 'day2' Fri May 29 15:57:33 2015 : Info: expand: SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' -> SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 1 Fri May 29 15:57:33 2015 : Info: sql_xlat finished Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Released sql socket id: 1 Fri May 29 15:57:33 2015 : Info: expand: %{sql:SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date'} -> May 29 2015 14:38:27 CEST Fri May 29 15:57:33 2015 : Info: ? Evaluating (Acc-start-date > "%{Current-Time}") -> TRUE Fri May 29 15:57:33 2015 : Info: +++? if (Acc-start-date > "%{Current-Time}") -> TRUE Fri May 29 15:57:33 2015 : Info: +++- entering if (Acc-start-date > "%{Current-Time}") {...} Fri May 29 15:57:33 2015 : Info: ++++[reject] returns reject Fri May 29 15:57:33 2015 : Info: +++- if (Acc-start-date > "%{Current-Time}") returns reject Fri May 29 15:57:33 2015 : Info: ++- policy check_validity returns reject Fri May 29 15:57:33 2015 : Info: Using Post-Auth-Type Reject Fri May 29 15:57:33 2015 : Info: # Executing group from file /etc/freeradius/sites-enabled/default Fri May 29 15:57:33 2015 : Info: +- entering group REJECT {...} Fri May 29 15:57:33 2015 : Info: [sql] expand: %{User-Name} -> day2 Fri May 29 15:57:33 2015 : Info: [sql] sql_set_user escaped user --> 'day2' Fri May 29 15:57:33 2015 : Info: [sql] expand: %{User-Password} -> day2 Fri May 29 15:57:33 2015 : Info: [sql] expand: INSERT INTO radpostauth (user, pass, reply, date) VALUES ( '%{User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S') -> INSERT INTO radpostauth (user, pass, reply, date) VALUES ( 'day2', 'day2', 'Access-Reject', '2015-05-29 15:57:33') Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql) in sql_postauth: query is INSERT INTO radpostauth (user, pass, reply, date) VALUES ( 'day2', 'day2', 'Access-Reject', '2015-05-29 15:57:33') Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Reserving sql socket id: 0 Fri May 29 15:57:33 2015 : Debug: rlm_sql (sql): Released sql socket id: 0 Fri May 29 15:57:33 2015 : Info: ++[sql] returns ok Fri May 29 15:57:33 2015 : Info: [attr_filter.access_reject] expand: %{User-Name} -> day2 Fri May 29 15:57:33 2015 : Debug: attr_filter: Matched entry DEFAULT at line 11 Fri May 29 15:57:33 2015 : Info: ++[attr_filter.access_reject] returns updated Fri May 29 15:57:33 2015 : Info: Delaying reject of request 0 for 1 seconds ----- Mail original ----- De: "Alan DeKok" <aland@deployingradius.com> À: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Envoyé: Vendredi 29 Mai 2015 15:11:41 Objet: Re: acct-session-start attribute ? On May 29, 2015, at 8:27 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
When I create an user, i want to be able to put a date when this user will be able to logon I added this in the file dictionnary ATTRIBUTE Date 3003 string
That defines an attribute name, and a data type. You want it to have data type "date", not "string". You should give it a more descriptive name, like "Account-Start-Date". That makes policies easier to understand.
And i want to compare this date with the current date, but i think i have to add sql request to get this, can i do my query in the police.conf file ?
Yes. But you can't just say "use SQL". You have to understand the process. Where are the user credentials stored? i.e. name, password, etc. SQL? If so, put the Account-Start-Date attribute in SQL, along with the other user information. Use the ":=" operator to set the value of the attribute. And give it a value which is a date. Then in your policy (which has to run AFTER the sql module), compare the attributes. In v2: if (Account-Start-Date < "%{Current-Time}") { reject } Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On May 29, 2015, at 10:05 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Thanks, but i still got a problem,
One issue is that you're not following instructions.
Whatever I give for my date attribut , I match the if(for the date) so I cant logon Maybe I don't give a good date format ? I use this kind of date " May 29 2015 14:38:27 CEST "
That should work.
Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: 'SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date'' Fri May 29 15:57:33 2015 : Info: [Acc-start-date] expand: SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date' -> SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' Fri May 29 15:57:33 2015 : Debug: WARNING: Please replace '%S' with '${sqlmod-inst}' Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: '%{sql:SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date'}'
What are you doing there? That makes no sense. Don't do that. The normal SQL module already takes care of setting the attribute. If you're having trouble with SQL (and you are), just put the attribute into the "users" file. Simplify your tests. Maybe try different date formats... Right now, you're trying to do it the most complicated way possible. I have no idea why. Alan DeKok.
Thanks for your time, But I am a bit lost, I am beginner on freeradius. - Should I create the sql query to get my attribute(acc-start-date) ? Or freeRadius will do it himself ?
Right now, you're trying to do it the most complicated way possible. I have no idea why. If you see a easier way to do it, can you give a hint how I should do it ?
To resume my configuration File /site-available/default authorize { if (!NAS-IP-Address) { reject } sql chillispot_max_bytes noresetcounter dailycounter # check date check_validity And in the file ploicy.conf check_validity { if (Acc-start-date < "%{Current-Time}") { reject } } ----- Mail original ----- De: "Alan DeKok" <aland@deployingradius.com> À: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Envoyé: Vendredi 29 Mai 2015 16:59:11 Objet: Re: acct-session-start attribute ? On May 29, 2015, at 10:05 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Thanks, but i still got a problem,
One issue is that you're not following instructions.
Whatever I give for my date attribut , I match the if(for the date) so I cant logon Maybe I don't give a good date format ? I use this kind of date " May 29 2015 14:38:27 CEST "
That should work.
Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: 'SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date'' Fri May 29 15:57:33 2015 : Info: [Acc-start-date] expand: SELECT value FROM `radcheck` WHERE UserName = '%{User-Name}' AND attribute = 'Acc-start-date' -> SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date' Fri May 29 15:57:33 2015 : Debug: WARNING: Please replace '%S' with '${sqlmod-inst}' Fri May 29 15:57:33 2015 : Debug: sqlcounter_expand: '%{sql:SELECT value FROM `radcheck` WHERE UserName = 'day2' AND attribute = 'Acc-start-date'}'
What are you doing there? That makes no sense. Don't do that. The normal SQL module already takes care of setting the attribute. If you're having trouble with SQL (and you are), just put the attribute into the "users" file. Simplify your tests. Maybe try different date formats... Right now, you're trying to do it the most complicated way possible. I have no idea why. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Jun 2, 2015, at 5:13 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Thanks for your time, But I am a bit lost, I am beginner on freeradius. - Should I create the sql query to get my attribute(acc-start-date) ? Or freeRadius will do it himself ?
You should start reading my messages. I've explained this repeatedly.
Right now, you're trying to do it the most complicated way possible. I have no idea why. If you see a easier way to do it, can you give a hint how I should do it ?
I already explained that. Alan DeKok.
Hi again, I read all your mails, but I am sorry i still don't understand how it's work. So i got in my sql database Username || Attribute || op || Value User User-Password := pass User Acc-Start-date := Jun 8 2015 08:50:46 CEST I created the attribute Acc-Start-Date in the file dictionnary.conf. And in the /site-available/default in the authorise section if ( Acc-Start-Date < "%{Current-Time}" ) { reject } So I guess, i have to add something to allow freeradius to find my custom attribute. Thanks again for your time. ----- Mail original ----- De: "Alan DeKok" <aland@deployingradius.com> À: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Envoyé: Mardi 2 Juin 2015 14:17:36 Objet: Re: acct-session-start attribute ? On Jun 2, 2015, at 5:13 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
Thanks for your time, But I am a bit lost, I am beginner on freeradius. - Should I create the sql query to get my attribute(acc-start-date) ? Or freeRadius will do it himself ?
You should start reading my messages. I've explained this repeatedly.
Right now, you're trying to do it the most complicated way possible. I have no idea why. If you see a easier way to do it, can you give a hint how I should do it ?
I already explained that. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Jun 4, 2015, at 11:17 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
So i got in my sql database Username || Attribute || op || Value User User-Password := pass User Acc-Start-date := Jun 8 2015 08:50:46 CEST
That should work.
I created the attribute Acc-Start-Date in the file dictionnary.conf.
Is it "date" or "integer"? That matters.
And in the /site-available/default in the authorise section if ( Acc-Start-Date < "%{Current-Time}" ) { reject }
That should work.
So I guess, i have to add something to allow freeradius to find my custom attribute.
No. It should work. Alan DeKok.
Hi,
I created the attribute Acc-Start-Date in the file dictionnary.conf. Is it "date" or "integer"? It's date ATTRIBUTE Acc-Start-Date 3003 date
But I still get this error : Fri Jun 5 09:32:27 2015 : Info: ++? if (Acc-Start-Date < "%{Current-Time}") Fri Jun 5 09:32:27 2015 : Info: expand: %{Current-Time} -> Fri Jun 5 09:32:27 2015 : Info: (Attribute Acc-Start-Date was not found) Fri Jun 5 09:32:27 2015 : Info: ? Evaluating (Acc-Start-Date < "%{Current-Time}") -> FALSE Fri Jun 5 09:32:27 2015 : Info: ++? if (Acc-Start-Date < "%{Current-Time}") -> FALSE I am using freeradius V2 root@radius-dev1:~# freeradius -v freeradius: FreeRADIUS Version 2.1.12 ----- Mail original ----- de: "Alan DeKok" <aland@deployingradius.com> À: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Envoyé: Jeudi 4 Juin 2015 17:20:52 Objet: Re: acct-session-start attribute ? On Jun 4, 2015, at 11:17 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
So i got in my sql database Username || Attribute || op || Value User User-Password := pass User Acc-Start-date := Jun 8 2015 08:50:46 CEST
That should work.
I created the attribute Acc-Start-Date in the file dictionnary.conf.
Is it "date" or "integer"? That matters.
And in the /site-available/default in the authorise section if ( Acc-Start-Date < "%{Current-Time}" ) { reject }
That should work.
So I guess, i have to add something to allow freeradius to find my custom attribute.
No. It should work. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi, I try it and now it's my condition is always false, whatever the date. Tue Jun 9 08:56:09 2015 : Info: ++? if (control:Acc-Start-Date < "%{Current-Time}") Tue Jun 9 08:56:09 2015 : Info: expand: %{Current-Time} -> Tue Jun 9 08:56:09 2015 : Info: ? Evaluating (control:Acc-Start-Date < "%{Current-Time}") -> FALSE Tue Jun 9 08:56:09 2015 : Info: ++? if (control:Acc-Start-Date < "%{Current-Time}") -> FALSE Tue Jun 9 08:56:09 2015 : Info: ++[expiration] returns noop Tue Jun 9 08:56:09 2015 : Info: ++[logintime] returns noop Tue Jun 9 08:56:09 2015 : Info: ++[pap] returns updated So i tried to do this ( i use > instead of <) if (control:Acc-Start-Date > "%{Current-Time}") { reject } And now, it's my condition is always true, so I guess I use wrong date format, so i tried some other but I get this Tue Jun 9 09:05:14 2015 : Error: rlm_sql: Failed to create the pair: failed to parse time string "08 06 2015 09:29:58 CEST" I am bit confused, do you have any idea how should i write the date ? ----- Mail original ----- De: "Alan DeKok" <aland@deployingradius.com> À: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Envoyé: Vendredi 5 Juin 2015 21:16:30 Objet: Re: acct-session-start attribute ? On Jun 5, 2015, at 3:47 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
But I still get this error :
Fri Jun 5 09:32:27 2015 : Info: ++? if (Acc-Start-Date < "%{Current-Time}")
Hmm... try: if (control:Acc-Start-Date < "%{Current-Time}") { Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Jun 9, 2015, at 3:07 AM, Jeremy Ravel <Jeremy.Ravel@etu.univ-savoie.fr> wrote:
I try it and now it's my condition is always false, whatever the date.
Well... something is going wrong.
Tue Jun 9 08:56:09 2015 : Info: ++? if (control:Acc-Start-Date < "%{Current-Time}") Tue Jun 9 08:56:09 2015 : Info: expand: %{Current-Time} ->
That's bad. The Current-Time should be there. Honestly, just use v3.0.8. It's *much* better. The debug messages are clearer, too.
Tue Jun 9 08:56:09 2015 : Info: ? Evaluating (control:Acc-Start-Date < "%{Current-Time}") -> FALSE Tue Jun 9 08:56:09 2015 : Info: ++? if (control:Acc-Start-Date < "%{Current-Time}") -> FALSE Tue Jun 9 08:56:09 2015 : Info: ++[expiration] returns noop Tue Jun 9 08:56:09 2015 : Info: ++[logintime] returns noop Tue Jun 9 08:56:09 2015 : Info: ++[pap] returns updated
So i tried to do this ( i use > instead of <) if (control:Acc-Start-Date > "%{Current-Time}") { reject } And now, it's my condition is always true, so I guess I use wrong date format, so i tried some other but I get this
Tue Jun 9 09:05:14 2015 : Error: rlm_sql: Failed to create the pair: failed to parse time string "08 06 2015 09:29:58 CEST"
Because it's not in any standard format.
I am bit confused, do you have any idea how should i write the date ?
How about in the format printed out by the server? Alan DeKok.
participants (2)
-
Alan DeKok -
Jeremy Ravel