ldapsshkeys

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

Overview

pipeline status coverage report Latest Release

Look up SSH Public Keys from an LDAP Service! You can use this either from your SSH Server, or just the command line.

Installation

Download binaries from the release page

You can also pull from the normal devil-ops locations...check out the installing-devil-ops-packages for more info

Usage

On the command line, you can run with:

$ ldap-ssh-key-lookup some-netid
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF/9vhMdBYzVqWtN6jo/jYNje0wyZ7ukBOfFPcfJdY7i some-netid@workstation

To use this with OpenSSH, add the following to your sshd_config file:

AuthorizedKeysCommand /usr/bin/ldap-ssh-key-lookup
AuthorizedKeysCommandUser nobody
Configuration

This is meant to be a pretty simple app to just retrieve and print keys if they exist, so there's not a config. If you would like to change the ldap server or other options from the defaults, you can do so with the following:

export SSHKEY_LDAP_URL=ldaps://something.else.edu:636
export SSHKEY_BASEDN="dn=example.com"

This code is freely available for non-commercial use and is provided as-is with no warranty.

Documentation

Overview

Package ldapsshkeys is a library to do ssh key lookups

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the thing we use to do the actual lookups

func MustNew

func MustNew(opts ...Option) *Client

MustNew returns a new client for lookups using functional options or panics if an error happens

func New

func New(opts ...Option) (*Client, error)

New returns a new client for lookups using functional options

func (*Client) Close

func (kl *Client) Close() error

Close closes the ldap connection

func (Client) FetchKeys

func (kl Client) FetchKeys(user string) string

FetchKeys returns keys for a given user as a string

type Option

type Option func(*Client)

Option are functional options to instantiate a new client

func WithBaseDN

func WithBaseDN(s string) Option

WithBaseDN sets the base DN for the lookups

func WithLDAPClient

func WithLDAPClient(l ldap.Client) Option

WithLDAPClient sets the ldap client for a lookup client

Directories

Path Synopsis
cmd
ldap-ssh-key-lookup
Package main is the CLI app for LDAP lookups
Package main is the CLI app for LDAP lookups

Jump to

Keyboard shortcuts

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