{% 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
1
reboot
Join domain
1 2
#net join -U mypoweruser net ads join -U Administrator
1 2 3 4 5
Enter 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_PARAMETER
Restart samba and winbind service
1
systemctl restart smbd winbind
Testing samba AD authentication:
- Using winbind:
1 2
systemctl restart winbind wbinfo -a <user>%<password>
You will get the following message if everything is correct:
1 2
plaintext password authentication succeeded challenge/response password authentication succeeded
- Using ntlm_auth:
1
ntlm_auth --request-nt-key --domain=TESTING --username=<user> --password=<password>
Then you will got success message:
1
NT_STATUS_OK: Success (0x0)
Install freeradius
Install freeradius
1
apt install -y freeradius
Grant permission for
freerad
user on winbind’s socket:1 2
sudo usermod -a -G winbindd_priv freerad sudo chgrp winbindd_priv /var/lib/samba/winbindd_privileged/
Change MACHAP to use ntlm_auth:
1
vi /etc/freeradius/3.0/mods-available/ntlm_auth
change
1 2 3 4
program = "/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.
1
vi /etc/freeradius/3.0/mods-available/eap
Change settings of
default_eap_type
.1 2
eap { default_eap_type = md5
to
1 2
eap { default_eap_type = mschapv2
Then restart freeradius service
1
systemctl restart freeradius
Change
/etc/freeradius/3.0/sites-enabled/default
and/etc/freeradius/3.0/sites-enabled/inner-tunnel
1 2
authenticate { ntlm_auth
Configure RADIUS client
1
vi /etc/freeradius/3.0/clients.conf
1 2 3 4
client 0.0.0.0/0 { secret = myauthpassword shortname = "nas access" }
restart service of freeradius
1
systemctl restart freeradius
Test 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/users
to allow specific groupVPN_GROUP
of 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
1
cp /etc/freeradius/3.0/mods-enabled/eap /etc/freeradius/3.0/mods-enabled/eap.backup
Place pem file to
/etc/freeradius/3.0/certs/mycerts
1
ls -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/eap
file.1 2 3
tls-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]