]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add test for %proxy.sendto.ipaddr(...)
authorAlan T. DeKok <aland@freeradius.org>
Fri, 27 Dec 2024 13:27:25 +0000 (08:27 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 27 Dec 2024 13:27:25 +0000 (08:27 -0500)
which checks that proxying is a success

src/tests/radclient/auth_dynamic.out [new file with mode: 0644]
src/tests/radclient/auth_dynamic.txt [new file with mode: 0644]
src/tests/radclient/config/radiusd.conf

diff --git a/src/tests/radclient/auth_dynamic.out b/src/tests/radclient/auth_dynamic.out
new file mode 100644 (file)
index 0000000..d4b1464
--- /dev/null
@@ -0,0 +1,9 @@
+Sent Access-Request Id 123 from 0.0.0.0:1243 to 127.0.0.1:12351 length 45 
+        User-Name = "bob"
+        User-Password = "hello"
+        NAS-Identifier = "dynamic"
+        Password.Cleartext = "hello"
+Received Access-Accept Id 123 from 127.0.0.1:12351 to 0.0.0.0:1243 via lo length 38 
+        Reply-Message = "Have Proxy-State"
+        NAS-Port = 2
+(0) src/tests/radclient/auth_dynamic.txt response code 2
diff --git a/src/tests/radclient/auth_dynamic.txt b/src/tests/radclient/auth_dynamic.txt
new file mode 100644 (file)
index 0000000..be46ba5
--- /dev/null
@@ -0,0 +1,6 @@
+#
+#      ARGV: -i 123 -c 1 -x -F
+#
+User-Name = "bob",
+User-Password = "hello"
+NAS-Identifier := "dynamic"
index 8b41435bbdf99326512c405b71e7f70642c0d395..299b939229a2c7a6a283ee5a08bf3caf382e0612 100644 (file)
@@ -81,6 +81,19 @@ modules {
                }
 
        }
+
+       radius proxy {
+               mode = dynamic-proxy
+
+               type = Access-Request
+               type = Accounting-Request
+
+               transport = udp
+               udp {
+                       src_ipaddr = 127.0.0.1
+                       secret = testing123
+               }
+       }
 }
 
 #
@@ -155,6 +168,11 @@ server test {
                        return
                }
 
+               if ((&NAS-Identifier == "dynamic") && !&Proxy-State) {
+                       &control.Auth-Type := ::dynamic-proxy
+                       return
+               }
+
                if (&User-Name == "bob") {
                        accept
                } else {
@@ -167,6 +185,11 @@ server test {
                radius
        }
 
+       authenticate dynamic-proxy {
+               &reply.NAS-Port := %proxy.sendto.ipaddr(127.0.0.1, $ENV{TEST_PORT}, 'testing123')
+               ok
+       }
+
        send Access-Accept {
                if (&Proxy-State) {
                        &reply.Reply-Message := "Have Proxy-State"