How To: Test RADIUS Using radclient on Linux/WSL

Follow
    Applies to:
  • SecureAuth Identity Platform
Deployment model:
  • Cloud
  • Hybrid
  • On Premises
  • Version Affected: All

     

    Overview

    Testing RADIUS can be difficult, especially with MFA involved. Several utilities can test RADIUS, but not all of them handle MFA easily, and few are command-line driven. Using radclient on a Linux system (including a Windows Subsystem for Linux, or WSL, machine) makes this easier, and it can even be scripted for faster, repeatable testing.

     

    Test RADIUS Using radclient

    The examples and screenshots below were taken from a WSL build of Debian 11. This guide assumes WSL (or another Linux machine) is already set up -- see Microsoft's Install WSL guide if it isn't.

    Once the Linux distribution is set up, use its package manager to install the freeradius-utils package (the package name may differ on other distributions). On Debian, search for the package name, then install it:

    A Debian WSL terminal searching for and installing the freeradius-utils package with apt.

    Typing radclient alone in a terminal shows its help. This guide focuses on the -x and -s options, and the auth command:

    The radclient command's help output in a terminal, listing its available options.

    radclient testing relies on a few basic RADIUS attributes:

    • User-Name -- the username being authenticated.
    • User-Password -- the password sent during testing, in clear text.
    • State -- since RADIUS uses connectionless UDP, this lets the server keep track of a login that's in progress across multiple requests.

    Create a RADIUS client specifically for the Linux/WSL machine being used to test. With the client rule set to Password only, run:

    echo "User-Name = <username>,User-Password = <password>" | radclient -x -s <RADIUS_SERVER:PORT> auth <shared_secret>

    radclient output showing Received Access-Accept and Passed filter : 1, confirming successful password-only authentication.

    Received Access-Accept and Passed filter : 1 confirm the password-only authentication worked -- the RADIUS server's own logs should show the same successful flow.

    Next, change the RADIUS client rule to Password | Second Factor and test MFA, starting with the exact same command:

    echo "User-Name = <username>,User-Password = <password>" | radclient -x -s <RADIUS_SERVER:PORT> auth <shared_secret>

    radclient output showing Received Access-Challenge instead of Access-Accept, since a second factor is now required.

    This time the response is an Access-Challenge, not an Access-Accept. Continue the request using the State value from that response, with User-Password set to whichever second factor option is being tested: a TOTP code, 1 for SMS/text, or 2 for phone. For example, to choose SMS/text:

    echo "State = <state_from_previous_response>,User-Name = <username>,User-Password = 1" | radclient -x -s <RADIUS_SERVER:PORT> auth <shared_secret>

    radclient output showing an Access-Challenge asking which phone number to send the SMS/text message to.

    The response asks which phone number to send the code to, so run the same command again with the same State and password to select it:

    echo "State = <state_from_previous_response>,User-Name = <username>,User-Password = 1" | radclient -x -s <RADIUS_SERVER:PORT> auth <shared_secret>

    radclient output confirming the SMS/text code was sent.

    Once the OTP arrives by SMS/text, send the same command a final time with that code as the password:

    echo "State = <state_from_previous_response>,User-Name = <username>,User-Password = <otp_code>" | radclient -x -s <RADIUS_SERVER:PORT> auth <shared_secret>

    radclient output showing Received Access-Accept and Passed filter : 1, confirming successful authentication with the SMS-delivered OTP.

    Access-Accept and Passed filter : 1 confirm successful authentication with the SMS-delivered OTP.


     

    Special Considerations

    This guide is aimed at Linux users testing a RADIUS server setup or configuration. For a Windows alternative, see How To: Test RADIUS Using NTRadPing. Additional attributes can be sent to the RADIUS server -- see FreeRADIUS's RFC attribute lists for the many other options available.


     

    SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.

    Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.

    0 out of 0 found this helpful

    Comments

    0 comments

    Please sign in to leave a comment.