bastion

package
v0.0.0-...-3751135 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NocauthUser = "NOCAUTH_USER"
	NocauthHost = "NOCAUTH_HOST"
	NocauthPort = "NOCAUTH_PORT"
)

Variables

This section is empty.

Functions

func HandleSession

func HandleSession(sc *sessionConfig)

func HandleTCP

func HandleTCP(tc *tcpConfig)

func Run

func Run() (err error)

Types

type ACLConfig

type ACLConfig struct {
	Sessions []DstACL
	Forwards []DstACL
}

type ACLValidator

type ACLValidator struct {
	ACLConfig
}

func NewACLValidator

func NewACLValidator(conf ACLConfig) *ACLValidator

func (*ACLValidator) CheckForward

func (v *ACLValidator) CheckForward(user, host string, port uint16) bool

func (*ACLValidator) CheckSession

func (v *ACLValidator) CheckSession(user, host string, port uint16) bool

type ClientAgent

type ClientAgent struct {
	*sync.Mutex
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

func (*ClientAgent) Close

func (ca *ClientAgent) Close() error

func (*ClientAgent) GetAuth

func (ca *ClientAgent) GetAuth() (am ssh.AuthMethod, err error)

type Config

type Config struct {
	InetDStyle        bool          `yaml:"inetd_style"`
	HostKey           string        `yaml:"host_key"`
	ConnectTimeoutSec uint          `yaml:"connect_timeout"`
	ConnectTimeout    time.Duration `yaml:"-"`
	LogFormat         string        `yaml:"log_format"`
	LogFolder         string        `yaml:"log_folder"`
	CAKeys            string        `yaml:"ca_keys"`
	ACL               ACLConfig
}

noinspection GoStructTag

func ReadConfig

func ReadConfig(fname string) (c Config, err error)

type CriticalError

type CriticalError struct {
	// Err stores actual error
	Err error
}

TODO: check if this is needed CriticalError represents critical bastion child error

func NewCritical

func NewCritical(err error) CriticalError

NewCriticalError returns new critical error

func (CriticalError) Error

func (e CriticalError) Error() string

Error implements error interface

type DstACL

type DstACL struct {
	User  string
	Host  string
	Port  uint16
	Allow bool
}

type Server

type Server struct {
	Conf Config
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

Server implements SSH server that client connects to

func NewServer

func NewServer(conf Config, log *zap.SugaredLogger) *Server

func (*Server) ProcessConnection

func (s *Server) ProcessConnection(nConn net.Conn) (err error)

type Session

type Session struct {
	*zap.SugaredLogger

	ssh.Channel
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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