Hello,<br><br>I'm working around that and I my solution isn't ok, so I need help.<br> <br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
As you already may know the expiration module only works for expiration date.<br></blockquote><div><br>yes<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
When I had this need (a long time ago and with FR1) I just did the following:<br>
<br>
* I added a new personnal/local attribute in /etc./raddb/dictionnary<br>
ATTRIBUTE My-Local-Date 3000 string<br>
* setup the "hint" module to add the Date for incomming requests:<br>
DEFAULT NAS-IP-ADDRESS == 192.168.1.4<br>
My-Local-Date = `%D`<br>
<br>
* Then I use the local attribute to check the date (for instance if you use the rlm_sql module):<br>
mysql> select UserName,Attribute,op,Value from radcheck where UserName='myloginname';<br>
+-----------------+--------------------+----+--------------------+<br>
| UserName | Attribute | op | Value |<br>
+-----------------+--------------------+----+--------------------+<br>
| myloginname | NAS-IP-Address | =~ | 192.168.1.[4]{1} |<br>
| myloginname | My-Local-Date | <= | 20090731 |<br>
| myloginname | My-Local-Date | >= | 20090526 |<br>
| myloginname | Login-Time | := | Wk0700-2200 |<br>
| myloginname | Cleartext-Password | := | THEPASS |<br>
+-----------------+--------------------+----+--------------------+<br>
5 rows in set (0.00 sec)<br>
<br></blockquote><div><br>I do something similar, but doesn't work.<br><br>--> /etc/freeradius/sites-enable/default <br><br>authorize {<br> switch "%{Realm}" {<br> case '<a href="http://temp.xxx.es">temp.xxx.es</a>' {<br>
update request {<br> Expiration-Init := "%D"<br> }<br> sql<br> }<br><br>--> MYSQL<br><br>
mysql> select * from radcheck where username ="prueba";<br>+-----+----------+--------------------+----+-------------+<br>| id | username | attribute | op | value |<br>+-----+----------+--------------------+----+-------------+<br>
| 228 | prueba | Cleartext-Password | := | prueba | <br>| 227 | prueba | Expiration | := | 10 Jun 2010 | <br>| 226 | prueba | Expiration-Init | >= | 20100604 | <br>+-----+----------+--------------------+----+-------------+<br>
3 rows in set (0.00 sec)<br><br>mysql> select * from radreply where username ="prueba";<br>+-----+----------+--------------+----+---------------------+<br>| id | username | attribute | op | value |<br>
+-----+----------+--------------+----+---------------------+<br>| 374 | prueba | Contact | = | XXX | <br>| 375 | prueba | Mail-Contact | = | XXX | <br>| 376 | prueba | Description | = | Usuario de pruebas | <br>
+-----+----------+--------------+----+---------------------+<br><br><br>--> DEBUG INFO<br><br>rad_recv: Access-Request packet from host x.x.x.x port 42954, id=253, length=71<br> User-Name = "<a href="mailto:prueba@temp.unex.es">prueba@temp.unex.es</a>"<br>
User-Password = "prueba"<br> NAS-IP-Address = 127.0.1.1<br> NAS-Port = 0<br><br>. . .<br><br>+- entering group authorize {...}<br>. . .<br><br>++- entering switch %{Realm} {...}<br>+++- entering case <a href="http://temp.unex.es">temp.unex.es</a> {...}<br>
expand: %D -> 20100602<br>++++[request] returns noop<br>[sqlradiuscc] expand: %{Stripped-User-Name} -> prueba<br>[sqlradiuscc] expand: %{%{Stripped-User-Name}:-%{%{User-Name}:-DEFAULT}} -> prueba<br>[sqlradiuscc] sql_set_user escaped user --> 'prueba'<br>
rlm_sql (sqlradiuscc): Reserving sql socket id: 2<br>[sqlradiuscc] 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 = 'prueba' ORDER BY id<br>
[sqlradiuscc] User found in radcheck table<br>[sqlradiuscc] 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 = 'prueba' ORDER BY id<br>
rlm_sql (sqlradiuscc): Released sql socket id: 2<br>++++[sqlradiuscc] returns ok<br>+++- case <a href="http://temp.unex.es">temp.unex.es</a> returns ok<br>++- switch %{Realm} returns ok<br>[expiration] Checking Expiration time: '10 Jun 2010'<br>
++[expiration] returns ok<br>++[pap] returns updated<br>Found Auth-Type = PAP<br>+- entering group PAP {...}<br>[pap] login attempt with password "prueba"<br>[pap] Using clear text password "prueba"<br>
[pap] User authenticated successfully<br><br>. . .<br><br>Sending Access-Accept of id 253 to x.x.x.x port 42954<br> Session-Timeout = 653611<br><br>I don't understand why this work :(<br><br>Thanks in advance and sorry for my english.<br>
<br><br><br>____________________<br></div></div><br> Ana Gallardo Gómez<br>____________________<br>