{% raw %}
How to install and configure FreeRADIUS with Active Directory allow specific group of users to authenticate in Debian 10
serval years ago,I built freeradius server in centos 6 work with active directory. It works perfect with wifi authortication and ikev2 vpn authortication. But recently days, I found a bug that the radius server can not limit user access to a group in AD. So I’m trying to build a new freeradius server in debian 10. After a week work.At last I figure it out.
Install Software and configuration
First thing first, We need install a debian 10 server on your virtualization platform. currently, I installed a debian server on proxmox ve platform.
Basic Information
| Name | Value |
|---|---|
| Domain Name | TESTING.LOCAL |
| NTDomain Name | TESTING |
| RADIUS HOSTNAME | MYRADIUS |
| DOMAIN CONTROLLER | MYDC02.TESTING.LOCAL |
| DOMAIN CONTROLLER | MYDC03.TESTING.LOCAL |
| DOMAIN GROUP | VPN_GROUP |
Change Debian settings
- Change hostname
| |
- Sync NTP time with domain controller Install chrony
| |
| |
restart chrony service and force update times
| |
Install samba and winbind and let Debian Host joined domain
- Install samba,winbind,krb5-user
| |
- config samba config file
| |
In [global] section, change settings form
| |
to
| |
- Modify
/etc/nsswitch.conf
| |
Change settings:
| |
to
| |
- Modify
/etc/krb5.conf
| |
Restart OS
1rebootJoin domain
1 2#net join -U mypoweruser net ads join -U Administrator1 2 3 4 5Enter Administrator's password: Using short domain name -- TESTING Joined 'SMB' to dns domain '' No DNS domain configured for smb. Unable to perform DNS Update. DNS update failed: NT_STATUS_INVALID_PARAMETERRestart samba and winbind service
1systemctl restart smbd winbindTesting samba AD authentication:
- Using winbind:
1 2systemctl restart winbind wbinfo -a <user>%<password>You will get the following message if everything is correct:
1 2plaintext password authentication succeeded challenge/response password authentication succeeded- Using ntlm_auth:
1ntlm_auth --request-nt-key --domain=TESTING --username=<user> --password=<password>Then you will got success message:
1NT_STATUS_OK: Success (0x0)
Install freeradius
Install freeradius
1apt install -y freeradiusGrant permission for
freeraduser on winbind’s socket:1 2sudo usermod -a -G winbindd_priv freerad sudo chgrp winbindd_priv /var/lib/samba/winbindd_privileged/Change MACHAP to use ntlm_auth:
1vi /etc/freeradius/3.0/mods-available/ntlm_authchange
1 2 3 4program = "/usr/bin/ntlm_auth --request-nt-key --domain=TESTING --username=%{mschap:User-Name} --password=%{User-Password}" #if you want to limted to a specific domain group please modified as this: program = "/usr/bin/ntlm_auth --request-nt-key --domain=$DOMAINNAME --require-membership-of='$DOMAINNAME\$DOMAIN_GROUP' --username=%{mschap:User-Name} --password=%{User-Password}"Change module mschap
| |
change
| |
Change eap config.
1vi /etc/freeradius/3.0/mods-available/eapChange settings of
default_eap_type.1 2eap { default_eap_type = md5to
1 2eap { default_eap_type = mschapv2Then restart freeradius service
1systemctl restart freeradiusChange
/etc/freeradius/3.0/sites-enabled/defaultand/etc/freeradius/3.0/sites-enabled/inner-tunnel1 2authenticate { ntlm_authConfigure RADIUS client
1vi /etc/freeradius/3.0/clients.conf1 2 3 4client 0.0.0.0/0 { secret = myauthpassword shortname = "nas access" }restart service of freeradius
1systemctl restart freeradiusTest FreeRADIUS and MSCHAP:
| |
The results will be like:
| |
Configure freeradius-ldap Auth with AD
To limited to auth a AD group, we need to config freeradius auth with ldap.
- Install freeradius-ldap
| |
Edit config
- edit
/etc/freeradius/3.0/mods-available/ldap
| |
| |
- create a link to mode-enable
| |
- edit
/etc/freeradius/3.0/sites-available/default
| |
| |
- Restart freeradius service
| |
testing ldap auth
| |
- Change
/etc/freeradius/3.0/usersto allow specific groupVPN_GROUPof users to authenticate
| |
| |
- Change MACHAP to use ntlm_auth:
| |
change
| |
Install mysql,daloradius to make management freeradius with web access
- Install mariadb database
| |
Renew certficiation
We purchased godaddy certification, so we will replace ssl certification
backup default eap configure file
1cp /etc/freeradius/3.0/mods-enabled/eap /etc/freeradius/3.0/mods-enabled/eap.backupPlace pem file to
/etc/freeradius/3.0/certs/mycerts1ls -al /etc/freeradius/3.0/certs/mycerts
-rw-r–r– 1 root root 1728 Feb 21 11:11 mycerts-ca.pem -rw-r–r– 1 root root 1704 Feb 21 11:09 mycerts.key -rw-r–r– 1 root root 2248 Feb 21 11:13 mycerts.pem
| |
Modified
/etc/freeradius/3.0/mods-enabled/eapfile.1 2 3tls-config tls-common { #private_key_password = whatever private_key_file = /etc/freeradius/3.0/certs/vpn.grapecity.com.cn/mycerts.key
… certificate_file = /etc/freeradius/3.0/certs/vpn.grapecity.com.cn/mycerts.pem … ca-file = /etc/freeradius/3.0/certs/vpn.grapecity.com.cn/mycerts-ca.pem
| |
{% endraw %}
Reference
- WPA2 Enterprise with FreeRADIUS and AD integration on Ubuntu16.04
- 调试freeradius 3.0 与microsoft AD通过LDAP认证的笔记
- Configure FreeRADIUS with Active Driectory allow specific group of users to authenticate
- Join in Windows Active Directory Domain with Samba Winbind.
- 802.1x PEAP mschapv2认证证书问题
- How to convert .crt to .pem [duplicate]