https://github.com/etersoft/libnss-role does what you want