Skip to content

xtfly/gokrb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GoKrb

A go wrapper for Kerberos and SASL2 libs.

Currently the implemention:

  • Client side APIs that use SASL APIs for authentication to service that implement GSSAPI using Kerberos 5.

Note: It is developing...

Usage

Note: You need to install the krb5-libs, sasl2-libs, gcc into your OS, like this in Archlinux:

$ sudo pacman -S krb5
$ sudo pacman -S gcc

Install this package using go tools:

$ go get github.com/xtfly/gokrb

To run you must have a valid Kerberos setup on the run machine and you should ensure that you have valid Kerberos tickets:

$ export KRB5_CONFIG=/path/to/krb5.conf
$ kinit -kt "/path/to/your.keytab" "kafka/[email protected]"
$ klist

Example Kerberos client authentication to service:

package main

import (
    "github.com/xtfly/gokrb/gssapi"
)

func main() {
    var conn io.ReadWriter
    //...
    // create a connection to service
    err := gssapi.GssAuth(conn, "kafka", "hadoop.com")
    if err != nil {
        // do something ...
    }
}

Note: if the krb5-libs/sasl2-libs are not install in /usr/lib64 and /usr/include, you need set follow environment variables:

$ export CGO_CFLAG=-I/path/to/include
$ export CGO_LDFLAG=-L/path/to/lib
$ export LD_LIBRARY_PATH=/path/to/lib

License

Gorkb is released under the MIT License. See the LICENSE file.

Releases

No releases published

Packages

No packages published

Languages