toolkit/func/core/pkg_freeradius/10-test-freeradius.sh

23 lines
626 B
Bash
Raw Normal View History

2021-07-05 06:50:25 +00:00
#!/bin/bash
2023-11-29 21:09:12 +00:00
function cleanup() {
cp /etc/raddb/users.backup /etc/raddb/users
rm -rf /etc/raddb/users.backup
systemctl stop radiusd.service
}
2021-07-05 06:50:25 +00:00
2023-11-29 21:09:12 +00:00
r_log "freeradius" "Test basic freeradius functionality"
2021-07-05 06:50:25 +00:00
r_log "freeradius" "Configure freeradius"
2023-11-29 21:09:12 +00:00
trap cleanup EXIT
2021-07-05 06:50:25 +00:00
cp /etc/raddb/users /etc/raddb/users.backup
cat >> /etc/raddb/users << EOF
rocky Cleartext-Password := "rocky"
Service-Type = Framed-User
EOF
r_log "freeradius" "Testing..."
2021-07-05 22:35:12 +00:00
systemctl start radiusd.service
sleep 1
2021-07-05 06:50:25 +00:00
echo "User-Name=rocky,User-Password=rocky " | radclient -x localhost:1812 auth testing123 | grep -q 'Access-Accept'
r_checkExitStatus $?