An open API service indexing awesome lists of open source software.

https://github.com/xtfly/gokrb

A go wrapper for Kerberos
https://github.com/xtfly/gokrb

golang gssapi kerberos

Last synced: 6 months ago
JSON representation

A go wrapper for Kerberos

Awesome Lists containing this project

README

          

# 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/hadoop.com@HADOOP.COM"
$ 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.