Skip to content
/ pam Public
forked from donpark/pam

PAM layer for implementing your own pam library

License

Notifications You must be signed in to change notification settings

5up3rc/pam

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pam

PAM interaction for Go. Currently consists of functionality to implement your own module for PAM to load/communicate with for each service.

Install

go get github.com/zro/pam

Usage

Declare PAM request handling methods like this:

  import "github.com/donpark/pam"
  
  type mypam struct {
    // your pam vars
  }

  func (mp *mypam) Authenticate(hdl pam.Handle, args pam.Args) pam.Value {
    fmt.Println("Authenticate:", args)
    return pam.Success
  }

  func (mp *mypam) SetCredential(hdl pam.Handle, args pam.Args) pam.Value {
    fmt.Println("SetCredential:", args)
    return pam.Success
  }

  var mp mypam

  func init() {
    pam.RegisterAuthHandler(&mp)
  }

  func main() {
    // needed in c-shared buildmode
  }

Build custom PAM shared library

go build -buildmode=c-shared -o /lib64/security/pam_mypam.so main.go

For 32-bit env, /lib/security directory should be used.

Credits

I looked off of golang-pam-auth a bit for initial coding of pam method translations. Thanks has to go out to Amanda for her work here. The conversation code is mostly pulled directly from hers.

About

PAM layer for implementing your own pam library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 95.1%
  • C 4.9%