Re: Dynamic VLAN assignment depending on LDAP user group and MAC address

2013-10-12 Thread Alan DeKok
Fabrizio Vecchi wrote:
 First of all, sorry if my email is very long, I am just trying not to
 leave any important details out. :)

  That's good.

 So far, I managed to do the dynamic VLAN assignment, but cannot seem to
 get it to work together with the MAC checking.

  They key thing to remember is that they are two independent pieces.
Get them working independently.  Then, put the pieces together.

 I can get an auth to be refused if the MAC is not listed in the
 authorized_macs file, but can't quite put the two things together.
 Perhaps I am a bit confused with regards to where to put the MAC check.

  Put it into authorize.

 For now, I just managed to get the check to work only on the
 authorization phase in sites-enabled/default, but then the VLAN
 assignment, which is done in the internal-tunnel, seems to overwrite my
 changes.

  That can be fixed.

 So I tried to put the MAC check in the post-auth section in the default
 file, but the MAC check doesn't seem to ever work.

  Because the users file works differently there.

 Here are the relevant config files:

  Which seem to use a reasonable approach.

 As you can see, the device wasn't listed in the file, the authentication
 went fine, saying that the tunnel that I should get has ID 40, but that
 wasn't overwritten by the authorized_macs check...

  I think part of the problem is you're juggling a lot.  You also
mentioned MACs and VLANs... and then halfway through the message Oh,
there's an inner-tunnel, too.

  Stop with all of your solutions.  Instead, write down exactly what you
have.  Write down what you want to happen in plain English.  Write down
what should happen, and when.  Then, convert it to the configuration.

  Your system is using TTLS.  OK... I'll ignore the question of *why*
you're authenticating unknown MACs.  That seems weird.

  The debug log shows this:

[ttls] Got tunneled reply code 2
Tunnel-Type:0 = VLAN
Tunnel-Medium-Type:0 = IEEE-802
Tunnel-Private-Group-Id:0 = 40

  Where did that VLAN come from?  Why is it there?  If you don't know,
that's a huge problem.

  Generally, the policies should be arranged like this:

authorize: allow only known kinds of authentication
   decide which authentication method to use
   grab known good passwords

authenticate: run authentication methods

post-auth: return attributes for a successfully authenticated user


  In your case, I'd say return to a default configuration.  Then, get
the MAC address filtering working in post-auth.  Once that's working,
add VLAN assignment.

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


Problems with compiling freeradius on Ubuntu Linux

2013-10-12 Thread Andrei Petru Mura
Hello,

I imported FreeRADIUS from git on Eclipse, and tried to build it, but this
error occurs while building the project:

*threads.h:47:2: error: #error WITH_THREADS defined, but pthreads not
available*
*
*
Can anybody guide me how to solve this issue? Thanks.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Re: Problems with compiling freeradius on Ubuntu Linux

2013-10-12 Thread Arran Cudbard-Bell

On 12 Oct 2013, at 17:40, Andrei Petru Mura mapand...@gmail.com wrote:

 Hello,
 
 I imported FreeRADIUS from git on Eclipse, and tried to build it, but this 
 error occurs while building the project:
 
 threads.h:47:2: error: #error WITH_THREADS defined, but pthreads not available
 
 Can anybody guide me how to solve this issue? Thanks.

This is an invalid state. The configure script will not define WITH_THREADS 
unless the pthread headers are available.

Check if HAVE_PTHREAD_H and WITH_THREADS are defined src/include/autoheader.h. 
If they're both defined then Eclipse is messing with the build system, if one 
is defined and the other is not, then autoconf/the configure scripts are broken.

Arran Cudbard-Bell a.cudba...@freeradius.org
FreeRADIUS Development Team

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


Re: Dynamic VLAN assignment depending on LDAP user group and MAC address

2013-10-12 Thread Fabrizio Vecchi
Hi Alan and thanks for the reply.


On 12 October 2013 13:42, Alan DeKok al...@deployingradius.com wrote:


  So far, I managed to do the dynamic VLAN assignment, but cannot seem to
  get it to work together with the MAC checking.


Get them working independently.  Then, put the pieces together.


I managed to get them to work independently, it's the putting together
phase that I can't quite crack... :)


  I can get an auth to be refused if the MAC is not listed in the
  authorized_macs file, but can't quite put the two things together.
  Perhaps I am a bit confused with regards to where to put the MAC check.

   Put it into authorize.

 If I put the MAC check in the authorize section, then I can allow users to
use only the devices in the authorized_macs file (unless I am missing
something). I would like the users to use any device, but just have a
limited access to the network if the device isn't listed in the
authorized_macs file...


  For now, I just managed to get the check to work only on the
  authorization phase in sites-enabled/default, but then the VLAN
  assignment, which is done in the internal-tunnel, seems to overwrite my
  changes.

   That can be fixed.

  So I tried to put the MAC check in the post-auth section in the default
  file, but the MAC check doesn't seem to ever work.

   Because the users file works differently there.


Can you point me to some part of the docs that explain what is different,
please?



  Here are the relevant config files:

   Which seem to use a reasonable approach.

  As you can see, the device wasn't listed in the file, the authentication
  went fine, saying that the tunnel that I should get has ID 40, but that
  wasn't overwritten by the authorized_macs check...

   I think part of the problem is you're juggling a lot.  You also
 mentioned MACs and VLANs... and then halfway through the message Oh,
 there's an inner-tunnel, too.

   Stop with all of your solutions.  Instead, write down exactly what you
 have.  Write down what you want to happen in plain English.  Write down
 what should happen, and when.  Then, convert it to the configuration.

   Your system is using TTLS.  OK... I'll ignore the question of *why*
 you're authenticating unknown MACs.  That seems weird.


What I am trying to achieve is the following:
1. Authenticate the users through LDAP
2. IF the user is using a device listed in the authorized_macs file, then
assign a VLAN which depends on the user's LDAP group.
3. IF the user is using another (their own), allow them to access an
isolated VLAN, which doesn't allow the device to talk to our servers.

This will allow my colleagues to connect to the Internet with their
devices, but not to mess around with our servers in case there is malware
installed on them.

Does this make sense?


   The debug log shows this:

 [ttls] Got tunneled reply code 2
 Tunnel-Type:0 = VLAN
 Tunnel-Medium-Type:0 = IEEE-802
 Tunnel-Private-Group-Id:0 = 40

   Where did that VLAN come from?  Why is it there?  If you don't know,
 that's a huge problem.


SO SORRY! I pasted twice the sites-available/default file!

It comes from the post-auth section in the inner-tunnel file.
In inner-tunnel, I check if the user belongs to the dept_tech_corporate_it
group, and if so, I update the outher request by assigning a VLAN with ID
40.

This part of the config works properly, as showed by the following few
lines of debug output:

rlm_ldap::ldap_groupcmp: User found in group cn=dept_tech_corporate_it,ou=
Groups,c=gb,dc=mindcandy,dc=com
  [ldap] ldap_release_conn: Release Id: 0
? Evaluating (LDAP-Group ==
cn=dept_tech_corporate_it,ou=Groups,c=gb,dc=mindcandy,dc=com) - TRUE



   Generally, the policies should be arranged like this:

 authorize: allow only known kinds of authentication
decide which authentication method to use
grab known good passwords

 authenticate: run authentication methods

 post-auth: return attributes for a successfully authenticated user


   In your case, I'd say return to a default configuration.  Then, get
 the MAC address filtering working in post-auth.  Once that's working,
 add VLAN assignment.


That seems to be an approach similar to the one I am trying to use. I would
like to do the check of the MAC address for last, so that I can associate
the right VLAN to the user. But for some reason this check doesn't seem to
work.

I guess at the end of the day my question boils down to the following:
where should I put the MAC check, so that the user gets assigned to the
right VLAN?
If I put it in the authorize part of sites-enabled/default, the VLAN update
request will get overwritten by the post-auth part of
sites-enabled/inner-tunnel; and if I put it in the post-auth of the file
sites-enabled/default file (which gets executed after inner-tunnel), the
authorized_macs function always returns noop.

If I could get any pointers towards a working solution, I'd be really
grateful.

Thanks,
Fabrizio
-
List 

Re: Dynamic VLAN assignment depending on LDAP user group and MAC address

2013-10-12 Thread Alan DeKok
Fabrizio Vecchi wrote:
 I guess at the end of the day my question boils down to the following:
 where should I put the MAC check, so that the user gets assigned to the
 right VLAN?

  In post-auth.

 If I put it in the authorize part of sites-enabled/default, the VLAN
 update request will get overwritten by the post-auth part of
 sites-enabled/inner-tunnel;

  The default configuration for the inner-tunnel does *not* set a VLAN
in post-auth.  So one configuration you added prevents you from using
another configuration you added.

 and if I put it in the post-auth of the file
 sites-enabled/default file (which gets executed after inner-tunnel), the
 authorized_macs function always returns noop.

  Delete the set VLAN stuff from the post-auth of the inner tunnel.
As you've seen, it breaks the other configuration you're trying to use.

  When you put authorized_macs into the post-auth, it runs the
post-auth processing.  Which doesn't read the users file... as the
users file is done only in the authorize section.

  You should be able to put authorized_macs.authorize in the post-auth
section.  That will make it process the users file, and do what you want.

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