Add proper PAP authentication with *strip fix for null padding

Two-processor approach:
1. AuthGetPassword: Fetches user password from attributes
2. AuthPAP: Uses *radauth + *pap with *strip:*suffix:*nil converter
   to remove null padding from PAP passwords before comparison

Uses ~*req.User-Password{*strip:*suffix:*nil} as recommended by
CGRateS maintainers to fix the null-padding comparison bug.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-23 23:29:57 +05:00
parent dd335be7f5
commit 9c21307ad3

View File

@@ -82,12 +82,34 @@
},
"request_processors": [
{
"id": "Auth",
"id": "AuthGetPassword",
"filters": ["*string:~*vars.*radReqType:*radAuth"],
"flags": ["*none", "*log"],
"request_fields": [],
"flags": ["*attributes", "*continue", "*log"],
"request_fields": [
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.User-Name"}
],
"reply_fields": []
},
{
"id": "AuthPAP",
"filters": ["*string:~*vars.*radReqType:*radAuth"],
"flags": ["*radauth", "*pap", "*log"],
"request_fields": [
{"tag": "UserPassword", "path": "*vars.UserPassword", "type": "*variable",
"value": "~*req.Password"},
{"tag": "StrippedPassword", "path": "*cgreq.Password", "type": "*variable",
"value": "~*req.User-Password{*strip:*suffix:*nil}"}
],
"reply_fields": [
{"tag": "SessionTimeout", "path": "*rep.Session-Timeout", "type": "*constant", "value": "3600"}
{"tag": "RemoveOnError", "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", "filters": ["*empty:~*cgrep.Error:"],
"type": "*constant", "value": "3600"},
{"tag": "AcctInterimInterval", "path": "*rep.Acct-Interim-Interval", "filters": ["*empty:~*cgrep.Error:"],
"type": "*constant", "value": "30"}
]
}
]