Because you listed both modules in the authorization section as:
authorize { ... domain1 domain2 ... }
The server doesn't know that the "domain1" module is for domain1.com. You have to tell it.
You are right, i've listed both , not in authorize section but under authenticate section
You can do regular expression matches on the User-Name:
if (User-Name =~ /@domain1.com/) { domain1 } elsif (User-Name =~ /@domain2.com/) { domain2 }
With your suggestion I tried radtest and works correctly, I then modified using (Realm == domain1) elseif (Realm ==domain2) and it works also in this way, thank you very much for your help I've another problem now, I need to use this with a captive portal that support only chap or ms-chapv2 and when a user try to login to captive portal configured with chap in freeradius log I have the error chap: ERROR: &control:Cleartext-Password is required for authentication or, if I set ms-chapv2 in captive portal, the error is (1) mschap: WARNING: No Cleartext-Password configured. Cannot create NT-Password (1) mschap: Creating challenge hash with username: xxx@xxx.com (1) mschap: Client is using MS-CHAPv2 (1) mschap: ERROR: FAILED: No NT/LM-Password. Cannot perform authentication (1) mschap: ERROR: MS-CHAP2-Response is incorrect It's possible to have chap (or ms-chapv2) and ldap working in freeradius? Thank's again for the support ------------------------------ INFORMATIVA PRIVACY (Reg.UE 2016/679 e D.Lgs.196/2003) Questa email ed i suoi eventuali allegati sono da considerarsi materiale riservato e di proprietà della scrivente società. Nel caso venisse ricevuta per errore non deve essere divulgata, copiata o distribuita per alcuna ragione. Le comunicazioni che transitano attraverso il presente indirizzo di posta elettronica hanno carattere e finalità prettamente lavorative, pertanto potranno essere conosciute all’interno dell’organizzazione aziendale. Qualsiasi dato personale sarà comunque trattato in conformità alle vigenti normative in materia di privacy e protezione dei dati personali. A tale riguardo potete esercitare tutti i diritti previsti dalla legge semplicemente rispondendo alla presente ed esplicitando la vostra richiesta. Maggiori info in materia di privacy: https://www.c2group.it/policy-privacy