{"id":31628032,"url":"https://github.com/jirutka/ssh-ldap-pubkey","last_synced_at":"2025-10-06T20:17:06.716Z","repository":{"id":16246372,"uuid":"18994173","full_name":"jirutka/ssh-ldap-pubkey","owner":"jirutka","description":"Utility to manage SSH public keys stored in LDAP.","archived":false,"fork":false,"pushed_at":"2024-02-15T14:53:20.000Z","size":115,"stargazers_count":238,"open_issues_count":14,"forks_count":46,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-09-29T17:14:05.599Z","etag":null,"topics":["authentication","ldap","python","ssh","ssh-key"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jirutka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.adoc","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jirutka"}},"created_at":"2014-04-21T14:03:17.000Z","updated_at":"2025-09-02T20:49:59.000Z","dependencies_parsed_at":"2024-06-19T22:48:27.015Z","dependency_job_id":"9dfaf3d0-37d8-4b55-be7d-7520f6670077","html_url":"https://github.com/jirutka/ssh-ldap-pubkey","commit_stats":{"total_commits":125,"total_committers":12,"mean_commits":"10.416666666666666","dds":0.128,"last_synced_commit":"7ba9cebd22d74e21f715f5979422bc51e67d7768"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/jirutka/ssh-ldap-pubkey","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fssh-ldap-pubkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fssh-ldap-pubkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fssh-ldap-pubkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fssh-ldap-pubkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jirutka","download_url":"https://codeload.github.com/jirutka/ssh-ldap-pubkey/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fssh-ldap-pubkey/sbom","scorecard":{"id":521630,"data":{"date":"2025-08-11","repo":{"name":"github.com/jirutka/ssh-ldap-pubkey","commit":"7ba9cebd22d74e21f715f5979422bc51e67d7768"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/jirutka/ssh-ldap-pubkey/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/jirutka/ssh-ldap-pubkey/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/jirutka/ssh-ldap-pubkey/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/jirutka/ssh-ldap-pubkey/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/jirutka/ssh-ldap-pubkey/ci.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:34","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T03:09:47.874Z","repository_id":16246372,"created_at":"2025-08-20T03:09:47.874Z","updated_at":"2025-08-20T03:09:47.874Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278672039,"owners_count":26025824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","ldap","python","ssh","ssh-key"],"created_at":"2025-10-06T20:17:03.877Z","updated_at":"2025-10-06T20:17:06.710Z","avatar_url":"https://github.com/jirutka.png","language":"Python","funding_links":["https://github.com/sponsors/jirutka"],"categories":[],"sub_categories":[],"readme":"OpenSSH / LDAP public keys\n==========================\n[![Build Status](https://github.com/jirutka/ssh-ldap-pubkey/workflows/CI/badge.svg)](https://github.com/jirutka/ssh-ldap-pubkey/actions?query=workflow%3A%22CI%22)\n[![Code Climate](https://codeclimate.com/github/jirutka/ssh-ldap-pubkey/badges/gpa.svg)](https://codeclimate.com/github/jirutka/ssh-ldap-pubkey)\n[![version](https://img.shields.io/pypi/v/ssh-ldap-pubkey.svg?style=flat)](https://pypi.python.org/pypi/ssh-ldap-pubkey)\n\nThis project provides an utility to manage SSH public keys stored in LDAP and also a script for\nOpenSSH server to load authorized keys from LDAP.\n\n\nWhy?\n----\n\nWhen you have dozen of servers it becomes difficult to manage your authorized keys. You have to\ncopy all your public keys to `~/.ssh/authorized_keys` on every server you want to login to. And\nwhat if you someday change your keys?\n\nIt’s a good practice to use some kind of a centralized user management, usually an LDAP server.\nThere you have user’s login, uid, e-mail, … and password. What if we could also store public SSH\nkeys on LDAP server? With this utility it’s easy as pie.\n\n\nAlternatives\n------------\n\nIf you need just a lightweight utility for OpenSSH server to load authorized keys from LDAP,\nthen you can use [ssh-getkey-ldap](https://github.com/jirutka/ssh-getkey-ldap) written in Lua\nor [this one](https://gist.github.com/jirutka/b15c31b2739a4f3eab63) written in POSIX shell\n(but it requires `ldapsearch` utility and may not work well on some systems).\n\n\nRequirements\n------------\n\n* Python 3.6+\n* [python-ldap] 3.x\n* [docopt] 0.6.x\n\nYou can install both Python modules from PyPI.\npython-ldap requires additional system dependencies – OpenLDAP.\nRefer to [Stack Overflow](http://stackoverflow.com/q/4768446/240963) for distribution-specific information.\n\n\nInstallation\n------------\n\n### PyPI:\n\n    pip install ssh-ldap-pubkey\n\n### Alpine Linux\n\n    apk add ssh-ldap-pubkey\n\nNote: The package is currently in the (official) _community_ repository; make sure that you have community in `/etc/apk/repositories`.\n\n\nUsage\n-----\n\nList SSH public keys stored in LDAP for the current user:\n\n    ssh-ldap-pubkey list\n\nList SSH public keys stored in LDAP for the specified user:\n\n    ssh-ldap-pubkey list -u flynn\n\nAdd the specified SSH public key for the current user to LDAP:\n\n    ssh-ldap-pubkey add ~/.ssh/id_rsa.pub\n\nRemove SSH public key(s) of the current user that matches the specified pattern:\n\n    ssh-ldap-pubkey del flynn@grid\n\nSpecify LDAP URI and base DN on command line instead of configuration file:\n\n    ssh-ldap-pubkey list -b ou=People,dc=encom,dc=com -H ldaps://encom.com -u flynn\n\nAs the LDAP manager, add SSH public key to LDAP for the specified user:\n\n    ssh-ldap-pubkey add -D cn=Manager,dc=encom,dc=com -u flynn ~/.ssh/id_rsa.pub\n\nShow help for other options:\n\n    ssh-ldap-pubkey --help\n\n\nConfiguration\n-------------\n\nConfiguration is read from /etc/ldap.conf — file used by LDAP nameservice switch library and the\nLDAP PAM module. An example file is included in [etc/ldap.conf][ldap.conf]. The following subset of\nparameters are used:\n\n*  **uri** ... URI(s) of the LDAP server(s) to connect to, separated by a space. The URI scheme may\n               be ldap, or ldaps. Default is `ldap://localhost`.\n*  **nss_base_passwd** ... distinguished name (DN) of the search base.\n*  **base** ... distinguished name (DN) of the search base. Used when *nss_base_passwd* is not set.\n*  **scope** ... search scope; _sub_, _one_, or _base_ (default is _sub_).\n*  **referrals** ... should client automatically follow referrals returned by LDAP servers (default is _on_)?\n*  **pam_filter** ... filter to use when searching for the user’s entry, additional to the login\n        attribute value assertion (`pam_login_attribute=\u003clogin\u003e`). Default is\n        _objectclass=posixAccount_.\n*  **pam_login_attribute** ... the user ID attribute (default is _uid_).\n*  **ldap_version** ... LDAP version to use (default is 3).\n*  **sasl** ... enable SASL and specify mechanism to use (currently only GSSAPI is supported).\n*  **binddn** ... distinguished name (DN) to bind when reading the user’s entry (default is to bind\n                  anonymously).\n*  **bindpw** ... credentials to bind with when reading the user’s entry (default is none).\n*  **ssl** ... LDAP SSL/TLS method; _off_, _on_, or _start_tls_. If you use LDAP over SSL (i.e. URI `ldaps://`), leave this empty.\n*  **timelimit** ... search time limit in seconds (default is 10).\n*  **bind_timelimit** ... bind/connect time limit in seconds (default is 10). If multiple URIs are\n                          specified in _uri_, then the next one is tried after this timeout.\n*  **tls_cacertdir** ... path of the directory with CA certificates for LDAP server certificate\n                         verification.\n*  **pubkey_class** ... objectClass that should be added/removed to/from the user’s entry when adding/removing first/last public key and the *pubkey_attr* is mandatory for this class.\n   This is needed for the original openssh-lpk.schema (not for the one in this repository).\n   Default is `ldapPublicKey`.\n*  **pubkey_attr** ... name of LDAP attribute used for SSH public keys (default is `sshPublicKey`).\n\nThe only required parameter is *nss_base_passwd* or _base_, others have sensitive defaults. You\nmight want to define _uri_ parameter as well. These parameters can be also defined/overriden\nwith `--bind` and `--uri` options on command line.\n\nFor more information about these parameters refer to ldap.conf man page.\n\n\nSet up OpenSSH server\n--------------------\n\nTo configure OpenSSH server to fetch users’ authorized keys from LDAP server:\n\n1.  Make sure that you have installed **ssh-ldap-pubkey** and **ssh-ldap-pubkey-wrapper** in\n    `/usr/bin` with owner `root` and mode `0755`.\n2.  Add these two lines to /etc/ssh/sshd_config:\n\n        AuthorizedKeysCommand /usr/bin/ssh-ldap-pubkey-wrapper\n        AuthorizedKeysCommandUser nobody\n\n3.  Restart sshd and check log file if there’s no problem.\n\nNote: This method is supported by OpenSSH since version 6.2-p1 (or 5.3 onRedHat). If you have an\nolder version and can’t upgrade, for whatever weird reason, use [openssh-lpk] patch instead.\n\n\nSet up LDAP server\n------------------\n\nJust add the [openssh-lpk.schema] to your LDAP server, **or** add an attribute named `sshPublicKey`\nto any existing schema which is already defined in people entries. That’s all.\n\nNote: Presumably, you’ve already set up your LDAP server for centralized unix users management,\ni.e. you have the [NIS schema](http://www.zytrax.com/books/ldap/ape/nis.html) and users in LDAP.\n\n\nLicense\n-------\n\nThis project is licensed under [MIT license](http://opensource.org/licenses/MIT).\n\n\n[python-ldap]: https://pypi.python.org/pypi/python-ldap/\n[docopt]: https://pypi.python.org/pypi/docopt/\n[ebuild]: https://github.com/cvut/gentoo-overlay/tree/master/sys-auth/ssh-ldap-pubkey\n[cvut-overlay]: https://github.com/cvut/gentoo-overlay\n[openssh-lpk]: http://code.google.com/p/openssh-lpk/\n\n[ldap.conf]: https://github.com/jirutka/ssh-ldap-pubkey/blob/master/etc/ldap.conf\n[openssh-lpk.schema]: https://github.com/jirutka/ssh-ldap-pubkey/blob/master/etc/openssh-lpk.schema\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fssh-ldap-pubkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjirutka%2Fssh-ldap-pubkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fssh-ldap-pubkey/lists"}