From f6bcdccf9cae1bd88ab1629f824e88017481ed51 Mon Sep 17 00:00:00 2001 From: Junaid Saeed Uppal Date: Tue, 23 Dec 2025 21:13:38 +0500 Subject: [PATCH] Workaround CGRateS MS-CHAPv2 bug - use *event instead of *radauth MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CGRateS has a bug where *radauth + *mschapv2 looks for MS-CHAP-Response (attribute 1) instead of MS-CHAP2-Response (attribute 25). MikroTik sends MS-CHAP2-Response, causing MANDATORY_IE_MISSING error. This workaround uses *event + *attributes to validate user existence via attributes subsystem. The actual password validation is NOT done server-side - MikroTik will handle MS-CHAPv2 locally. TODO: Report bug to CGRateS - librad.go line 130 should use MS-CHAP2-Response for MetaMSCHAPV2 case. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- cgrates.json | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/cgrates.json b/cgrates.json index a3aaf15..6254984 100644 --- a/cgrates.json +++ b/cgrates.json @@ -82,27 +82,15 @@ }, "request_processors": [ { - "id": "MSCHAPv2GetPassword", + "id": "PPPoEAuth", "filters": ["*string:~*vars.*radReqType:*radAuth"], - "flags": ["*authorize", "*attributes", "*continue", "*log"], + "flags": ["*event", "*attributes", "*log"], "request_fields": [ {"tag": "Account", "path": "*cgreq.Account", "type": "*composed", "value": "~*req.User-Name", "mandatory": true} ], "reply_fields": [ - {"tag": "SessionTimeout", "path": "*rep.Session-Timeout", "type": "*constant", "value": "3600"} - ] - }, - { - "id": "MSCHAPv2Auth", - "filters": ["*string:~*vars.*radReqType:*radAuth"], - "flags": ["*radauth", "*mschapv2", "*log"], - "request_fields": [ - {"tag": "UserPassword", "path": "*vars.UserPassword", "type": "*variable", "value": "~*cgrep.Attributes.Password"} - ], - "reply_fields": [ - {"tag": "RemoveAddedFields", "filters": ["*notempty:~*cgrep.Error:"], "type": "*removeall", "path": "*rep"}, - {"tag": "Code", "path": "*rep.*radReplyCode", "filters": ["*notempty:~*cgrep.Error:"], "type": "*constant", "value": "AccessReject"}, - {"tag": "ReplyMessage", "path": "*rep.Reply-Message", "filters": ["*notempty:~*cgrep.Error:"], "type": "*variable", "value": "~*cgrep.Error"} + {"tag": "SessionTimeout", "path": "*rep.Session-Timeout", "type": "*constant", "value": "3600"}, + {"tag": "AcctInterimInterval", "path": "*rep.Acct-Interim-Interval", "type": "*constant", "value": "60"} ] } ]