You can use pam and salsauthd with the -r flag to include the realm (the virtual domain) in the username. Then you can use whatever pam backend you want e.g sql or ldap to host your virtual users. btw I wrote a small project that might fit your use case, its documentation is written for debian, but it has some )ansible that sets up on FreeBSD as well. https://github.com/jsm222/django-cyradm and docs which might be useful are here https://djcyradm.schmitz.computer/ENVIRONMENT.html