{"id":17874090,"url":"https://github.com/devkral/pam_email_extractor","last_synced_at":"2025-06-29T01:37:32.004Z","repository":{"id":141378338,"uuid":"107043647","full_name":"devkral/pam_email_extractor","owner":"devkral","description":"Extract email from multiple sources and add to pam environment","archived":false,"fork":false,"pushed_at":"2018-03-15T15:59:33.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T00:12:35.579Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/devkral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2017-10-15T19:45:30.000Z","updated_at":"2018-03-15T15:56:31.000Z","dependencies_parsed_at":"2024-05-11T23:45:15.432Z","dependency_job_id":null,"html_url":"https://github.com/devkral/pam_email_extractor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/devkral/pam_email_extractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkral%2Fpam_email_extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkral%2Fpam_email_extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkral%2Fpam_email_extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkral%2Fpam_email_extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devkral","download_url":"https://codeload.github.com/devkral/pam_email_extractor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devkral%2Fpam_email_extractor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262520599,"owners_count":23323738,"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","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":[],"created_at":"2024-10-28T11:07:33.340Z","updated_at":"2025-06-29T01:37:31.976Z","avatar_url":"https://github.com/devkral.png","language":"C","readme":"# Setup\n\n```sh\ncd ./build\ncmake ..\nmake\ncp ./src/pam_email_extractor.so \u003cdir for pam modules\u003e\n```\n\nin pam service file add:\nauth optional pam_email_extractor.so \u003cconfiguration\u003e\nor\nsession optional pam_email_extractor.so \u003cconfiguration\u003e\n(only of them is needed elsewise there could be duplicate ldap requests)\n\n# Usage\n\nIn some program (here rpam2, ruby) retrieve the \"email\" pam environment variable:\n\n```ruby\nrequire 'rpam2'\n# 'email' is the pam environment variable set by pam_email_extractor\nRpam2.getenv('\u003cservicefile\u003e', '\u003cusername\u003e', '\u003cpassword\u003e', 'email')\n# or easier\n# returns hash with entry: 'email' -\u003e email address\nRpam2.listenv('\u003cservicefile\u003e', '\u003cusername\u003e', '\u003cpassword\u003e')\n```\n\n# Naming\n\npam_email as well as pam_mail already existed so I had to rename to pam_email_extractor.\n\n# Configuration\n\nitems are position dependent and are seperated by whitespaces\n\npossible items:\n* gecos= : extract email from the gecos field of the user\n* git=[/.gitignore] : extract email from user .gitconfig (or other file)\n* file=[/.email] : extract email from user .email (or other file)\n* ldap=\u0026lt;url;dn;emailattribute;filter\u0026gt; : extract email from ldap.\n* default=[hostname] : default email domain to add to username; e.g. default=example.org and username is tom =\u003e tom@example.org. Defaults to hostname\n\npam_email_extractor uses following aruments if no arguments were given:\nfile gecos git default\n\n## ldap\n\nLDAP is always available except if compiled with the NO_LDAP flag\nldap takes following ; seperated arguments:\n* url: url to query, needs scheme e.g. ldaps://\n* dn: domain of user objects\n* emailattribute (default: \"email\"): name of emailattribute of user object\n* filter (default: \"(uid=?)\"): filter query, ? is replaced by username in filter query\n\n## git \u0026 file\n\nnote that given path has to start with /.\ncomposition is e.g.:\n\nuser tom =\u003e prefix: /home/tom\nparam /.email =\u003e combined: /home/tom/.email\n\n\n## default\n\nBecause in default the username is taken in whole I limit the amount of retries when allocating.\nIt should be used as a fallback and returns if not out of memory always an emailaddress. So it is wise to position it last.\nIf no hostname is given it uses system gethostname.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevkral%2Fpam_email_extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevkral%2Fpam_email_extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevkral%2Fpam_email_extractor/lists"}