jumpi

package
v0.0.0-...-b4c004e Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: BSD-3-Clause Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashSHA256 int = 0
)

Variables

View Source
var (
	ErrNoHostKey = errors.New("no host key found")

	SSHBanner string = `` /* 239-byte string literal not displayed */

)
View Source
var (
	BucketMeta        = []string{"meta"}
	BucketMetaAdmins  = []string{"meta", "admins"}
	BucketSecrets     = []string{"secrets"}
	BucketTargets     = []string{"targets"}
	BucketSessions    = []string{"sessions"}
	BucketUsers       = []string{"users"}
	BucketUsersConfig = []string{"users", "config"}
	BucketRoles       = []string{"roles"}
	BucketCasts       = []string{"casts"}

	ErrNoBucketGiven     = errors.New("no bucket specified")
	ErrLocked            = errors.New("store is locked")
	ErrUnknownHash       = errors.New("unknown hash algorithm for key derivation")
	ErrUnsupportedCipher = errors.New("unknown cipher for store")

	DefaultRounds int = 20
)
View Source
var (
	ErrWrongHeader    = errors.New("unable to parse SCP header, may be corruped")
	ErrUnknownCommand = errors.New("unknown SCP header command")
)
View Source
var (
	ErrWrongKeyFormat = errors.New("wrong publickey format")
	ErrUnknownUser    = errors.New("user unknown")
)
View Source
var (
	ConfigYubikeyAPI = "config:yubikey_api"
)
View Source
var (
	DerivationIterations = 8192
)
View Source
var (
	ErrNoSecret = errors.New("unable to locate secret for target")
)
View Source
var (
	ErrNoSession = errors.New("unable to start cast recording: no session set")
)
View Source
var (
	ErrUnknownSecretType = errors.New("unknown secret type")
)
View Source
var (
	LimitRequest int64 = 4096
)

Functions

func AddRole

func AddRole(role *Role) error

func CheckRole

func CheckRole(user, target string, twofactor bool) (bool, string)

func ContextMiddleware

func ContextMiddleware(handler http.Handler) http.HandlerFunc

func DeleteRole

func DeleteRole(role *Role) error

func InitRoleManager

func InitRoleManager(store *Store)

func LoginRequired

func LoginRequired(handler http.Handler) http.HandlerFunc

func NewAPIv1Router

func NewAPIv1Router(router *mux.Router) (*mux.Router, error)

Main Router

func ResponseError

func ResponseError(w http.ResponseWriter, status int, e error)

func StackMiddleware

func StackMiddleware(handler http.HandlerFunc, mid ...func(http.Handler) http.HandlerFunc) http.HandlerFunc

func StartAPIServer

func StartAPIServer(root string, store *Store)

func StartIndexerServer

func StartIndexerServer(store *Store) error

func StartSSHServer

func StartSSHServer(store *Store, twofa *TwoFactorAuth, hostkey string) error

func StoreUnlockRequired

func StoreUnlockRequired(handler http.Handler) http.HandlerFunc

Types

type AuthenticationHandler

type AuthenticationHandler interface {
	Verify(username, token string) bool
	Setup(username string, tty *terminal.Terminal) error
}

type Cast

type Cast struct {
	Session   string          `json:"session"`
	Duration  float64         `json:"duration"`
	Records   [][]interface{} `json:"stdout,omitempty"`
	Width     int             `json:"width"`
	Height    int             `json:"height"`
	Version   int             `json:"version"`
	User      string          `json:"user,omitempty"`
	Target    string          `json:"target,omitempty"`
	StartTime string          `json:"start,omitempty"`
	// contains filtered or unexported fields
}

func (*Cast) Copy

func (cast *Cast) Copy(dest io.Writer, src io.Reader) (int64, error)

similar to io.copyBuffer method, but instead of directly writing to the destination, we will keep a copy and safe it to be replayed later

func (*Cast) Start

func (cast *Cast) Start(store *Store) error

func (*Cast) Stop

func (cast *Cast) Stop()

func (*Cast) Store

func (cast *Cast) Store(store *Store) error

type JSONRequest

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

func ParseJsonRequest

func ParseJsonRequest(r *http.Request, v interface{}) (*JSONRequest, error)

func (JSONRequest) Validate

func (jr JSONRequest) Validate() error

type JSONResponse

type JSONResponse struct {
	Status  int         `json:"status"`
	Content interface{} `json:"response,omitempty"`
}

func (JSONResponse) Write

func (jr JSONResponse) Write(w http.ResponseWriter) error

type Role

type Role struct {
	Name        string `json:"name"`
	UserRegex   string `json:"rex_user"`
	TargetRegex string `json:"rex_target"`
	Requires2FA bool   `json:"require_2fa"`
	// contains filtered or unexported fields
}

func (*Role) Delete

func (r *Role) Delete(store *Store) error

func (*Role) Store

func (r *Role) Store(store *Store) error

type RoleManager

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

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

func (Route) Attach

func (r Route) Attach(router *mux.Router)

type Routes

type Routes []Route

func (Routes) Attach

func (r Routes) Attach(router *mux.Router)

type Secret

type Secret struct {
	ID     string
	Type   TypeSecret
	Secret interface{}
}

func (*Secret) Delete

func (secret *Secret) Delete(store *Store) error

func (*Secret) Fingerprint

func (secret *Secret) Fingerprint() string

func (*Secret) Load

func (secret *Secret) Load(store *Store) error

func (*Secret) Store

func (secret *Secret) Store(store *Store) error

type Store

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

func GetStore

func GetStore(r *http.Request) (*Store, error)

func NewStore

func NewStore(filename string) (*Store, error)

func (*Store) Auth

func (store *Store) Auth(username string, password []byte) bool

func (*Store) Close

func (store *Store) Close()

func (*Store) Create

func (store *Store) Create(bucket []string) error

func (*Store) Delete

func (store *Store) Delete(bucket []string, key string) error

func (*Store) FTR

func (store *Store) FTR()

func (*Store) Get

func (store *Store) Get(bucket []string, key string) ([]byte, error)

func (*Store) GetRaw

func (store *Store) GetRaw(bucket []string, key string) ([]byte, error)

func (*Store) IsLocked

func (store *Store) IsLocked() bool

func (*Store) Lock

func (store *Store) Lock() error

func (*Store) Scan

func (store *Store) Scan(bucket []string, q string, skip, limit int, decrypt, reverse bool) ([]*keyvalue, error)

func (*Store) Set

func (store *Store) Set(bucket []string, key string, value []byte) error

func (*Store) SetRaw

func (store *Store) SetRaw(bucket []string, key string, value []byte) error

func (*Store) Unlock

func (store *Store) Unlock(password []byte) error

type Target

type Target struct {
	Username string
	Hostname string
	Port     int
	Secret   *Secret
	Cast     *Cast
	Session  string
	// contains filtered or unexported fields
}

func (*Target) Connect

func (target *Target) Connect(sessChannel ssh.Channel, sessReqs <-chan *ssh.Request, chans <-chan ssh.NewChannel) error

func (*Target) ID

func (target *Target) ID() string

func (*Target) LoadSecret

func (target *Target) LoadSecret(store *Store) error

func (*Target) Store

func (target *Target) Store(store *Store) error

type TwoFactorAuth

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

func StartTwoFactorAuthServer

func StartTwoFactorAuthServer(store *Store) (*TwoFactorAuth, error)

func (*TwoFactorAuth) HasTwoFactor

func (h *TwoFactorAuth) HasTwoFactor(username string) (string, bool)

func (*TwoFactorAuth) Setup

func (h *TwoFactorAuth) Setup(username, kind string, tty *terminal.Terminal) error

func (*TwoFactorAuth) Verify

func (h *TwoFactorAuth) Verify(username, token string) bool

type TypeSecret

type TypeSecret int
const (
	Password TypeSecret = 0
	PKey     TypeSecret = 1
)

type User

type User struct {
	Name           string
	KeyFingerprint string
}

func UserFromPublicKey

func UserFromPublicKey(name string, publickey string) (*User, error)

func (*User) Delete

func (user *User) Delete(store *Store) error

func (*User) Load

func (user *User) Load(store *Store) error

func (*User) Store

func (user *User) Store(store *Store) error

Jump to

Keyboard shortcuts

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