1

There seems to be documentation lacking on how to use the python module in FreeRADIUS.

I want to use python to interpret a MAC address (in %{Calling-Station-ID}) and return an IP address.

In my sites-enabled/default I have:

accounting {
...
python
update request {
Framed-IP-Address := "%{python:/path/python-script -m %{Calling-Station-ID}}"
}

This returns:

WARNING: Unknown module "python" in string expansion "%"

What is the proper way to create a python module for FreeRADIUS?

EDIT:

I found out that I can do:

Framed-IP-Address := `/usr/bin/python /path/python-script -m "%{Calling-Station-Id}"`

This returns the following:

+- entering group accounting {...}
    expand: "%{Calling-Station-Id}" -> "XX-XX-XX-XX-XX-XX"
Exec-Program output: None 
Exec-Program-Wait: plaintext: None 
Exec-Program: returned: 0
ERROR: Failed parsing value "None" for attribute Framed-IP-Address: Failed to find IP    address for None
++[reply] returns fail
AWippler
  • 1,055
  • 1
  • 12
  • 32

1 Answers1

1

The correct way is without quotes:

Framed-IP-Address := `/usr/bin/python /path/python-script -m %{Calling-Station-Id}`

In my examples above, I had quotes around %{Calling-Station-Id}.

AWippler
  • 1,055
  • 1
  • 12
  • 32