GithubHelp home page GithubHelp logo

bodgit / gssapi Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 50 KB

Golang library providing a GSSAPI wrapper around gokrb5

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%
go golang golang-library gssapi kerberos

gssapi's Introduction

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)
	}
}

gssapi's People

Contributors

bodgit avatar dependabot[bot] avatar

Watchers

 avatar  avatar

gssapi's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.