]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add CHAP tests to TACACS
authorNick Porter <nick@portercomputing.co.uk>
Wed, 30 Aug 2023 10:55:12 +0000 (11:55 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Wed, 30 Aug 2023 14:06:20 +0000 (15:06 +0100)
src/tests/tacacs/authenticate_chap.out [new file with mode: 0644]
src/tests/tacacs/authenticate_chap.txt [new file with mode: 0644]
src/tests/tacacs/authenticate_chapfail.out [new file with mode: 0644]
src/tests/tacacs/authenticate_chapfail.txt [new file with mode: 0644]
src/tests/tacacs/config/radiusd.conf

diff --git a/src/tests/tacacs/authenticate_chap.out b/src/tests/tacacs/authenticate_chap.out
new file mode 100644 (file)
index 0000000..48be683
--- /dev/null
@@ -0,0 +1,3 @@
+status: PASS
+data: b'Authentication-Data'
+server_msg: b'CHAP authentication accepted'
diff --git a/src/tests/tacacs/authenticate_chap.txt b/src/tests/tacacs/authenticate_chap.txt
new file mode 100644 (file)
index 0000000..90cd26e
--- /dev/null
@@ -0,0 +1,3 @@
+#
+#      ARGV: -t chap -u tapioca authenticate -p queijo -i a -c qwerQWERtyuiTYUI
+#
diff --git a/src/tests/tacacs/authenticate_chapfail.out b/src/tests/tacacs/authenticate_chapfail.out
new file mode 100644 (file)
index 0000000..0890d3c
--- /dev/null
@@ -0,0 +1,3 @@
+status: FAIL
+data: b'Authentication-Data'
+server_msg: b'CHAP authentication failed for scald'
diff --git a/src/tests/tacacs/authenticate_chapfail.txt b/src/tests/tacacs/authenticate_chapfail.txt
new file mode 100644 (file)
index 0000000..a7b1cd4
--- /dev/null
@@ -0,0 +1,3 @@
+#
+#      ARGV: -t chap -u scald authenticate -p pegapilha -i a -c qwerQWERtyuiTYUI
+#
index 264d14ac094ba56f333f13c170270c22a6c8f439..431e59547d14a1c8a004f3a1d612877fe16d746d 100644 (file)
@@ -139,6 +139,18 @@ server test {
                }
        }
 
+       authenticate CHAP {
+               if (&User-Name == 'tapioca') {
+                       &control.Password.Cleartext = 'queijo'
+               }
+               chap { fail = 1, reject = 2 }
+               if (ok) {
+                       &reply.Server-Message := "CHAP authentication accepted"
+               } else {
+                       &reply.Server-Message := "CHAP authentication failed for %{User-Name}"
+               }
+       }
+
        send Authentication-Pass {
                &reply.Data := "Authentication-Data"
        }