ldap

package
v0.0.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ldap has the LDAP manager's command-line flags, for a server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrListCmd added in v0.0.15

type AttrListCmd struct {
	Filter string  `arg:"" optional:"" name:"filter" help:"Name or OID"`
	Usage  string  `` /* 183-byte string literal not displayed */
	Offset uint64  `name:"offset" help:"Offset within the list"`
	Limit  *uint64 `name:"limit" help:"Number of attribute types to list"`
}

func (*AttrListCmd) Run added in v0.0.15

func (cmd *AttrListCmd) Run(ctx server.Cmd) error

type ClassListCmd added in v0.0.15

type ClassListCmd struct {
	Filter string   `arg:"" optional:"" name:"filter" help:"Name or OID"`
	Kind   string   `name:"kind" enum:",ABSTRACT,STRUCTURAL,AUXILIARY" default:"" help:"ABSTRACT, STRUCTURAL or AUXILIARY"`
	Must   []string `name:"must" help:"Only classes which need the attribute. Repeat for more than one."`
	May    []string `name:"may" help:"Only classes which can have the attribute. Repeat for more than one."`
	For    string   `name:"for" enum:",user,group" default:"" help:"Only the classes users, or groups, are created with, and their superiors"`
	Offset uint64   `name:"offset" help:"Offset within the list"`
	Limit  *uint64  `name:"limit" help:"Number of classes to list"`
}

func (*ClassListCmd) Run added in v0.0.15

func (cmd *ClassListCmd) Run(ctx server.Cmd) error

type GroupAddCmd added in v0.0.15

type GroupAddCmd struct {
	Name  string   `arg:"" name:"name" help:"Group name"`
	Users []string `arg:"" name:"users" help:"Users to add, by name"`
}

func (*GroupAddCmd) Run added in v0.0.15

func (cmd *GroupAddCmd) Run(ctx server.Cmd) error

type GroupCommands

type GroupCommands struct {
	GroupList   GroupListCmd   `cmd:"" name:"ldap-groups" help:"List the groups, or a user's, as LDIF." group:"LDAP"`
	GroupGet    GroupGetCmd    `cmd:"" name:"ldap-group" help:"Get a group, by name, as LDIF." group:"LDAP"`
	GroupCreate GroupCreateCmd `cmd:"" name:"ldap-group-create" help:"Create a group, with attributes as name=value." group:"LDAP"`
	GroupUpdate GroupUpdateCmd `` /* 182-byte string literal not displayed */
	GroupDelete GroupDeleteCmd `cmd:"" name:"ldap-group-delete" help:"Delete a group." group:"LDAP"`
	GroupAdd    GroupAddCmd    `cmd:"" name:"ldap-group-add" help:"Add users to a group." group:"LDAP"`
	GroupRemove GroupRemoveCmd `cmd:"" name:"ldap-group-remove" help:"Remove users from a group." group:"LDAP"`
}

GroupCommands list, get, create, update and delete groups, by name, and add and remove their members

type GroupCreateCmd added in v0.0.15

type GroupCreateCmd struct {
	Name  string   `arg:"" name:"name" help:"Group name, which is its cn"`
	Attrs []string `arg:"" optional:"" name:"attrs" help:"Attributes as name=value, repeated for more values"`
}

func (*GroupCreateCmd) Run added in v0.0.15

func (cmd *GroupCreateCmd) Run(ctx server.Cmd) error

type GroupDeleteCmd added in v0.0.15

type GroupDeleteCmd struct {
	Name string `arg:"" name:"name" help:"Group name"`
}

func (*GroupDeleteCmd) Run added in v0.0.15

func (cmd *GroupDeleteCmd) Run(ctx server.Cmd) error

type GroupGetCmd added in v0.0.15

type GroupGetCmd struct {
	Name string `arg:"" name:"name" help:"Group name, which is its cn"`
}

func (*GroupGetCmd) Run added in v0.0.15

func (cmd *GroupGetCmd) Run(ctx server.Cmd) error

type GroupListCmd added in v0.0.15

type GroupListCmd struct {
	User   string   `name:"user" help:"Only the groups the user is a member of"`
	Filter string   `name:"filter" help:"LDAP filter, such as (cn=a*)"`
	Attr   []string `name:"attr" help:"Attribute to return. Repeat for more than one."`
	Offset uint64   `name:"offset" help:"Offset within the list"`
	Limit  *uint64  `name:"limit" help:"Number of groups to list"`
}

func (*GroupListCmd) Run added in v0.0.15

func (cmd *GroupListCmd) Run(ctx server.Cmd) error

type GroupRemoveCmd added in v0.0.15

type GroupRemoveCmd struct {
	Name  string   `arg:"" name:"name" help:"Group name"`
	Users []string `arg:"" name:"users" help:"Users to remove, by name"`
}

func (*GroupRemoveCmd) Run added in v0.0.15

func (cmd *GroupRemoveCmd) Run(ctx server.Cmd) error

type GroupUpdateCmd added in v0.0.15

type GroupUpdateCmd struct {
	Name  string   `arg:"" name:"name" help:"Group name"`
	Attrs []string `arg:"" name:"attrs" help:"Attributes as name=value, repeated for more values, or name= to delete them"`
}

func (*GroupUpdateCmd) Run added in v0.0.15

func (cmd *GroupUpdateCmd) Run(ctx server.Cmd) error

type ObjectBindCmd added in v0.0.15

type ObjectBindCmd struct {
	DN string `arg:"" name:"dn" help:"DN, relative to the base DN, or under it"`
}

func (*ObjectBindCmd) Run added in v0.0.15

func (cmd *ObjectBindCmd) Run(ctx server.Cmd) error

type ObjectCommands

type ObjectCommands struct {
	ObjectList     ObjectListCmd     `cmd:"" name:"ldap-objects" help:"List the entries under the base DN, or a prefix, as LDIF." group:"LDAP"`
	ObjectGet      ObjectGetCmd      `cmd:"" name:"ldap-object" help:"Get an entry, by DN, as LDIF." group:"LDAP"`
	ObjectCreate   ObjectCreateCmd   `` /* 127-byte string literal not displayed */
	ObjectUpdate   ObjectUpdateCmd   `` /* 185-byte string literal not displayed */
	ObjectDelete   ObjectDeleteCmd   `cmd:"" name:"ldap-object-delete" help:"Delete an entry, which has no children." group:"LDAP"`
	ObjectBind     ObjectBindCmd     `cmd:"" name:"ldap-object-bind" help:"Check an entry's password, which is prompted for, or read from the input." group:"LDAP"`
	ObjectPassword ObjectPasswordCmd `` /* 156-byte string literal not displayed */
}

ObjectCommands list, get, create, update and delete entries, by DN, bind as them, and change their passwords

type ObjectCreateCmd added in v0.0.15

type ObjectCreateCmd struct {
	DN    string   `arg:"" name:"dn" help:"DN, relative to the base DN, or under it"`
	Attrs []string `arg:"" name:"attrs" help:"Attributes as name=value, repeated for more values"`
}

func (*ObjectCreateCmd) Run added in v0.0.15

func (cmd *ObjectCreateCmd) Run(ctx server.Cmd) error

type ObjectDeleteCmd added in v0.0.15

type ObjectDeleteCmd struct {
	DN string `arg:"" name:"dn" help:"DN, relative to the base DN, or under it"`
}

func (*ObjectDeleteCmd) Run added in v0.0.15

func (cmd *ObjectDeleteCmd) Run(ctx server.Cmd) error

type ObjectGetCmd added in v0.0.15

type ObjectGetCmd struct {
	DN string `arg:"" name:"dn" help:"DN, relative to the base DN, or under it"`
}

func (*ObjectGetCmd) Run added in v0.0.15

func (cmd *ObjectGetCmd) Run(ctx server.Cmd) error

type ObjectListCmd added in v0.0.15

type ObjectListCmd struct {
	Prefix   string   `name:"prefix" help:"DN of the subtree to list, relative to the base DN"`
	Children bool     `name:"children" help:"Only the entries directly under the prefix, or the base DN"`
	Filter   string   `name:"filter" help:"LDAP filter, such as (cn=a*)"`
	Attr     []string `name:"attr" help:"Attribute to return. Repeat for more than one."`
	Offset   uint64   `name:"offset" help:"Offset within the list"`
	Limit    *uint64  `name:"limit" help:"Number of entries to list"`
}

func (*ObjectListCmd) Run added in v0.0.15

func (cmd *ObjectListCmd) Run(ctx server.Cmd) error

type ObjectPasswordCmd added in v0.0.15

type ObjectPasswordCmd struct {
	DN       string `arg:"" name:"dn" help:"DN, relative to the base DN, or under it"`
	Old      bool   `name:"old" help:"Change the password with the old one, which is checked, rather than resetting it"`
	Generate bool   `name:"generate" help:"Generate the new password, which is printed"`
}

func (*ObjectPasswordCmd) Run added in v0.0.15

func (cmd *ObjectPasswordCmd) Run(ctx server.Cmd) error

type ObjectUpdateCmd added in v0.0.15

type ObjectUpdateCmd struct {
	DN    string   `arg:"" name:"dn" help:"DN, relative to the base DN, or under it"`
	Attrs []string `arg:"" name:"attrs" help:"Attributes as name=value, repeated for more values, or name= to delete them"`
}

func (*ObjectUpdateCmd) Run added in v0.0.15

func (cmd *ObjectUpdateCmd) Run(ctx server.Cmd) error

type SchemaCommands added in v0.0.15

type SchemaCommands struct {
	ClassList ClassListCmd `cmd:"" name:"ldap-classes" help:"List the directory's object classes, by name." group:"LDAP"`
	AttrList  AttrListCmd  `cmd:"" name:"ldap-attrs" help:"List the directory's attribute types, by name." group:"LDAP"`
}

SchemaCommands list the directory's object classes and attribute types

type ServerFlags added in v0.0.15

type ServerFlags struct {
	URL        string   `` /* 158-byte string literal not displayed */
	BaseDN     string   `name:"base-dn" env:"LDAP_BASE_DN" help:"Base DN, which every DN is under, such as dc=example,dc=com"`
	User       string   `name:"user" env:"LDAP_USER" help:"User to bind as, which is a DN, or a name under the base DN, rather than the URL's"`
	Password   string   `name:"password" env:"LDAP_PASSWORD" help:"Password of the user, rather than the URL's"`
	UserDN     string   `` /* 132-byte string literal not displayed */
	UserClass  []string `` /* 162-byte string literal not displayed */
	GroupDN    string   `` /* 137-byte string literal not displayed */
	GroupClass []string `` /* 162-byte string literal not displayed */
	SkipVerify bool     `name:"skip-verify" env:"LDAP_SKIP_VERIFY" help:"Don't verify the directory's TLS certificate" negatable:""`
}

ServerFlags configure the LDAP manager: the directory, the user it binds as, and the DNs of its users and groups, which are passed to WithLDAPManager. They're embedded with a prefix, such as ldap.

func (ServerFlags) WithLDAPManager added in v0.0.15

func (flags ServerFlags) WithLDAPManager(ctx server.Cmd, publisher manager.Publisher, fn func(*manager.Manager) error, opts ...manager.Opt) error

WithLDAPManager creates the LDAP manager, with the command's tracer, and the publisher, such as go-server's broadcaster, when it isn't nil, which publishes its changes, and the manager's own options. It runs the manager, which connects, and reconnects when the connection is lost, and calls fn with it, then disconnects, when fn returns.

type UserCommands

type UserCommands struct {
	UserList   UserListCmd   `cmd:"" name:"ldap-users" help:"List the users, or a group's members, as LDIF." group:"LDAP"`
	UserGet    UserGetCmd    `cmd:"" name:"ldap-user" help:"Get a user, by name, as LDIF." group:"LDAP"`
	UserCreate UserCreateCmd `` /* 135-byte string literal not displayed */
	UserUpdate UserUpdateCmd `` /* 182-byte string literal not displayed */
	UserDelete UserDeleteCmd `cmd:"" name:"ldap-user-delete" help:"Delete a user." group:"LDAP"`
}

UserCommands list, get, create, update and delete users, by name

type UserCreateCmd added in v0.0.15

type UserCreateCmd struct {
	Name        string   `arg:"" name:"name" help:"User name, which is its uid, or cn in Active Directory"`
	Attrs       []string `arg:"" optional:"" name:"attrs" help:"Attributes as name=value, repeated for more values"`
	AllocateGID bool     `name:"allocate-gid" help:"Set the gidNumber to the uidNumber, for a posixAccount"`
}

func (*UserCreateCmd) Run added in v0.0.15

func (cmd *UserCreateCmd) Run(ctx server.Cmd) error

type UserDeleteCmd added in v0.0.15

type UserDeleteCmd struct {
	Name string `arg:"" name:"name" help:"User name"`
}

func (*UserDeleteCmd) Run added in v0.0.15

func (cmd *UserDeleteCmd) Run(ctx server.Cmd) error

type UserGetCmd added in v0.0.15

type UserGetCmd struct {
	Name string `arg:"" name:"name" help:"User name, which is its uid, or cn in Active Directory"`
}

func (*UserGetCmd) Run added in v0.0.15

func (cmd *UserGetCmd) Run(ctx server.Cmd) error

type UserListCmd added in v0.0.15

type UserListCmd struct {
	Group  string   `name:"group" help:"Only the group's members"`
	Filter string   `name:"filter" help:"LDAP filter, such as (cn=a*)"`
	Attr   []string `name:"attr" help:"Attribute to return. Repeat for more than one."`
	Offset uint64   `name:"offset" help:"Offset within the list"`
	Limit  *uint64  `name:"limit" help:"Number of users to list"`
}

func (*UserListCmd) Run added in v0.0.15

func (cmd *UserListCmd) Run(ctx server.Cmd) error

type UserUpdateCmd added in v0.0.15

type UserUpdateCmd struct {
	Name  string   `arg:"" name:"name" help:"User name"`
	Attrs []string `arg:"" name:"attrs" help:"Attributes as name=value, repeated for more values, or name= to delete them"`
}

func (*UserUpdateCmd) Run added in v0.0.15

func (cmd *UserUpdateCmd) Run(ctx server.Cmd) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL