Categorygithub.com/ubccr/goipa
modulepackage
0.0.7
Repository: https://github.com/ubccr/goipa.git
Documentation: pkg.go.dev

# README

goipa - FreeIPA client library

===============================================================================

GoDoc

goipa is a FreeIPA client library written in Go. It interfaces with the FreeIPA JSON api over HTTPS.

Usage

Install using go tools:

$ go get github.com/ubccr/goipa

Example calling FreeIPA user-show:

package main

import (
    "fmt"

    "github.com/ubccr/goipa"
)

func main() {
    client := ipa.NewDefaultClient()

    err := client.LoginWithKeytab("/path/to/user.keytab", "username")
    if err != nil {
        panic(err)
    }

    rec, err := client.UserShow("username")
    if err != nil {
        panic(err)
    }

    fmt.Println("%s - %s", rec.Username, rec.Uid)
}

Hacking

Development and testing goipa uses docker-compose. The scripts to spin up a FreeIPA test server in docker were copied/adopted from this great repository. Most of the scripts in container/ directory are written by Jan Pazdziora and licensed under Apache 2.0 and modified for use with goipa.

NOTE: The containers are NOT meant to be run in production and used solely for development.

To get started hacking on goipa and running the test suite:

$ cp .env.sample .env
[edit to taste. add passwords and ssh key]

$ docker-compose build
$ docker-compose up -d
$ ssh -p 9022 localhost
$ kinit admin
$ cd /app
$ go test

To run a specific test with trace debugging:

$ go test -v -run UserShow

License

goipa is released under a BSD style License. See the LICENSE file.

# Functions

New IPA Client with host and realm.
New IPA Client with host, realm and custom http client.
New default IPA Client using host and realm from /etc/ipa/default.conf.
New default IPA Client with existing sessionID using host and realm from /etc/ipa/default.conf.
No description provided by the author
Parse a FreeIPA datetime.

# Constants

OTP Token hash Algorithms supported by FreeIPA.
OTP Token hash Algorithms supported by FreeIPA.
OTP Token hash Algorithms supported by FreeIPA.
OTP Token hash Algorithms supported by FreeIPA.
No description provided by the author
No description provided by the author
No description provided by the author
OTP Token types supported by FreeIPA.
OTP Token types supported by FreeIPA.

# Variables

No description provided by the author
ErrExpiredPassword is returned when a password is expired.
ErrInvalidPassword is returned when a password is invalid.
ErrPasswordPolicy is returned when a password does not conform to the password policy.
ErrUnauthorized is returned when user is not authorized.
ErrUserExists is returned when user account already exists.

# Structs

FreeIPA Client.
FreeIPA error.
OTPToken encapsulates FreeIPA otptokens.
Response returned from a FreeIPA JSON rpc call.
Result returned from a FreeIPA JSON rpc call.
SSH Public Key.
User encapsulates user data returned from ipa user commands.

# Type aliases

FreeIPA api options map.