Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Authentication in Active Directory via RADIUS GNU/Linux

Leer en espanol
Authentication in Active Directory via RADIUS GNU/Linux

Table of contents

RADIUS (acronym in English of Remote TOauthentication dial-Yon ORbe Yesservice). It is a protocol authentication and authorization for network access or IP mobility applications. Use port 1812 UDP to establish your connections.

When connecting to a ISP through modem, DSL, cable modem, ethernet either Wi-Fi, information is sent, which is generally a username and password. This information is transferred to a device Network Access Server (NAS) about the protocol PPP, who redirects the request to a RADIUS server over the RADIUS protocol. The RADIUS server verifies that the information is correct using authentication schemes such as PAP, CHAP either EAP. If accepted, the server will authorize access to the ISP's system and assign network resources as a IP address, and other parameters such as L2TP, etc.

In the previous entry we saw how to install an NPS server, this time we configured the NPS server to act as radius and log in with Active Directory users on our GNU/Linux servers

NPS server installation

NPS Settings

We access our NPS server, press with right click on NPS (Local) > Register server in Active directory

RADIUS 01

We accept.

RADIUS 02 RADIUS 03

Once integrated with the domain we are going to create our first client, to do this right click on RADIUS Client > New

RADIUS 05

We complement all the fields without forgetting the Shared secret which we will use later.

RADIUS 04

Now we are going to create a Police, to do this right click on Connection Request Policies > New

The policy creation wizard opens, we assign a name.

RADIUS 07

We specify a condition Client Friendly Name

RADIUS 08 RADIUS 09

We leave the default configuration, next

RADIUS 10

Following.

RADIUS 11

We change the attributes, we must set it to User-Name

RADIUS 12

We finish the configuration.

RADIUS 13

We created a new policy, Click on Network Police > New

RADIUS 07 1

The configuration wizard opens, we assign a name for the policy.

RADIUS 08 1

We assign a condition  UserGroups

RADIUS 09 1

We add the groups of users that we want to have access.

RADIUS 10 1

We leave the access permissions by default, Access granted.

RADIUS 11 1

In authentication method we select Unencrypted authenticaction (PAP, SPAP)

RADIUS 12 1 RADIUS 13 1

We leave the default configuration, next.

RADIUS 14

Following.

RADIUS 15

We finish.

RADIUS 16

Linux RADIUS Configuration

We install the necessary software

Redhat and derivatives:

Bash
yum install pam_radius freeradius-utils

Debian and derivatives:

Bash
apt-get install libpam-radius-auth freeradius-utils

Suse

text
zypper installl pam_radius freeradius-server-utils

Configuring PAM_RADIUS on Redhat and Debian

We make a backup

Bash
cp /etc/pam_radius.conf /etc/pam_radius.conf-bck

We empty the configuration file

text
> /etc/pam_radius.conf

We add the following configuration (we must enter the share secret previously configured on the NPS server)

Bash
cat /etc/pam_radius.conf
192.168.1.160 <share secret> 3

Configuring PAM_RADIUS in Suse 

We make a backup

Bash
cp /etc/raddb/server /etc/raddb/server-bck

We empty the configuration file

text
> /etc/raddb/server

We add the following configuration (we must enter the share secret previously configured on the NPS server)

Bash
cat /etc/raddb/server
192.168.1.160 <share secret> 3

Configuring pam.d/sshd and pam.d/sudo in Redhat and Suse

We add auth sufficient pam_radius_auth.so debug in the file /etc/pam.d/sshd

RADIUS 17

We add auth sufficient pam_radius_auth.so in the file /etc/pam.d/sudo

RADIUS 18 1

Configuration pam.d/sshd and pam.d/sudo in Debian

We add auth sufficient pam_radius_auth.so debug in the file /etc/pam.d/common-auth

RADIUS 19

We add auth sufficient pam_radius_auth.so in the file /etc/pam.d/sudo

RADIUS 20

We create the users on the GNU/Linux server 

text
useradd rokitoh
useradd juan

Once configured we can perform a connection test:

text
radtest <USUARIO> <CONTRASEÑA> <DIRECCIÓN IP> 10 <share secret>

Example

text
radtest rokitoh  temporal 192.168.1.160  10 sharesecret123456

If everything went well, we can now access the server via SSH with an Active Directory user.

All the best

:wq!

Comments