Trying to import the pam backend in keystone on a devstack setup I did this morning reveals this:
$ python -c "import keystone.identity.backends.pam"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/stack/keystone/keystone/identity/backends/pam.py", line 19, in <module>
import pam
ImportError: No module named pam
After further investigation it seems that Ubuntu (as well as openSUSE which I also looked at) install python-pam as the uppercase 'PAM' package. The python package installed by pip on the other hand installs it as the lowercase 'pam'.
I don't know what the best solution is here. Write a "try: import pam; except ImportError: import PAM" block, or petition all distros to package a symlink from 'pam' to 'PAM' :).
I looked at this a bit in Fedora. The PyPAM package installs a Python module as PAM. However, it does not provide the same API as the pam module used in keystone. identity. backends. pam. It looks like it won't be too hard to add support for PyPAM, though.