New module - Native .NET policy support for FreeRADIUS
Chris Knipe
cknipe at opticnetworks.net
Fri May 15 10:53:17 UTC 2026
Hi everyone,
I'm pleased to announce that I have submitted a new module for FreeRADIUS called rlm_dotnet, which enables writing FreeRADIUS policies and modules in C# and other .NET languages.
Pull Request: https://github.com/FreeRADIUS/freeradius-server/pull/5852
rlm_dotnet hosts the Microsoft .NET runtime using hostfxr and allows FreeRADIUS to call managed code directly.
This makes it possible to implement FreeRADIUS policies in:
- C#
- F#
- VB.NET
- Any other language targeting the .NET runtime
The design supports both synchronous and asynchronous policies, and provides strongly typed access to RADIUS requests and replies.
- Native integration with the .NET runtime (hostfxr)
- Strongly typed request and reply objects
- Support for all major FreeRADIUS processing sections
- Async/await support using ValueTask
- Structured binary request/reply formats (RDb1 / RDr1)
- Structured JSON error reporting
- Access to native FreeRADIUS logging (radlog)
- Per-thread or shared policy instances
- Comprehensive XML documentation and examples
- Unit tests and smoke tests
- Full C# Sdk included
A minimal policy can be as simple as:
public sealed class MyPolicy : IRadiusPolicy
{
public (int Rcode, string ReplyPairList) Authorize(RadiusRequest request)
=> (RlmRcode.Ok, IRadiusPolicy.EmptyReply);
}
Async policies are also supported for database, HTTP, Redis, LDAP, or other I/O-bound operations. The .NET CLR is shared across all instances initiated by FreeRADIUS, and as such memory is shared across all instances and not destroyed each time FreeRADIUS recycles the process. This makes extensive in-memory usage highly viable and was one of the main reasons why the module was developed (in memory, shared session-db).
FreeRADIUS has long supported embedded languages such as Python and Perl. rlm_dotnet brings modern .NET capabilities to the platform, including:
- Strong typing
- Excellent tooling and debugging
- High performance
- Rich ecosystem libraries
- Modern asynchronous programming
This makes it easier for organizations with existing .NET expertise to build custom AAA logic directly within FreeRADIUS.
The pull request includes:
- Full and comprehensive documentation
- Assembly-level XML documentation
- A comprehensive ExamplePolicy
- Unit tests and smoke tests
- Full C# Sdk
- Feedback Welcome
Thank you to the FreeRADIUS team for building such a powerful and extensible platform.
Kind regards,
Chris Knipe
More information about the Freeradius-Users
mailing list