sshd AuthorizedKeysCommand helper for ldap
Install python-ldap
Ubuntu or Debian
sudo apt-get install python-ldap
Pip
sudo pip install python-ldap
Download this project
Create a config file and put it somewhere. There's a sample etc/pylpk.ini.sample.
By default the program would read it at /etc/pylpk.ini but you can change it by -f /your/path
Add AuthorizedKeysCommand to your sshd config file, just like
AuthorizedKeysCommand /your/path/to/pylpk.py
You may add AuthorizedKeysCommandUser.
After setup, Run the program to test your config
./pylpk.py username
If the username is correct and his public key was set, the public key would be printed.
Enjoy It!