https://github.com/pepabo/libpam-mruby
A PAM module to authenticate user with mruby
https://github.com/pepabo/libpam-mruby
Last synced: about 1 month ago
JSON representation
A PAM module to authenticate user with mruby
- Host: GitHub
- URL: https://github.com/pepabo/libpam-mruby
- Owner: pepabo
- Created: 2015-09-17T17:52:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-18T06:06:02.000Z (about 8 years ago)
- Last Synced: 2025-04-15T03:04:25.187Z (about 1 month ago)
- Language: C
- Homepage:
- Size: 9.77 KB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# libpam-mruby
A PAM module to authenticate user with mruby.
## Usage
Add a file that has a line like below into `/etc/.pam.d` (or other location along with your environment):
```
auth sufficient pam_mruby.so rbfile=/path/to/auth.rb try_first_pass
```Then write an auth handler in mruby like below.
`auth.rb`:
```ruby
def authenticate(username, password)
if username == 'kentaro' && password == 'p@ssw0rd'
true
else
false
end
end
````authenticate()` method at top-level is called when your mruby handler is executed.
For more practical usage, you can use this module, for instance, to handle authentication request using some external user information repository service. Thanks to mruby's flexibility, you can easily introduce mrbgems to your auth handler script.
## How to Build
### Using Docker
On Mac OSX or other:
```
$ docker-compose build libpam-mruby
$ docker-compose run libpam-mruby
```You'll see the artifact at `build/pam_mruby.so`.
### Build Directly
Install prerequisites like below(on CentOS):
```
$ yum -y install gcc bison rake
$ yum -y pam pam-devel
```Then execute `rake` command:
```
$ rake
```Also you'll see the artifact at `build/pam_mruby.so`.
## Author
* Kentaro Kuribayashi
* Uchio KONDO## License
MIT