Radius + Samba4

Descripción 

Radius y su implementacion Freeradius es el metodo preferido para hacer AAA. Aqui lo vamos a usar para WIFI con Backend Samba4

Prerequistos

En principio .. ppp, pptd-server, MySQL - MariaDB, freeradius-server,  freeradius-MySQL - MariaDB y radiusclient 

Suele acompañarse de un aplicativo web llamado dial-up admin.

Instalación básica

Los rpms funcionan bien, .. hay que ser cuidadoso porque el pptp pide cierta version de ppp y si no,
no funciona.

Configuración

1. Samba  (Vea el documento ---> Samba4 ) 

Una vez lo tenga andando, pasamos a radius
 

+++  smb.conf

# Global parameters
[global]
    netbios name = GALAPA
    realm = MINUT.EDU.CO
    workgroup = MINUT-EXT
    dns forwarder = 192.168.32.1
    server role = active directory domain controller
    # Autenticaion sin dominio
     winbind use default domain = no
    ntlm auth = yes

[netlogon]
    path = /var/lib/samba/sysvol/minut.edu.co/scripts
    read only = No

[sysvol]
    path = /var/lib/samba/sysvol
    read only = No

++++++

smbclient -L localhost -U%

Domain=[MINUT-EXT] OS=[Windows 6.1] Server=[Samba 4.5.12-Debian]
    Sharename       Type      Comment
    ———       —-      ——-
    netlogon        Disk     
    sysvol          Disk     
    IPC$            IPC       IPC Service (Samba 4.5.12-Debian)
Domain=[MINUT-EXT] OS=[Windows 6.1] Server=[Samba 4.5.12-Debian
    Server               Comment
    ———            ——-
    Workgroup            Master
    ———            ——-
    WORKGROUP            GALAPA

++++++

#» <root@galapa:/etc/freeradius/3.0#> smbclient //localhost/netlogon -Uskina%'Nio4LasOo' -c 'ls'
Domain=[MINUT-EXT] OS=[Windows 6.1] Server=[Samba 4.5.12-Debian]
  .                                   D        0  Tue Jan 30 11:11:29 2018
  ..                                  D        0  Tue Jan 30 11:11:48 2018

        65799648 blocks of size 1024. 61762632 blocks available

#» ntlm_auth –request-nt-key –domain=MINUT-EXT –username=skina –password='Nio4LasOo'
NT_STATUS_OK: Success (0x0)

#» wbinfo –ntlmv2 -a 'skina'%'Nio4LasOo'
plaintext password authentication succeeded
challenge/response password authentication succeeded

2. Radius Server

Arrancando el sistema autónomo

Siga el howto   http://wiki.freeradius.org/guide/Basic-configuration-HOWTO

Y como siempre .. entre menos mueva mas probable es que funcione.

+++++

#» radtest  bob hello localhost 0 testing123
Sent Access-Request Id 70 from 0.0.0.0:37544 to 127.0.0.1:1812 length 73
    User-Name = “bob”
    User-Password = “hello”
    NAS-IP-Address = 127.0.1.1
    NAS-Port = 0
    Message-Authenticator = 0x00
    Cleartext-Password = “hello”
Received Access-Accept Id 70 from 127.0.0.1:1812 to 0.0.0.0:0 length 20
    Reply-Message = “Hello, bob”

 

Y ahora con MySQL - MariaDB

Esto no es obligado, pero es muy conveniente si piensa, sobre todo, hacer accounting. En algunas distribuciones el soporte viene aparte  y toca instalar un paquete como  freeradius-MySQL - MariaDB.

De aqui en adelante es: 

- Cree la base de datos, busque el MySQL - MariaDB.sql (/usr/share/doc/freeradius-1.1.3/examples/MySQL - MariaDB.sql) para crear las tablas
- alimentelas con la informacion de inicio.  (mire el wiki)

Ahora para hacer funcionar radius.

- Configure /etc/freeradius/3.0/mods-enabled/sql para tener acceso a la base de datos.

         # Connect info
        server = “localhost”
        login = “radiususr”
        password = “passwdroot”

        # Database table configuration
        radius_db = “radius”

- Active todos los sqls en /etc/freeradius/3.0/sites-enabled/default  (descomente todas las lineas adecuadas)


Ahora si, al prueba bonita con radtest FUNCIONA !!!


http://wiki.freeradius.org/guide/SQL-HOWTO-for-freeradius-3.x-on-Debian-Ubuntu
 

Y ahora contra SAMBA con PAP

Second .. configure OK freeradius with ntlm_auth and PAP  http://wiki.freeradius.org/guide/NTLM%20Auth%20with%20PAP%20HOWTO

 

+++++++

#» radtest  'skina' 'Nio4LasOo' localhost 0 testing123
Sent Access-Request Id 14 from 0.0.0.0:34004 to 127.0.0.1:1812 length 75
    User-Name = “skina”
    User-Password = “Nio4Las2Oo”
    NAS-IP-Address = 127.0.1.1
    NAS-Port = 0
    Message-Authenticator = 0x00
    Cleartext-Password = “Nio4LasOo”
Received Access-Accept Id 14 from 127.0.0.1:1812 to 0.0.0.0:0 length 20

 

Y ahora contra SAMBA con MSCHAPv2

Third ..  configure freeradius ntlm_auth and MSCHAP  http://deployingradius.com/documents/configuration/active_directory.html

NO  olvide agregar al usuario freerad al grupo winbindd-priv
+++++++

root@galapa:~# radtest -t mschap skina 'Nio4Las2Oo' localhost 0 testing123
Sent Access-Request Id 71 from 0.0.0.0:46716 to 127.0.0.1:1812 length 131
    User-Name = “skina”
    MS-CHAP-Password = “Nio4Las2Oo”
    NAS-IP-Address = 127.0.1.1
    NAS-Port = 0
    Message-Authenticator = 0x00
    Cleartext-Password = “Nio4Las2Oo”
    MS-CHAP-Challenge = 0x4892b54bc1095dd3
    MS-CHAP-Response = 0x000100000000000000000000000000000000000000000000000050a34aab63def5afbdbe859f505d088b7a99a2b839461954
Received Access-Accept Id 71 from 127.0.0.1:1812 to 0.0.0.0:0 length 84
    MS-CHAP-MPPE-Keys = 0x0000000000000000569d82594369d205b9827bd40c92df2d
    MS-MPPE-Encryption-Policy = Encryption-Required
    MS-MPPE-Encryption-Types = 4


OJO .. debe colocar le     ntlm auth = yes  en el smb.conf .. si no no anda

 

Y ahora contra SAMBA con EAP-MD5

 

3. Radius Client


Otras configuraciones

1. Conexiones simultaneas

Se quere que solo se logueen una vez http://www.freeradius.org/radiusd/doc/Simultaneous-Use  –

2. LDAP

Para que radius consulte un directorio LDAP, configurelo en radiusd.conf, de tal forma que encuentre el usuario tanto para autorizar como para autenticar.

3. Active  Directory

Es necesario instalar samba y winbind para que se pueda usar el ntl_auth .. Mire este documento freeRadius_AD_tutorial.pdf  o vaya a  http://wiki.freeradius.org/FreeRADIUS_Active_Directory_Integration_HOWTO –

La linea que nos funciona OK incluyendo grupo es 

 ntlm_auth = “/usr/bin/ntlm_auth –request-nt-key –username=%{Stripped-User-Name:-%{User-Name:-None}} –challenge=%{mschap:Challenge:-00} –nt-response=%{mschap:NT-Response:-00} –require-membership-of=COLOMBIA\\\\Azuan”

 

para probar a mano

/usr/bin/ntlm_auth –request-nt-key –domain AMVCOLOMBIA –username=pruebas –require-membership-of=“AMVCOLOMBIA\\\\Azuan”

 

Problemas

1. No funciona ni la primera prueba con radtest

- El tipo coge por defecto la comprobacion contral el sistema ..Unix.. entonces Comente en users el sistema de autenticacion por default del sistema

2. No logro que pptpd siquiera consulte radius

- Esta seguro de haber instalado radiusclient .. pa que consulte

3. auth: No User-Password or CHAP-Password attribute in the request

- Esto ocurre usualmente cuando la transaccion de pptp no se entiende bien. El radiusclient no esta incluyendo el dictionary.microsoft. El como se hace esta en
http://www.members.optushome.com.au/~wskwok/poptop_ads_howto_8.htm  –

4. NTLM_AUTH me responde NT_STATUS_NO_LOGON_SERVERS

-  Revise configuracion de kerberos .. que tenga el dominio bien y el servidor kdc sea ubicable.

5. Nada .. Exec-Program output: winbind client not authorized to use winbindd_pam_auth_crap. Ensure permissions on /var/cache/samba/winbindd_privileged are set correctly. (0xc0000022)

- Ponga el directorio 755 y funciona. PERO NOOOO… Winbind no sube si no es 750 .. .. o sea toca 750 antes de subir y 755 una vez esta subido pa que radius lo use …

 start() {

        KIND=“Winbind”

        echo -n $“Starting $KIND services: “

        ## by Skina

        chmod 750 /var/cache/samba/winbindd_privileged

        ##

        daemon winbindd “$WINBINDOPTIONS”

        ## by Skina

        chmod 755 /var/cache/samba/winbindd_privileged

        ##

        RETVAL=$?

        echo

        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbindd || RETVAL=1

        return $RETVAL

}

6. Dialup_admin no me da los usuarios en linea

Varias posibilidades, 

- asegurese que en admin.conf el valor general_finger_type: este vacio

- En admin.conf la ip del nas es 127.0.0.1 y no el nombre. La mejor forma de resolver esto
es mire la tabla de radacct y mire el NASIPAddress y ese debe ser el mismo.

- Le meti mano a user_finger.php3 para que la consulta funcione por la fecha

  “SELECT DISTINCT UserName,AcctStartTime,FramedIPAddress,CallingStationId
                FROM $config[sql_accounting_table] WHERE
                AcctStopTime = '0000-00-00 00:00:00' AND NASIPAddress = '$name_data' $extra
                GROUP BY UserName ORDER BY AcctStartTime;”

7. could not obtain winbind separator

-

Referencias

- El wiki nativo de freeradius http://wiki.freeradius.org/Home  


- Aunque en frances … esta al pelo http://www.queret.net/blog/index.php/2007/04/02/70-freeradius-MySQL - MariaDB-pptpd –

- El listado de howtos de freeradius ..pero no lo de gran utilidad http://wiki.freeradius.org/HOWTO –

- Un capitulo de un howto para inhalambrica http://www.tldp.org/HOWTO/8021X-HOWTO/freeradius.html

- El muy simple arranque, pendejo, pero  con detallitos de como probar la configuracion a mano y demas:  http://deployingradius.com/documents/configuration/   –

- Desde el productor de PPTP ..muy simple ..pero ..uhmm  http://poptop.sourceforge.net/dox/radius_mysql.html –

- http://www.members.optushome.com.au/~wskwok/poptop_ads_howto_1.htm

- http://wiki.freeradius.org/PopTop –

- http://gentoo-wiki.com/HOWTO_Chillispot_with_FreeRadius_and_MySQL –

 

FIN



=========================================================================

=========================================================================
La configuracion de LDAP

         ldap {
                server = “localhost”
                # identity = “cn=admin,o=My Org,c=UA”
                # password = mypass
                basedn = “ou=People,dc=skina,dc=com,dc=co”
                filter = “(uid=%{Stripped-User-Name:-%{User-Name}})“
                # base_filter = ”(objectclass=radiusprofile)“

                # set this to 'yes' to use TLS encrypted connections
                # to the LDAP database by using the StartTLS extended
                # operation.
                # The StartTLS operation is supposed to be used with normal
                # ldap connections instead of using ldaps (port 689) connections
                start_tls = no

                # tls_cacertfile        = /path/to/cacert.pem
                # tls_cacertdir         = /path/to/ca/dir/
                # tls_certfile          = /path/to/radius.crt
                # tls_keyfile           = /path/to/radius.key
                # tls_randfile          = /path/to/rnd
                # tls_require_cert      = “demand”

                # default_profile = “cn=radprofile,ou=dialup,o=My Org,c=UA”
                # profile_attribute = “radiusProfileDn”
                # access_attr = “dialupAccess”
                access_attr = “uidNumber”

                # Mapping of RADIUS dictionary attributes to LDAP
                # directory attributes.
                dictionary_mapping = ${raddbdir}/ldap.attrmap

                ldap_connections_number = 5                #
                # NOTICE: The password_header directive is NOT case insensitive
                #
                # password_header = ”{clear}“
                #
                #  The server can usually figure this out on its own, and pull
                #  the correct User-Password or NT-Password from the database.
                #
                #  Note that NT-Passwords MUST be stored as a 32-digit hex
                #  string, and MUST start off with “0x”, such as:
                #
                #       0x000102030405060708090a0b0c0d0e0f
                #
                #  Without the leading “0x”, NT-Passwords will not work.
                #  This goes for NT-Passwords stored in SQL, too.
                #
                # password_attribute = userPassword
                # groupname_attribute = cn
                # groupmembership_filter = ”(|(&(objectClass=GroupOfNames)(member=%{Ldap-UserDn}))(&(objectClass=GroupOfUniqueNames)(uniquemember=%{Ldap-UserDn})))“
                # groupmembership_attribute = radiusGroupName
                timeout = 4
                timelimit = 3
                net_timeout = 1
                # compare_check_items = yes
                # do_xlat = yes
                # access_attr_used_for_allow = yes
        }

 

Primera version JEG  (27/07/2007)


Advertencia

Este documento es privado y es de uso exclusivo de sus autores y de SKINA TECH. Cualquier uso sin una autorización escrita es contra la ley de derechos de autor y de propiedad intelectual, y será motivo de una acción legal. 


 

Volver arriba