Categorygithub.com/bodgit/gssapi
modulepackage
0.0.2
Repository: https://github.com/bodgit/gssapi.git
Documentation: pkg.go.dev

# README

GitHub release Build Status Coverage Status Go Report Card GoDoc Go version Go version

GSSAPI wrapper for gokrb5

The github.com/bodgit/gssapi package implements a GSSAPI-like wrapper around the github.com/jcmturner/gokrb5 package.

Sample Initiator (Client):

package main

import (
	. "github.com/bodgit/gssapi"
	"github.com/jcmturner/gokrb5/v8/gssapi"
)

func main() {
	initiator, err := NewInitiator(WithRealm("EXAMPLE.COM"), WithUsername("test"), WithKeytab[Initiator]("test.keytab"))
	if err != nil {
		panic(err)
	}

	defer initiator.Close()

	output, cont, err := initiator.Initiate("host/ssh.example.com", gssapi.ContextFlagInteg|gssapi.ContextFlagMutual, nil)
	if err != nil {
		panic(err)
	}

	// transmit output to Acceptor

	signature, err := initiator.MakeSignature(message)
	if err != nil {
		panic(err)
	}

	// transmit message and signature to Acceptor
}

Sample Acceptor (Server):

package main

import (
	. "github.com/bodgit/gssapi"
	"github.com/jcmturner/gokrb5/v8/gssapi"
	"github.com/jcmturner/gokrb5/v8/iana/nametype"
	"github.com/jcmturner/gokrb5/v8/types"
)

func main() {
	principal := types.NewPrincipalName(nametype.KRB_NT_SRV_HST, "host/ssh.example.com")

	acceptor, err := NewAcceptor(WithServicePrincipal(&principal))
	if err != nil {
		panic(err)
	}

	defer acceptor.Close()

	// receive input from Initiator

	output, cont, err := acceptor.Accept(input)
	if err != nil {
		panic(err)
	}

	// transmit output back to Initiator

	// receive message and signature from Initiator

	if err := acceptor.VerifySignature(message, signature); err != nil {
		panic(err)
	}
}

# Functions

NewAcceptor returns a new Acceptor.
NewInitiator returns a new Initiator.
WithClockSkew sets the permitted amount of clock skew allowed between the Initiator and Acceptor.
WithConfig permits passing krb5.conf contents directly to an Initiator.
WithDomain sets the Kerberos domain in the Initiator.
WithKeytab sets the keytab path in either an Initiator or Acceptor.
WithLogger configures a logr.Logger in either an Initiator or Acceptor.
WithPassword sets the password in the Initiator.
WithRealm is an alias for WithDomain.
WithServicePrincipal sets the principal that is looked up in the keytab.
WithUsername sets the username in the Initiator.

# Structs

Acceptor represents the server side of the GSSAPI protocol.
Initiator represents the client side of the GSSAPI protocol.

# Type aliases

Option is the signature for all constructor options.