FreeRADIUS

De Infraestrutura São Carlos
Ir para navegação Ir para pesquisar

Objetivo

Instalação e configuração de freeRADIUS em sistemas Linux Ubuntu.

Requisitos

  • Ubuntu Server
  • OpenLDAP

Procedimentos

Instalação

  1. Instalação do daemon do freeRADIUS (freeradius):
    # apt-get install freeradius
    
  2. Instalação do módulo LDAP do freeRADIUS (freeradius-ldap:
    # apt-get install freeradius-ldap
    

Configuração

  1. Edite o arquivo /etc/freeradius/radius.conf:
    # vi /etc/freeradius/radius.conf
    
  2. Altere as seguintes linhas:
    ...
    log_auth = yes
    ...
    detail auth_log {
    	detailfile = ${radacctdir}/%{Client-IP-Address}/auth-detail-%Y%m%d
    	detailperm = 0600
    }
    ...
    authorize {
    	...
           	auth_log
           	ldap
           	...
           }
    ...
    Auth-Type LDAP {
    	...
    	ldap
    	...
    }
    ...
    ldap {
    	...
    	server = "localhost"
    	basedn = "ou=radius,dc=usp,dc=br"
    	filter = "(uid=%{Stripped-User-Name:-%{User-Name}})"
    	start_tls = no
    	# access_attr = "dialupAccess"
    	dictionary_mapping = ${raddbdir}/ldap.attrmap
    	ldap_connections_number = 5
    	timeout = 4
    	timelimit = 3
    	net_timeout = 1
    	...
    }
    ...
    unix {
    	...
    	#	passwd = /etc/passwd
    	#	shadow = /etc/shadow
    	#	group = /etc/group
    	...
    }
    
  3. Edite o arquivo /etc/freeradius/users:
    # vi /etc/freeradius/users
    
  4. Altere as seguintes linhas:
    ...
    #DEFAULT Auth-Type = System
    #	 Fall-Through = 1
    
    DEFAULT	Auth-Type = LDAP
    	Fall-Through = 1
    ...
    
  5. Edite o arquivo /etc/freefradius/clients.conf:
    # vi /etc/freeradius/clients.conf
    
  6. Altere as seguintes linhas:
    ...
    client 127.0.0.1 {
    	secret		= secret
    	shortname	= localhost
    	nastype		= other
    }
    ...
    

    onde secret é a senha utilizada entre clientes e servidores RADIUS.

Testes

  1. Crie uma entrada na base LDAP com a seguinte estrutura:
    dn: uid=test,ou=radius,dc=usp,dc=br
    objectClass: inetOrgPerson
    objectClass: radiusprofile
    ou: radius
    uid: test
    cn: Conta de Teste
    sn: test
    userPassword: {CRYPT}senha_criptografada
    radiusAuthType: ldap
    radiusExpiration: Jan 01 2008
    radiusSimultaneousUse: 1
    
  2. Pare a execução do daemon do freeRADIUS:
    # /etc/init.d/freeradius stop
    
  3. Execute o daemon do freeRADIUS de forma interativa:
    # /usr/sbin/freeradius -X -A
    
  4. Em outro terminal, faça o teste de conexão:
    # /usr/bin/radtest test "senha" localhost 2 secrect
    

    e observe as saídas geradas pelo daemon no item anterior.

Referências