https://github.com/bodgit/gssapi
Golang library providing a GSSAPI wrapper around gokrb5
https://github.com/bodgit/gssapi
go golang golang-library gssapi kerberos
Last synced: 3 months ago
JSON representation
Golang library providing a GSSAPI wrapper around gokrb5
- Host: GitHub
- URL: https://github.com/bodgit/gssapi
- Owner: bodgit
- License: bsd-3-clause
- Created: 2023-09-07T00:02:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-10T02:50:13.000Z (6 months ago)
- Last Synced: 2025-02-02T23:15:01.546Z (5 months ago)
- Topics: go, golang, golang-library, gssapi, kerberos
- Language: Go
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bodgit/gssapi/releases)
[](https://github.com/bodgit/gssapi/actions?query=workflow%3ABuild)
[](https://coveralls.io/github/bodgit/gssapi?branch=main)
[](https://goreportcard.com/report/github.com/bodgit/gssapi)
[](https://godoc.org/github.com/bodgit/gssapi)

# GSSAPI wrapper for gokrb5
The [github.com/bodgit/gssapi](https://godoc.org/github.com/bodgit/gssapi)
package implements a GSSAPI-like wrapper around the
[github.com/jcmturner/gokrb5](https://github.com/jcmturner/gokrb5) package.Sample Initiator (Client):
```golang
package mainimport (
. "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):
```golang
package mainimport (
. "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)
}
}
```