]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add MSCHAPv2 to tests
authorNick Porter <nick@portercomputing.co.uk>
Fri, 29 Mar 2024 10:21:47 +0000 (10:21 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Fri, 29 Mar 2024 12:40:56 +0000 (12:40 +0000)
src/tests/modules/mschap/auth_mschapv2.attrs [new file with mode: 0644]
src/tests/modules/mschap/auth_mschapv2.unlang [new file with mode: 0644]

diff --git a/src/tests/modules/mschap/auth_mschapv2.attrs b/src/tests/modules/mschap/auth_mschapv2.attrs
new file mode 100644 (file)
index 0000000..1c102da
--- /dev/null
@@ -0,0 +1,17 @@
+#
+#  Input Packet
+#
+Packet-Type = Access-Request
+User-Name = 'example\john'
+NAS-IP-Address = 127.0.0.1
+Vendor-Specific.Microsoft.CHAP-Challenge = 0x16d2833f4239256dd2b2bb26f2ecb2a3
+Vendor-Specific.Microsoft.CHAP2-Response = 0x0001502feeee9495a353cddbd1efc40072820000000000000000e866286bb30d0215ed16cf425b6a29d206667a9853e23ca4
+
+#
+#  Expected answer
+#
+Packet-Type == Access-Accept
+Vendor-Specific.Microsoft.CHAP2-Success == 0x00533d36383634394236373633333031444436354643323535394632443137323934333139364541383841
+Vendor-Specific.Microsoft.MPPE-Encryption-Policy == Encryption-Allowed
+Vendor-Specific.Microsoft.MPPE-Encryption-Types == RC4-40or128-bit-Allowed
+
diff --git a/src/tests/modules/mschap/auth_mschapv2.unlang b/src/tests/modules/mschap/auth_mschapv2.unlang
new file mode 100644 (file)
index 0000000..801ad14
--- /dev/null
@@ -0,0 +1,22 @@
+&control.Password.Cleartext := "secret"
+
+mschap
+
+if !(&control.Auth-Type == mschap) {
+       test_fail
+}
+
+mschap.authenticate
+
+if !(&reply.Vendor-Specific.Microsoft.MPPE-Send-Key) {
+       test_fail
+}
+
+if !(&reply.Vendor-Specific.Microsoft.MPPE-Recv-Key) {
+       test_fail
+}
+
+&reply -= &Vendor-Specific.Microsoft.MPPE-Send-Key
+&reply -= &Vendor-Specific.Microsoft.MPPE-Recv-Key
+
+test_pass