apiVersion: v1
kind: ConfigMap
metadata:
name: radius-config
namespace: lms
data:
default: |
server default {
listen {
type = auth
ipaddr = *
port = 1812
}
authorize {
update request {
Example-Custom-Attribute = "Added by processor"
}
files
pap
}
authenticate {
Auth-Type PAP {
pap
}
}
post-auth {
update reply {
Reply-Message += "%{Example-Custom-Attribute}"
}
exec
}
}
generator-script: |
#!/bin/bash
while true; do
echo "User-Name=user
𝑅
𝐴
𝑁
𝐷
𝑂
𝑀
,
𝑈
𝑠
𝑒
𝑟
−
𝑃
𝑎
𝑠
𝑠
𝑤
𝑜
𝑟
𝑑
=
𝑝
𝑎
𝑠
𝑠
RANDOM,User−Password=passRANDOM, Calling-Station-Id=00:11:22:33:44:$RANDOM" |
radclient -f /config/custom_dictionary -t 1 -x 10.7.13.199:1812 auth testing123
sleep 5
done
custom_dictionary: |
VENDOR Example 54321
BEGIN-VENDOR Example
ATTRIBUTE Example-Custom-Attribute 1 string
END-VENDOR Example
$INCLUDE /etc/raddb/dictionary

apiVersion: apps/v1
kind: Deployment
metadata:
name: radius-generator
namespace: lms
spec:
selector:
matchLabels:
app: radius-generator
template:
metadata:
labels:
app: radius-generator
spec:
containers:
- name: radius-generator
image: git.pyxis.com.tn:5000/radius/freeradius:1.0
command: ["/bin/bash"]
args: ["-c", "cp /config/generator-script /tmp/generate.sh && cp /config/custom_dictionary /tmp/custom_dictionary && chmod +x /tmp/generate.sh && /tmp/generate.sh"]
volumeMounts:
- name: config-volume
mountPath: /config
volumes:
- name: config-volume
configMap:
name: radius-config
items:
- key: generator-script
path: generator-script
- key: custom_dictionary
path: custom_dictionary

apiVersion: apps/v1
kind: Deployment
metadata:
name: radius-processor
namespace: lms
spec:
selector:
matchLabels:
app: radius-processor
template:
metadata:
labels:
app: radius-processor
spec:
containers:
- name: radius-processor
image: git.pyxis.com.tn:5000/radius/freeradius:1.0
command: ["/usr/sbin/freeradius"]
args: ["-X", "-f"]
ports:
- containerPort: 1812
protocol: UDP
volumeMounts:
- name: config-volume
mountPath: /etc/raddb/sites-enabled/default
subPath: default
- name: dictionary-volume
mountPath: /etc/raddb/dictionary.example
subPath: custom_dictionary
volumes:
- name: config-volume
configMap:
name: radius-config
items:
- key: default
path: default
- name: dictionary-volume
configMap:
name: radius-config
items:
- key: custom_dictionary
path: custom_dictionary

apiVersion: v1
kind: Service
metadata:
name: radius-generator-service
namespace: lms
spec:
selector:
app: radius-generator
ports:

protocol: UDP
port: 1812
targetPort: 1812

apiVersion: v1
kind: Service
metadata:
name: radius-processor-service
namespace: lms
spec:
selector:
app: radius-processor
ports:

protocol: UDP
port: 1812
targetPort: 1812
externalIPs:
10.7.13.199
10.7.13.201
10.7.13.202

does these can do Generator Script:

Changed the radclient command to target radius-processor-service:1812 instead of a specific IP. This ensures the traffic is sent to the processor pod.

Processor Configuration (default):

Updated to add the custom attribute in the authorize section.
Changed Custom-Attribute to Example-Custom-Attribute to match the dictionary.

Custom Dictionary:

Kept the custom vendor and attribute definition.

Services:

Removed the generator service as it's not needed.
Kept the processor service but removed external IPs. In a Kubernetes environment, pods can communicate using service names.

Deployments:

Kept both deployments mostly unchanged, ensuring they use the updated ConfigMap.

This setup should now work as follows:

The generator pod will send random RADIUS traffic to the processor pod using the service name.
The processor pod will receive the traffic, add the custom attribute, and send the response back.
The generator will receive the response with the added attribute.

To test this:

Apply this configuration to your Kubernetes cluster.
Check the logs of both the generator and processor pods to ensure they're running correctly.
You should see the generator sending requests and the processor adding the custom attribute in its logs.

Remember to adjust the image names and paths if they differ in your environment. Also, ensure that your FreeRADIUS image has the necessary tools (like radclient) installed for the generator to work properly.
think and correct it i want t o add xtra champ whe nreturrn