RE : RE : RE : IP Pool management and Re-authentication

2007-03-22 Thread Thibault Le Meur

> 
> > Thibault Le Meur wrote:
> > > I've patched the radiusplugin to add Framed-IP-Address to
> > the re-auth
> > > request but rlm_ippool still allocates a new IP Address
> > (I'm using FR
> > > 1.1.4).
> > 
> >   Ok.  It seems like rlm_ippool should be updated to look for
> > Framed-IP-Address in the request.
> > 
> >   That would be very useful, and would solve the problem
> > you're seeing.
> > 
> >   Alan DeKok.
> 
> Do you mean updated (to 1.1.5) or patched ?

Never mind I found the answer by looking at the code from rlm_ippool.c.

Currently, when an Access-Request arrives, rlm_ippool:
* looks in the pool for an 'active' entry (flagged as active) with the
key=NAS-IP/NAS-port
* If no entry is found
  ==> rlm_ippool allocates an @IP from the pool
* If an active entry is found
  ==> it is considered as a stale entry and is marked as not active
(active=0)
  ==> then a new IP is allocated

If rlm_ippool is 'updated' to take Framed-IP-Address into account what
shoudl be the behaviour ?

A simple patch would consist of doing nothing at Post-Auth time if the
request contains a Framed-IP-Address.

A more complex patch should handle several different cases and decide what
to do. For instance:
* when Access-Request is received, look for an active entry in the pool with
the search key NAS-IP/NAS-port
* If no entry is found
  * If there is No Framed-IP-Address attribute in the Request
==> allocate a new @IP from the pool
  * If there is a Framed-IP-Address attribute in the Request
* If the Framed-IP-Address belongs to the IP-range of the pool (but it
is not assigned to this NAS-IP/NAS-port)
==> then issue a warning log (especially if this IP is allocated to an
active entry for another NAS-IP/NAS-port)
==> do not allocate a new @IP ??? (Or should we enforce a new IP,
without beeing sure the NAS will be able to use it ?)
* If the Framed-IP-Address doesn't belong to the IP-range of the pool
==> do not allocate a new @IP
* If an entry is found (there is already an allocated @IP for this
NAS-IP/NAS-port)
  * If there is a Framed-IP-Address attribute in the Request
* If this Framed-IP-Address is the same as the allocated IP from the
entry found
  ==> then do nothing (no stale marking, no new @IP allocation)
* If this Framed-IP-Address is NOT the same as the allocated IP from the
entry found
  ==> then mark the current entry as staled (active=0)
  ==> report an error in the log because something went wrong
(especially if the Framed-IP-Address received is allocated to another
NAS-IP/NAS-port entry in the pool)
  ==> do not allocate a new @IP
  * If there is No Framed-IP-Address attribute in the Request
  ==> then mark the current entry as staled (active=0)
  ==> allocate a new @IP

What do you think ?

Is it already done in current developpement tree ?

Regards,
Thibault Le Meur



- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE : IP Pool management and Re-authentication

2007-03-21 Thread Thibault Le Meur



I've been using OpenVPN + Ralf's Radiusplugin for several months and
recently moved away from server-side IP assignment. However, while I did use
it, I found that in my configuration FreeRADIUS only assigned new IPs when
the accounting for that user had stopped (ie, if it recieved a STOP packet).


Curious this is not what I see here ??
What is/was your FR server version ?

Anyway, Alan said that a 'good nas' should send the Framed-IP-Address in the
Access-Request if it has been already assigned one: this wasn't done by
radiusplugin, thus I think I'll keep the pacth.


 This meant, that once I'd crashed the openvpn server 3 times with users on
it :-) there were many IP's who were 'lost' - their sessions had never
ended, hence the IP was never returned to the pool. 


Sure, this is also true for my others NAS (pppd based), but they are quite
robust (I hope openvpn is/will be as robust ;-)).


I was doing renegotiation every 20 minutes if I remember correctly, and the
freeradius replied with the same IP for the user time and time again.


Interesting, what could explain that mine allocate new IP addresses each
time ?

Should rlm_ippool allocate the same IP for a NAS-IP/NAS-port couple if the
entry isn't cleaned from the pool ?

(Anyway, I think it's better to have FR not re-send Framed-IP-Address since
it would cause an unsuseful write to the client-config file from the
radiusplugin.)


 Hence, I'm beginning to wonder if it's configuration-specific, because I
didn't have any problems. 


I can trust you, but I don't know where to search for a setup mistake.

Does someone has an idea ?

Thanks in advance,
Thibault



- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: RE : RE : IP Pool management and Re-authentication

2007-03-21 Thread Jan Mulders

I've been using OpenVPN + Ralf's Radiusplugin for several months and
recently moved away from server-side IP assignment. However, while I did use
it, I found that in my configuration FreeRADIUS only assigned new IPs when
the accounting for that user had stopped (ie, if it recieved a STOP packet).
This meant, that once I'd crashed the openvpn server 3 times with users on
it :-) there were many IP's who were 'lost' - their sessions had never
ended, hence the IP was never returned to the pool.

I was doing renegotiation every 20 minutes if I remember correctly, and the
freeradius replied with the same IP for the user time and time again. Hence,
I'm beginning to wonder if it's configuration-specific, because I didn't
have any problems.

Hope this helps,

Jan

On 21/03/07, Thibault Le Meur <[EMAIL PROTECTED]> wrote:



> Thibault Le Meur wrote:
> > I've patched the radiusplugin to add Framed-IP-Address to
> the re-auth
> > request but rlm_ippool still allocates a new IP Address
> (I'm using FR
> > 1.1.4).
>
>   Ok.  It seems like rlm_ippool should be updated to look for
> Framed-IP-Address in the request.
>
>   That would be very useful, and would solve the problem
> you're seeing.
>
>   Alan DeKok.

Do you mean updated (to 1.1.5) or patched ?

I made a quick diff between rlm_ippool.c from 1.1.4 and 1.1.5 and I can't
see any difference so I think the problem I'm seeing is still present in
1.1.5.

Regards,
Thibault


-
List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

RE : RE : IP Pool management and Re-authentication

2007-03-21 Thread Thibault Le Meur

> Thibault Le Meur wrote:
> > I've patched the radiusplugin to add Framed-IP-Address to 
> the re-auth 
> > request but rlm_ippool still allocates a new IP Address 
> (I'm using FR 
> > 1.1.4).
> 
>   Ok.  It seems like rlm_ippool should be updated to look for 
> Framed-IP-Address in the request.
> 
>   That would be very useful, and would solve the problem 
> you're seeing.
> 
>   Alan DeKok.

Do you mean updated (to 1.1.5) or patched ?

I made a quick diff between rlm_ippool.c from 1.1.4 and 1.1.5 and I can't
see any difference so I think the problem I'm seeing is still present in
1.1.5.

Regards,
Thibault


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: RE : IP Pool management and Re-authentication

2007-03-21 Thread Alan DeKok
Thibault Le Meur wrote:
> I've patched the radiusplugin to add Framed-IP-Address to the re-auth
> request but rlm_ippool still allocates a new IP Address (I'm using FR
> 1.1.4).

  Ok.  It seems like rlm_ippool should be updated to look for
Framed-IP-Address in the request.

  That would be very useful, and would solve the problem you're seeing.

  Alan DeKok.
--
  http://deployingradius.com   - The web site of the book
  http://deployingradius.com/blog/ - The blog
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE : IP Pool management and Re-authentication

2007-03-21 Thread Thibault Le Meur
Hi Alan,

> > > I'd like to patch the openvpn-radiusplugin so that an extra
> > attribute
> > > is sent in the Access-Accept packets so that FR will be able to
> > > differentiate Initial and Renegociation Access-Accept 
> requests and 
> > > only assign new IP address from the pool on Initial Access-Accept 
> > > requests.
> > 
> >   I think you mean Access-Request packet.
> 
> Sorry for the mistake, I meant Access-Request of course
> 
> >  If it doesn't have
> > a Framed-IP-Address attribute, FreeRADIUS can allocate & send 
> > one in an Access-Accept.
> >  If openvpn re-authenticates a 
> > session with an existing IP address, it should send 
> > Framed-IP-Address in the Access-Request.
> 
> I get you right, my patch may be as easy as to make 
> radiusplugin add the Framed-IP-Address attribute in the 
> Access-Request packet with the already assigned IP Address 
> when it is a renegotiation.

I've patched the radiusplugin to add Framed-IP-Address to the re-auth
request but rlm_ippool still allocates a new IP Address (I'm using FR
1.1.4).

I can see this in radiusd -X:
modcall: entering group postauth.ovpn for request 3
rlm_ippool: Searching for an entry for nas/port: 192.168.1.1/1
rlm_ippool: Found a stale entry for ip/port: 10.1.1.1/1
rlm_ippool: num: 0
rlm_ippool: Searching for an entry for nas/port: 192.168.1.1/1
rlm_ippool: Allocating ip to nas/port: 192.168.1.1/1
rlm_ippool: num: 1
rlm_ippool: Allocated ip 10.1.1.2 to client on nas 192.168.1.1,port 1
  modcall[post-auth]: module "Ovpn_Main_Pool" returns ok for request 3

Where:
* 192.168.1.1 is the NAS IP Address
* 10.1.1.1 is the IP address allocated at connection time
* 10.1.1.2 is the IP address allocated at re-authentication time

Maybe I didn't understand you well: 
* Is rlm_ippool supposed to return NOOP if a Framed-IP-Address attribute is
present in the Request ?
OR
* is it up to me to bypass the rlm_ippool (by setting another
Post-Auth-Type) when a Re-Auth Request is performed (that is to say when a
Framed-IP-Address attribute is present in the Request) ?

Thanks in advance,
Thibault


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE : IP Pool management and Re-authentication

2007-03-20 Thread Thibault Le Meur
Thanks for your reply,

> Thibault Le Meur wrote:
> > Openvpn sometimes needs to renegotiate the connections and 
> thus sends 
> > authentication requests while the connection is still 
> active (with an 
> > already assigned IP address): this causes FR to assign a new IP 
> > address from the pool (which seems normal since FR has no 
> way to know 
> > this is a renegotiation).
> 
>   So why isn't the radiusplugin telling FreeRADIUS what the 
> old IP address was?

Because It's still beta ;-), I can fix this

> > I'd like to patch the openvpn-radiusplugin so that an extra 
> attribute 
> > is sent in the Access-Accept packets so that FR will be able to 
> > differentiate Initial and Renegociation Access-Accept requests and 
> > only assign new IP address from the pool on Initial Access-Accept 
> > requests.
> 
>   I think you mean Access-Request packet.

Sorry for the mistake, I meant Access-Request of course

>  If it doesn't have 
> a Framed-IP-Address attribute, FreeRADIUS can allocate & send 
> one in an Access-Accept.
>  If openvpn re-authenticates a 
> session with an existing IP address, it should send 
> Framed-IP-Address in the Access-Request.

I get you right, my patch may be as easy as to make radiusplugin add the
Framed-IP-Address attribute in the Access-Request packet with the already
assigned IP Address when it is a renegotiation.

Thanks a lot Alan.

Regards,
Thibault


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: IP Pool management and Re-authentication

2007-03-20 Thread Alan DeKok
Thibault Le Meur wrote:
> Openvpn sometimes needs to renegotiate the connections and thus sends
> authentication requests while the connection is still active (with an
> already assigned IP address): this causes FR to assign a new IP address from
> the pool (which seems normal since FR has no way to know this is a
> renegotiation).

  So why isn't the radiusplugin telling FreeRADIUS what the old IP
address was?

> I'd like to patch the openvpn-radiusplugin so that an extra attribute is
> sent in the Access-Accept packets so that FR will be able to differentiate
> Initial and Renegociation Access-Accept requests and only assign new IP
> address from the pool on Initial Access-Accept requests.

  I think you mean Access-Request packet.  If it doesn't have a
Framed-IP-Address attribute, FreeRADIUS can allocate & send one in an
Access-Accept.  If openvpn re-authenticates a session with an existing
IP address, it should send Framed-IP-Address in the Access-Request.

> Do you know a standard Radius attribute that could be used for this ?
> As far as you know, are there other NASes using such a quirk ? Does this
> make sense ?

  It makes sense.

  Alan DeKok.
--
  http://deployingradius.com   - The web site of the book
  http://deployingradius.com/blog/ - The blog
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE: Ip pool management

2005-03-03 Thread Sébastien Cantos
Ok it works with :

DEFAULT Service-Type == Framed-User, Pool-Name := "main_pool"
Framed-Protocol = PPP,
Framed-MTU = 576

Thanks a lot for your help.

Kind Regards,
--
Sebastien Cantos <[EMAIL PROTECTED]>
Network / System Manager
Neopost DIVA 

> -Message d'origine-
> De : [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] De la 
> part de Alan DeKok
> Envoyé : jeudi 3 mars 2005 17:41
> À : freeradius-users@lists.freeradius.org
> Objet : Re: Ip pool management 
> 
> "Sébastien Cantos" <[EMAIL PROTECTED]> wrote:
> > The problem is  that it is complaining:
> > rlm_ippool: could not find Pool-Name attribute
> 
>   The *module* is printing that message because the Pool-Name
> attribute is not found in the list of check items.
> 
> > For my *newbie* understanding, if the Pool-name is a check item it
> > should be in the request I get from my clients.
> 
>   No.  Nothing in the server documentation would lead you to that
> conclusion.  The documentation would lead you to the *correct*
> conclusion, which is that the "check" items are not the 
> "request" items.
> 
>   Alan DeKok.
> 
> - 
> List info/subscribe/unsubscribe? See 
> http://www.freeradius.org/list/users.html
> 


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Ip pool management

2005-03-03 Thread Alan DeKok
"Sébastien Cantos" <[EMAIL PROTECTED]> wrote:
> The problem is  that it is complaining:
> rlm_ippool: could not find Pool-Name attribute

  The *module* is printing that message because the Pool-Name
attribute is not found in the list of check items.

> For my *newbie* understanding, if the Pool-name is a check item it
> should be in the request I get from my clients.

  No.  Nothing in the server documentation would lead you to that
conclusion.  The documentation would lead you to the *correct*
conclusion, which is that the "check" items are not the "request" items.

  Alan DeKok.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE: Ip pool management

2005-03-03 Thread Sébastien Cantos
Yes you are right. Luaching the server in debug mode told me that Pool-name
is a check item and that it should be on the first line. The problem is that
it is complaining:
rlm_ippool: could not find Pool-Name attribute 

For my *newbie* understanding, if the Pool-name is a check item it should be
in the request I get from my clients. I'm true ? 
If yes, I can't modify the I got from the NAS (it's not mine). So is there a
way to use ippool without this check item ? 
Thanks for your help. 

Regards,
--
Sebastien Cantos <[EMAIL PROTECTED]>
Network / System Manager
Neopost DIVA 

> -Message d'origine-
> De : [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] De la 
> part de Alan DeKok
> Envoyé : mercredi 2 mars 2005 18:50
> À : freeradius-users@lists.freeradius.org
> Objet : Re: Ip pool management 
> 
> "Sébastien Cantos" <[EMAIL PROTECTED]> wrote:
> > I've followed instructions in radiusd.conf :
> > My users file looks like this:
> > DEFAULT Service-Type == Framed-User
> > Pool-Name := osiris-pool,
> 
>   You did not follow the instructions in radiusd.conf.  The
> "Pool-Name" attribute should go on the first line.
> 
>   If you had run the server in debugging mode, the server would have
> told you this.
> 
>   Alan DeKok.
> 
> 
> - 
> List info/subscribe/unsubscribe? See 
> http://www.freeradius.org/list/users.html
> 


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Ip pool management

2005-03-02 Thread Alan DeKok
"Sébastien Cantos" <[EMAIL PROTECTED]> wrote:
> I've followed instructions in radiusd.conf :
> My users file looks like this:
> DEFAULT Service-Type == Framed-User
> Pool-Name := osiris-pool,

  You did not follow the instructions in radiusd.conf.  The
"Pool-Name" attribute should go on the first line.

  If you had run the server in debugging mode, the server would have
told you this.

  Alan DeKok.


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE: Ip pool management

2005-03-02 Thread Sébastien Cantos
Hi,

I've followed instructions in radiusd.conf :
My users file looks like this:
DEFAULT Service-Type == Framed-User
Pool-Name := osiris-pool,
Framed-Protocol = PPP,
Framed-MTU = 576

And in my radiusd.conf I've:
post-auth {
#  Get an address from the IP Pool.
#   main_pool
osiris-pool
...
}

modules { 
...
ippool osiris-pool {
range-start = 192.168.52.1
range-stop = 192.168.52.254
netmask = 255.255.255.0
cache-size = 800
session-db = ${raddbdir}/db.ippool
ip-index = ${raddbdir}/db.ipindex
}
}

I get this error :
rlm_ippool: could not find Pool-Name attribute 

And my client doesn't get back the IP. 

I surely miss something  Could someone help me please ?

Regards,
--
Sebastien Cantos <[EMAIL PROTECTED]>
Network / System Manager
Neopost DIVA 

> -Message d'origine-
> De : [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] De la 
> part de Alan DeKok
> Envoyé : mardi 1 mars 2005 18:50
> À : freeradius-users@lists.freeradius.org
> Objet : Re: Ip pool management 
> 
> "Sébastien Cantos" <[EMAIL PROTECTED]> wrote:
> > I would like to configure my radius to give the first 
> available IP in the
> > subnet 192.168.52.0/24 without carrying about the NAS modem number. 
> > Is there a way to configure this ? 
> 
>   Read radiusd.conf.  Look for "ippool"
> 
>   Alan DeKok.
> 
> - 
> List info/subscribe/unsubscribe? See 
> http://www.freeradius.org/list/users.html
> 


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Ip pool management

2005-03-01 Thread Alan DeKok
"Sébastien Cantos" <[EMAIL PROTECTED]> wrote:
> I would like to configure my radius to give the first available IP in the
> subnet 192.168.52.0/24 without carrying about the NAS modem number. 
> Is there a way to configure this ? 

  Read radiusd.conf.  Look for "ippool"

  Alan DeKok.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html