Documentation ¶
Index ¶
- Constants
- func Unmarshal(v []byte, t EncoderDecoder) error
- type AcctArg
- type AcctBytes
- type AcctBytesIn
- type AcctBytesOut
- type AcctData
- type AcctElapsedTime
- type AcctErrMsg
- type AcctEvent
- type AcctPaks
- type AcctPaksIn
- type AcctPaksOut
- type AcctReason
- type AcctReply
- type AcctReplyOption
- type AcctReplyStatus
- type AcctRequest
- type AcctRequestFlag
- func (b *AcctRequestFlag) Clear(f AcctRequestFlag)
- func (b *AcctRequestFlag) Has(f AcctRequestFlag) bool
- func (t AcctRequestFlag) Len() int
- func (b *AcctRequestFlag) Set(f AcctRequestFlag)
- func (t AcctRequestFlag) String() string
- func (b *AcctRequestFlag) Toggle(f AcctRequestFlag)
- func (t AcctRequestFlag) Validate(condition interface{}) error
- type AcctRequestOption
- func SetAcctRequestArgs(v Args) AcctRequestOption
- func SetAcctRequestFlag(v AcctRequestFlag) AcctRequestOption
- func SetAcctRequestMethod(v AuthenMethod) AcctRequestOption
- func SetAcctRequestPort(v AuthenPort) AcctRequestOption
- func SetAcctRequestPrivLvl(v PrivLvl) AcctRequestOption
- func SetAcctRequestRemAddr(v AuthenRemAddr) AcctRequestOption
- func SetAcctRequestService(v AuthenService) AcctRequestOption
- func SetAcctRequestType(v AuthenType) AcctRequestOption
- func SetAcctRequestUser(v AuthenUser) AcctRequestOption
- type AcctServerMsg
- type AcctStartTime
- type AcctStopTime
- type AcctTaskID
- type AcctTimezone
- type Arg
- type Args
- func (t *Args) Append(args ...string)
- func (t Args) Args() []string
- func (t Args) Command() string
- func (t Args) CommandArgs() string
- func (t Args) CommandArgsNoLE() string
- func (t Args) CommandSplit() (string, string, string)
- func (t Args) Len() int
- func (t Args) Service() string
- func (t Args) String() string
- func (t Args) Unique() Args
- func (t Args) Validate(condition interface{}) error
- type AuthenAction
- type AuthenContinue
- type AuthenContinueFlag
- type AuthenContinueOption
- type AuthenData
- type AuthenMethod
- type AuthenPort
- type AuthenRemAddr
- type AuthenReply
- type AuthenReplyFlag
- type AuthenReplyOption
- type AuthenServerMsg
- type AuthenService
- type AuthenStart
- type AuthenStartOption
- func SetAuthenStartAction(v AuthenAction) AuthenStartOption
- func SetAuthenStartData(v AuthenData) AuthenStartOption
- func SetAuthenStartPort(v AuthenPort) AuthenStartOption
- func SetAuthenStartPrivLvl(v PrivLvl) AuthenStartOption
- func SetAuthenStartRemAddr(v AuthenRemAddr) AuthenStartOption
- func SetAuthenStartService(v AuthenService) AuthenStartOption
- func SetAuthenStartType(v AuthenType) AuthenStartOption
- func SetAuthenStartUser(v AuthenUser) AuthenStartOption
- type AuthenStatus
- type AuthenType
- type AuthenUser
- type AuthenUserMessage
- type AuthorACL
- type AuthorAddr
- type AuthorAddrPool
- type AuthorAutoCmd
- type AuthorCmd
- type AuthorCmdArg
- type AuthorData
- type AuthorIdleTime
- type AuthorInACL
- type AuthorNoEscape
- type AuthorNoHangup
- type AuthorOutACL
- type AuthorProtocol
- type AuthorReply
- type AuthorReplyOption
- type AuthorRequest
- type AuthorRequestOption
- func SetAuthorRequestArgs(v Args) AuthorRequestOption
- func SetAuthorRequestMethod(v AuthenMethod) AuthorRequestOption
- func SetAuthorRequestPort(v AuthenPort) AuthorRequestOption
- func SetAuthorRequestPrivLvl(v PrivLvl) AuthorRequestOption
- func SetAuthorRequestRemAddr(v AuthenRemAddr) AuthorRequestOption
- func SetAuthorRequestService(v AuthenService) AuthorRequestOption
- func SetAuthorRequestType(v AuthenType) AuthorRequestOption
- func SetAuthorRequestUser(v AuthenUser) AuthorRequestOption
- type AuthorServerMsg
- type AuthorService
- type AuthorStatus
- type AuthorTimeout
- type BadSecretErr
- type Client
- type ClientOption
- type ClientSequenceNumber
- type ContextKey
- type DeadlineListener
- type EncoderDecoder
- type Field
- type Handler
- type HandlerFunc
- type Header
- type HeaderFlag
- type HeaderOption
- func SetHeaderFlag(v HeaderFlag) HeaderOption
- func SetHeaderLen(v int) HeaderOption
- func SetHeaderRandomSessionID() HeaderOption
- func SetHeaderSeqNo(v int) HeaderOption
- func SetHeaderSessionID(v SessionID) HeaderOption
- func SetHeaderType(v HeaderType) HeaderOption
- func SetHeaderVersion(v Version) HeaderOption
- type HeaderType
- type LastSequence
- type Option
- type Packet
- type PacketOption
- type PrivLvl
- type Request
- type Response
- type SecretProvider
- type SequenceNumber
- type Server
- type SessionID
- type Version
- type Writer
Constants ¶
const ( // MajorVersion is the major TACACS version number. MajorVersion = 0xc // MinorVersionDefault is TACACS MinorVersionDefault = 0x0 // MinorVersionOne is TACACS+ MinorVersionOne = 0x1 // HeaderMaxSequence if reached, connection must terminate and start at 1 again HeaderMaxSequence = 255 )
constants related to Version
const AcctReplyLen = 0x5
AcctReplyLen minumum length of this packet type
const AcctRequestLen = 0x9
AcctRequestLen minumum length of this packet type
const AuthenContinueLen = 0x05
AuthenContinueLen minumum length of this packet type
const AuthenReplyLen = 0x05
AuthenReplyLen minumum length of this packet type
const AuthenStartLen = 0x08
AuthenStartLen minumum length of this packet type
const AuthorReplyLen = 0x6
AuthorReplyLen minumum length of this packet type
const AuthorRequestLen = 0x8
AuthorRequestLen minumum length of this packet type
const ( // MaxBodyLength is the total length of the packet body (not including the header). // Implementations MUST allow control over maximum packet sizes // accepted by TACACS+ Servers. The recommended maximum packet size // is 2^(16). MaxBodyLength uint32 = 65536 )
const MaxHeaderLength = 0x0c
MaxHeaderLength defines a fixed size for a tacacs header
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
func Unmarshal(v []byte, t EncoderDecoder) error
Unmarshal will unmarshal tacacs bytes
Types ¶
type AcctArg ¶
type AcctArg string
AcctArg is the arguments describe the specifics of the accounting that is being requested.
type AcctBytesIn ¶
type AcctBytesIn int
AcctBytesIn The number of bytes transferred by this action from the endstation to the client port.
func (AcctBytesIn) String ¶
func (t AcctBytesIn) String() string
String returns AcctBytesIn as a string.
func (AcctBytesIn) Validate ¶
func (t AcctBytesIn) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctBytesOut ¶
type AcctBytesOut int
AcctBytesOut The number of bytes transferred by this action from the client to the endstation port.
func (AcctBytesOut) String ¶
func (t AcctBytesOut) String() string
String returns AcctBytesOut as a string.
func (AcctBytesOut) Validate ¶
func (t AcctBytesOut) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctData ¶
type AcctData string
AcctData is a string that may be presented on an administrative display, console, or log. The decision to present this message is client specific. The data_len indicates the length of the data field, in bytes. For details of text encoding, see "Treatment of Text Strings"
type AcctElapsedTime ¶
type AcctElapsedTime int
AcctElapsedTime The elapsed time in seconds for the action.
func (AcctElapsedTime) Len ¶
func (t AcctElapsedTime) Len() int
Len returns the length of AcctElapsedTime.
func (AcctElapsedTime) String ¶
func (t AcctElapsedTime) String() string
String returns AcctElapsedTime as a string.
func (AcctElapsedTime) Validate ¶
func (t AcctElapsedTime) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctErrMsg ¶
type AcctErrMsg string
AcctErrMsg A string describing the status of the action. For details of text encoding, see "Treatment of Text Strings" (https://datatracker.ietf.org/doc/html/rfc8907#section-3.7).
func (AcctErrMsg) String ¶
func (t AcctErrMsg) String() string
String returns AcctErrMsg as a string.
func (AcctErrMsg) Validate ¶
func (t AcctErrMsg) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctEvent ¶
type AcctEvent string
AcctEvent is Used only when "service=system". Current values are "net_acct", "cmd_acct", "conn_acct", "shell_acct", "sys_acct", and "clock_change". These indicate system-level changes. The flags field SHOULD indicate whether the service started or stopped.
type AcctPaksIn ¶
type AcctPaksIn int
AcctPaksIn The number of input packets transferred by this action from the endstation to the client port.
func (AcctPaksIn) String ¶
func (t AcctPaksIn) String() string
String returns AcctPaksIn as a string.
func (AcctPaksIn) Validate ¶
func (t AcctPaksIn) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctPaksOut ¶
type AcctPaksOut int
AcctPaksOut The number of output packets transferred by this action from the endstation to the client port.
func (AcctPaksOut) String ¶
func (t AcctPaksOut) String() string
String returns AcctPaksOut as a string.
func (AcctPaksOut) Validate ¶
func (t AcctPaksOut) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctReason ¶
type AcctReason string
AcctReason Accompanies an event argument. It describes why the event occurred.
func (AcctReason) String ¶
func (t AcctReason) String() string
String returns AcctReason as a string.
func (AcctReason) Validate ¶
func (t AcctReason) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctReply ¶
type AcctReply struct { Status AcctReplyStatus ServerMsg AcctServerMsg Data AcctData }
AcctReply https://datatracker.ietf.org/doc/html/rfc8907#section-7.2
func NewAccountingReplyFromBytes ¶
NewAccountingReplyFromBytes creates AcctReply from decrypted tacacs bytes
func NewAcctReply ¶
func NewAcctReply(opts ...AcctReplyOption) *AcctReply
NewAcctReply will create a new AcctReply based on the provided options
func (AcctReply) Fields ¶
Fields returns fields from this packet compatible with a structured logger
func (*AcctReply) MarshalBinary ¶
MarshalBinary marshals AccountingReply to tacacs bytes
func (*AcctReply) UnmarshalBinary ¶
UnmarshalBinary unmarshals decrypted tacacs bytes to AcctReply
type AcctReplyOption ¶
type AcctReplyOption func(*AcctReply)
AcctReplyOption is used to inject options when creating new AcctRequest types
func SetAcctReplyData ¶
func SetAcctReplyData(v AcctData) AcctReplyOption
SetAcctReplyData sets the AcctData.
func SetAcctReplyServerMsg ¶
func SetAcctReplyServerMsg(v string) AcctReplyOption
SetAcctReplyServerMsg sets the AcctServerMsg.
func SetAcctReplyStatus ¶
func SetAcctReplyStatus(v AcctReplyStatus) AcctReplyOption
SetAcctReplyStatus sets the AcctReplyStatus.
type AcctReplyStatus ¶
type AcctReplyStatus uint8
AcctReplyStatus is the status of the accounting action.
const ( // AcctReplyStatusSuccess per rfc AcctReplyStatusSuccess AcctReplyStatus = 0x01 // AcctReplyStatusError per rfc AcctReplyStatusError AcctReplyStatus = 0x02 )
func (AcctReplyStatus) Len ¶
func (t AcctReplyStatus) Len() int
Len returns the length of AcctReplyStatus.
func (AcctReplyStatus) String ¶
func (t AcctReplyStatus) String() string
String returns AcctReplyStatus as a string.
func (AcctReplyStatus) Validate ¶
func (t AcctReplyStatus) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctRequest ¶
type AcctRequest struct { Flags AcctRequestFlag Method AuthenMethod PrivLvl PrivLvl Type AuthenType Service AuthenService User AuthenUser Port AuthenPort RemAddr AuthenRemAddr Args Args }
AcctRequest https://datatracker.ietf.org/doc/html/rfc8907#section-7.1
func NewAccountingRequestFromBytes ¶
func NewAccountingRequestFromBytes(data []byte) (*AcctRequest, error)
NewAccountingRequestFromBytes creates AcctRequest for tacacs decrypted bytes
func NewAcctRequest ¶
func NewAcctRequest(opts ...AcctRequestOption) *AcctRequest
NewAcctRequest will create a new AcctRequest based on the provided options
func (AcctRequest) Fields ¶
func (a AcctRequest) Fields() map[string]string
Fields returns fields from this packet compatible with a structured logger
func (AcctRequest) Len ¶
func (a AcctRequest) Len() int
Len will return the unmarshalled size of the component types
func (*AcctRequest) MarshalBinary ¶
func (a *AcctRequest) MarshalBinary() ([]byte, error)
MarshalBinary marshals AccountingRequest to tacacs bytes
func (*AcctRequest) UnmarshalBinary ¶
func (a *AcctRequest) UnmarshalBinary(data []byte) error
UnmarshalBinary unmarshals decrypted tacacs bytes to AccountingRequest
func (*AcctRequest) Validate ¶
func (a *AcctRequest) Validate() error
Validate all fields on this type
type AcctRequestFlag ¶
type AcctRequestFlag uint8
AcctRequestFlag bitmapped values
const ( // AcctFlagStart per rfc AcctFlagStart AcctRequestFlag = 0x02 // AcctFlagStop per rfc AcctFlagStop AcctRequestFlag = 0x04 // AcctFlagWatchdog per rfc AcctFlagWatchdog AcctRequestFlag = 0x08 // AcctFlagWatchdogWithUpdate with update per rfc AcctFlagWatchdogWithUpdate AcctRequestFlag = 0x0A )
func (*AcctRequestFlag) Clear ¶
func (b *AcctRequestFlag) Clear(f AcctRequestFlag)
Clear AcctRequestFlag's f bit.
func (*AcctRequestFlag) Has ¶
func (b *AcctRequestFlag) Has(f AcctRequestFlag) bool
Has returns true when b has the f bit set.
func (AcctRequestFlag) Len ¶
func (t AcctRequestFlag) Len() int
Len returns the length of AcctRequestFlag.
func (*AcctRequestFlag) Set ¶
func (b *AcctRequestFlag) Set(f AcctRequestFlag)
Set AcctRequestFlag's f bit.
func (AcctRequestFlag) String ¶
func (t AcctRequestFlag) String() string
String to satisfy Fields interface
func (*AcctRequestFlag) Toggle ¶
func (b *AcctRequestFlag) Toggle(f AcctRequestFlag)
Toggle AcctRequestFlag's f bit.
func (AcctRequestFlag) Validate ¶
func (t AcctRequestFlag) Validate(condition interface{}) error
Validate checks for the correct flags to be set
type AcctRequestOption ¶
type AcctRequestOption func(*AcctRequest)
AcctRequestOption is used to inject options when creating new AcctRequest types
func SetAcctRequestArgs ¶
func SetAcctRequestArgs(v Args) AcctRequestOption
SetAcctRequestArgs sets the Args.
func SetAcctRequestFlag ¶
func SetAcctRequestFlag(v AcctRequestFlag) AcctRequestOption
SetAcctRequestFlag sets the AcctRequestFlag.
func SetAcctRequestMethod ¶
func SetAcctRequestMethod(v AuthenMethod) AcctRequestOption
SetAcctRequestMethod sets the AuthenMethod.
func SetAcctRequestPort ¶
func SetAcctRequestPort(v AuthenPort) AcctRequestOption
SetAcctRequestPort sets the AuthenPort.
func SetAcctRequestPrivLvl ¶
func SetAcctRequestPrivLvl(v PrivLvl) AcctRequestOption
SetAcctRequestPrivLvl sets the PrivLvl.
func SetAcctRequestRemAddr ¶
func SetAcctRequestRemAddr(v AuthenRemAddr) AcctRequestOption
SetAcctRequestRemAddr sets the AuthenRemAddr.
func SetAcctRequestService ¶
func SetAcctRequestService(v AuthenService) AcctRequestOption
SetAcctRequestService sets the AuthenService.
func SetAcctRequestType ¶
func SetAcctRequestType(v AuthenType) AcctRequestOption
SetAcctRequestType sets the AuthenType.
func SetAcctRequestUser ¶
func SetAcctRequestUser(v AuthenUser) AcctRequestOption
SetAcctRequestUser sets the AuthenUser.
type AcctServerMsg ¶
type AcctServerMsg string
AcctServerMsg is a string that may be presented to the user. The server_msg_len indicates the length of the server_msg field, in bytes. For details of text encoding, see "Treatment of Text Strings"
func (AcctServerMsg) Len ¶
func (t AcctServerMsg) Len() int
Len returns the length of AcctServerMsg.
func (AcctServerMsg) String ¶
func (t AcctServerMsg) String() string
String returns AcctServerMsg as a string.
func (AcctServerMsg) Validate ¶
func (t AcctServerMsg) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctStartTime ¶
type AcctStartTime int
AcctStartTime The time the action started (in seconds since the epoch).
func (AcctStartTime) Len ¶
func (t AcctStartTime) Len() int
Len returns the length of AcctStartTime.
func (AcctStartTime) String ¶
func (t AcctStartTime) String() string
String returns AcctStartTime as a string.
func (AcctStartTime) Validate ¶
func (t AcctStartTime) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctStopTime ¶
type AcctStopTime int
AcctStopTime The time the action stopped (in seconds since the epoch).
func (AcctStopTime) String ¶
func (t AcctStopTime) String() string
String returns AcctStopTime as a string.
func (AcctStopTime) Validate ¶
func (t AcctStopTime) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctTaskID ¶
type AcctTaskID string
AcctTaskID - Start and stop records for the same event MUST have matching task_id argument values. The client MUST ensure that active task_ids are not duplicated; a client MUST NOT reuse a task_id in a start record until it has sent a stop record for that task_id. Servers MUST NOT make assumptions about the format of a task_id.
func (AcctTaskID) String ¶
func (t AcctTaskID) String() string
String returns AcctTaskID as a string.
func (AcctTaskID) Validate ¶
func (t AcctTaskID) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AcctTimezone ¶
type AcctTimezone string
AcctTimezone The time zone abbreviation for all timestamps included in this packet
func (AcctTimezone) String ¶
func (t AcctTimezone) String() string
String returns AcctTimezone as a string.
func (AcctTimezone) Validate ¶
func (t AcctTimezone) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type Arg ¶
type Arg string
Arg per rfc, The arguments describe the specifics of the authorization that is being requested.
type Args ¶
type Args []Arg
Args is a helper type used when dealing with string args that have been converted to Arg types
func (Args) Args ¶
Args splits the Args into cmd, cmd-arg and other=arg the key is the left side of the delimiter, etc
func (Args) Command ¶
Command returns the cmd only if cmd=foo or cmd= or cmd*, etc is provided the delimiter is immaterial to this function returning a value the returned value will be a zero value if cmd is not present
func (Args) CommandArgs ¶
CommandArgs joins all cmd-arg args into a single string.
func (Args) CommandArgsNoLE ¶
CommandArgsNoLE joins all cmd-arg args into a single string and ignores line endings, specifically <cr>
func (Args) CommandSplit ¶
CommandSplit returns the attribute, separator and value of cmd= or cmd* or cmd=show or cmd*show. Zero values are returned if not found
type AuthenAction ¶
type AuthenAction uint8
AuthenAction indicates the authentication Action. Legal values are listed below.
const ( // AuthenActionLogin per rfc AuthenActionLogin AuthenAction = 0x01 // AuthenActionPass per rfc AuthenActionPass AuthenAction = 0x02 // AuthenActionSendAuth per rfc AuthenActionSendAuth AuthenAction = 0x04 )
func (AuthenAction) String ¶
func (t AuthenAction) String() string
String returns AuthenAction as a string.
func (AuthenAction) Validate ¶
func (t AuthenAction) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenContinue ¶
type AuthenContinue struct { Flags AuthenContinueFlag UserMessage AuthenUserMessage Data AuthenData }
AuthenContinue see https://datatracker.ietf.org/doc/html/rfc8907#section-5.3
func NewAuthenContinue ¶
func NewAuthenContinue(opts ...AuthenContinueOption) *AuthenContinue
NewAuthenContinue will create a new AuthenContinue based on the provided options
func (AuthenContinue) Fields ¶
func (a AuthenContinue) Fields() map[string]string
Fields returns fields from this packet compatible with a structured logger
func (AuthenContinue) Len ¶
func (a AuthenContinue) Len() int
Len will return the unmarshalled size of the component types
func (*AuthenContinue) MarshalBinary ¶
func (a *AuthenContinue) MarshalBinary() ([]byte, error)
MarshalBinary encodes AuthenContinue to tacacs bytes
func (*AuthenContinue) UnmarshalBinary ¶
func (a *AuthenContinue) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes decrypted tacacs bytes to AuthenContinue
func (*AuthenContinue) Validate ¶
func (a *AuthenContinue) Validate() error
Validate all fields on this type
type AuthenContinueFlag ¶
type AuthenContinueFlag uint8
AuthenContinueFlag flags that modify the action to be taken.
const ( // AuthenContinueFlagAbort per rfc AuthenContinueFlagAbort AuthenContinueFlag = 0x01 )
func (*AuthenContinueFlag) Clear ¶
func (b *AuthenContinueFlag) Clear(f AuthenContinueFlag)
Clear AuthenContinueFlag's f bit.
func (*AuthenContinueFlag) Has ¶
func (b *AuthenContinueFlag) Has(f AuthenContinueFlag) bool
Has returns true when b has the f bit set.
func (*AuthenContinueFlag) Set ¶
func (b *AuthenContinueFlag) Set(f AuthenContinueFlag)
Set AuthenContinueFlag's f bit.
func (AuthenContinueFlag) String ¶
func (b AuthenContinueFlag) String() string
String to satisfy Fields interface
func (*AuthenContinueFlag) Toggle ¶
func (b *AuthenContinueFlag) Toggle(f AuthenContinueFlag)
Toggle AuthenContinueFlag's f bit.
type AuthenContinueOption ¶
type AuthenContinueOption func(*AuthenContinue)
AuthenContinueOption is used to inject options when creating new AuthenContinue types
func SetAuthenContinueData ¶
func SetAuthenContinueData(v AuthenData) AuthenContinueOption
SetAuthenContinueData sets AuthenData
func SetAuthenContinueFlag ¶
func SetAuthenContinueFlag(v AuthenContinueFlag) AuthenContinueOption
SetAuthenContinueFlag sets AuthenContinueFlag
func SetAuthenContinueUserMessage ¶
func SetAuthenContinueUserMessage(v AuthenUserMessage) AuthenContinueOption
SetAuthenContinueUserMessage sets AuthenUserMessage
type AuthenData ¶
type AuthenData string
AuthenData - This field carries information that is specific to the action and the authen_type for this session. Valid uses of this field are described below. The data_len indicates the length of the data field, in bytes.
func (AuthenData) Validate ¶
func (t AuthenData) Validate(condition interface{}) error
Validate length of value
type AuthenMethod ¶
type AuthenMethod uint8
AuthenMethod per rfc and terribly named. Should read AuthorMethod, but rfc defines it as authen_method.
const ( // AuthenMethodNotSet per rfc AuthenMethodNotSet AuthenMethod = 0x0 // AuthenMethodNone per rfc AuthenMethodNone AuthenMethod = 0x01 // AuthenMethodKrb5 per rfc AuthenMethodKrb5 AuthenMethod = 0x02 // AuthenMethodLine per rfc AuthenMethodLine AuthenMethod = 0x03 // AuthenMethodEnable per rfc AuthenMethodEnable AuthenMethod = 0x04 // AuthenMethodLocal per rfc AuthenMethodLocal AuthenMethod = 0x05 // AuthenMethodTacacsPlus per rfc AuthenMethodTacacsPlus AuthenMethod = 0x06 // AuthenMethodGuest per rfc AuthenMethodGuest AuthenMethod = 0x08 // AuthenMethodRadius per rfc AuthenMethodRadius AuthenMethod = 0x10 )
func (AuthenMethod) String ¶
func (t AuthenMethod) String() string
String returns AuthenMethod as a string.
func (AuthenMethod) Validate ¶
func (t AuthenMethod) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenPort ¶
type AuthenPort string
AuthenPort see packet type for use information.
func (AuthenPort) String ¶
func (t AuthenPort) String() string
String returns AuthenPort as a string.
func (AuthenPort) Validate ¶
func (t AuthenPort) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenRemAddr ¶
type AuthenRemAddr string
AuthenRemAddr see packet type for use information.
func (AuthenRemAddr) Len ¶
func (t AuthenRemAddr) Len() int
Len returns the length of AuthenRemAddr.
func (AuthenRemAddr) String ¶
func (t AuthenRemAddr) String() string
String returns AuthenRemAddr as a string.
func (AuthenRemAddr) Validate ¶
func (t AuthenRemAddr) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenReply ¶
type AuthenReply struct { Status AuthenStatus Flags AuthenReplyFlag ServerMsg AuthenServerMsg Data AuthenData }
AuthenReply https://datatracker.ietf.org/doc/html/rfc8907#section-5.2
func NewAuthenReply ¶
func NewAuthenReply(opts ...AuthenReplyOption) *AuthenReply
NewAuthenReply will create a new AuthenReply based on the provided options
func (AuthenReply) Fields ¶
func (a AuthenReply) Fields() map[string]string
Fields returns fields from this packet compatible with a structured logger
func (AuthenReply) Len ¶
func (a AuthenReply) Len() int
Len will return the unmarshalled size of the component types
func (*AuthenReply) MarshalBinary ¶
func (a *AuthenReply) MarshalBinary() ([]byte, error)
MarshalBinary encodes AuthenReply to tacacs bytes
func (*AuthenReply) UnmarshalBinary ¶
func (a *AuthenReply) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes decrypted tacacs bytes to AuthenReply
func (*AuthenReply) Validate ¶
func (a *AuthenReply) Validate() error
Validate all fields on this type
type AuthenReplyFlag ¶
type AuthenReplyFlag uint8
AuthenReplyFlag flags that modify the action to be taken.
const ( // AuthenReplyFlagNoEcho per rfc AuthenReplyFlagNoEcho AuthenReplyFlag = 0x01 )
func (*AuthenReplyFlag) Clear ¶
func (b *AuthenReplyFlag) Clear(f AuthenReplyFlag)
Clear AuthenReplyFlag's f bit.
func (*AuthenReplyFlag) Has ¶
func (b *AuthenReplyFlag) Has(f AuthenReplyFlag) bool
Has returns true when b has the f bit set.
func (*AuthenReplyFlag) Set ¶
func (b *AuthenReplyFlag) Set(f AuthenReplyFlag)
Set AuthenReplyFlag's f bit.
func (AuthenReplyFlag) String ¶
func (b AuthenReplyFlag) String() string
String to satisfy Fields interface
func (*AuthenReplyFlag) Toggle ¶
func (b *AuthenReplyFlag) Toggle(f AuthenReplyFlag)
Toggle AuthenReplyFlag's f bit.
type AuthenReplyOption ¶
type AuthenReplyOption func(*AuthenReply)
AuthenReplyOption is used to inject options when creating new AuthenReply types
func SetAuthenReplyData ¶
func SetAuthenReplyData(v AuthenData) AuthenReplyOption
SetAuthenReplyData sets an AuthenData
func SetAuthenReplyFlag ¶
func SetAuthenReplyFlag(v AuthenReplyFlag) AuthenReplyOption
SetAuthenReplyFlag sets an AuthenReplyFlag
func SetAuthenReplyServerMsg ¶
func SetAuthenReplyServerMsg(v string) AuthenReplyOption
SetAuthenReplyServerMsg sets an AuthenServerMsg
func SetAuthenReplyStatus ¶
func SetAuthenReplyStatus(v AuthenStatus) AuthenReplyOption
SetAuthenReplyStatus sets an AuthenStatus
type AuthenServerMsg ¶
type AuthenServerMsg string
AuthenServerMsg see packet type for use information.
func (AuthenServerMsg) Len ¶
func (t AuthenServerMsg) Len() int
Len returns the length of AuthenServerMsg.
func (AuthenServerMsg) String ¶
func (t AuthenServerMsg) String() string
String returns AuthenServerMsg as a string.
func (AuthenServerMsg) Validate ¶
func (t AuthenServerMsg) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenService ¶
type AuthenService uint8
AuthenService is the service that is requesting the authentication.
const ( // AuthenServiceNone is intended for the authorization application of this field // that indicates that no authentication was performed by the device. AuthenServiceNone AuthenService = 0x00 // AuthenServiceLogin indicates regular login (as opposed to ENABLE) to a client device. AuthenServiceLogin AuthenService = 0x01 // AuthenServiceEnable identifies the ENABLE AuthenService, which refers to a service // requesting authentication in order to grant the User different privileges. This // is comparable to the Unix "su(1)" command, which substitutes the current User's // identity with another. An AuthenService value of AuthenServiceNone is only to be // used when none of the other AuthenService values are appropriate. AuthenServiceEnable AuthenService = 0x02 // AuthenServicePPP per rfc AuthenServicePPP AuthenService = 0x03 // AuthenServiceARAP per rfc AuthenServiceARAP AuthenService = 0x04 // AuthenServicePT per rfc AuthenServicePT AuthenService = 0x05 // AuthenServiceRCMD per rfc AuthenServiceRCMD AuthenService = 0x06 // AuthenServiceX25 per rfc AuthenServiceX25 AuthenService = 0x07 // AuthenServiceNASI per rfc AuthenServiceNASI AuthenService = 0x08 // AuthenServiceFwProxy per rfc AuthenServiceFwProxy AuthenService = 0x09 )
func (AuthenService) Len ¶
func (t AuthenService) Len() int
Len returns the length of AuthenService.
func (AuthenService) String ¶
func (t AuthenService) String() string
String returns AuthenService as a string.
func (AuthenService) Validate ¶
func (t AuthenService) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenStart ¶
type AuthenStart struct { Action AuthenAction PrivLvl PrivLvl Type AuthenType Service AuthenService User AuthenUser Port AuthenPort RemAddr AuthenRemAddr Data AuthenData }
AuthenStart https://datatracker.ietf.org/doc/html/rfc8907#section-5.1
func NewAuthenStart ¶
func NewAuthenStart(opts ...AuthenStartOption) *AuthenStart
NewAuthenStart will create a new AuthenStart based on the provided options
func (AuthenStart) Fields ¶
func (a AuthenStart) Fields() map[string]string
Fields returns fields from this packet compatible with a structured logger
func (AuthenStart) Len ¶
func (a AuthenStart) Len() int
Len will return the unmarshalled size of the component types
func (*AuthenStart) MarshalBinary ¶
func (a *AuthenStart) MarshalBinary() ([]byte, error)
MarshalBinary encodes AuthenStart to tacacs bytes
func (*AuthenStart) UnmarshalBinary ¶
func (a *AuthenStart) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes decrypted tacacs bytes to AuthenStart
func (*AuthenStart) Validate ¶
func (a *AuthenStart) Validate() error
Validate all fields on this type
type AuthenStartOption ¶
type AuthenStartOption func(*AuthenStart)
AuthenStartOption is used to inject options when creating new AuthenStart types
func SetAuthenStartAction ¶
func SetAuthenStartAction(v AuthenAction) AuthenStartOption
SetAuthenStartAction sets indicated authentication action
func SetAuthenStartData ¶
func SetAuthenStartData(v AuthenData) AuthenStartOption
SetAuthenStartData sets the authentication data
func SetAuthenStartPort ¶
func SetAuthenStartPort(v AuthenPort) AuthenStartOption
SetAuthenStartPort sets the calling port
func SetAuthenStartPrivLvl ¶
func SetAuthenStartPrivLvl(v PrivLvl) AuthenStartOption
SetAuthenStartPrivLvl sets the indicated authentication priv level
func SetAuthenStartRemAddr ¶
func SetAuthenStartRemAddr(v AuthenRemAddr) AuthenStartOption
SetAuthenStartRemAddr sets the remote address
func SetAuthenStartService ¶
func SetAuthenStartService(v AuthenService) AuthenStartOption
SetAuthenStartService sets the indicated authentication service
func SetAuthenStartType ¶
func SetAuthenStartType(v AuthenType) AuthenStartOption
SetAuthenStartType sets the indicated authentication type
func SetAuthenStartUser ¶
func SetAuthenStartUser(v AuthenUser) AuthenStartOption
SetAuthenStartUser sets the indicated user
type AuthenStatus ¶
type AuthenStatus uint8
AuthenStatus is the current status of the authentication.
const ( // AuthenStatusPass per rfc AuthenStatusPass AuthenStatus = 0x01 // AuthenStatusFail per rfc AuthenStatusFail AuthenStatus = 0x02 // AuthenStatusGetData per rfc AuthenStatusGetData AuthenStatus = 0x03 // AuthenStatusGetUser per rfc AuthenStatusGetUser AuthenStatus = 0x04 // AuthenStatusGetPass per rfc AuthenStatusGetPass AuthenStatus = 0x05 // AuthenStatusRestart per rfc AuthenStatusRestart AuthenStatus = 0x06 // AuthenStatusError per rfc AuthenStatusError AuthenStatus = 0x07 )
func (AuthenStatus) String ¶
func (t AuthenStatus) String() string
String returns AuthenStatus as a string.
func (AuthenStatus) Validate ¶
func (t AuthenStatus) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenType ¶
type AuthenType uint8
AuthenType is the type of authentication.
const ( // AuthenTypeNotSet only valid for Authorization/Accounting Requests (https://datatracker.ietf.org/doc/html/rfc8907#section-6.1) AuthenTypeNotSet AuthenType = 0x00 // AuthenTypeASCII per rfc AuthenTypeASCII AuthenType = 0x01 // AuthenTypePAP per rfc AuthenTypePAP AuthenType = 0x02 // AuthenTypeCHAP per rfc AuthenTypeCHAP AuthenType = 0x03 // AuthenTypeARAP per rfc AuthenTypeARAP AuthenType = 0x04 // AuthenTypeMSCHAP per rfc AuthenTypeMSCHAP AuthenType = 0x05 // AuthenTypeMSCHAPV2 per rfc AuthenTypeMSCHAPV2 AuthenType = 0x06 )
func (AuthenType) String ¶
func (t AuthenType) String() string
String returns AuthenType as a string.
func (AuthenType) Validate ¶
func (t AuthenType) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage. Validate characterics of type based on rfc and usage.
type AuthenUser ¶
type AuthenUser string
AuthenUser see packet type for use information.
func (AuthenUser) String ¶
func (t AuthenUser) String() string
String returns AuthenUser as a string.
func (AuthenUser) Validate ¶
func (t AuthenUser) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthenUserMessage ¶
type AuthenUserMessage string
AuthenUserMessage - this field is the string that the user entered, or the client provided on behalf of the user, in response to the server_msg from a REPLY packet. The user_len indicates the length of the user field, in bytes.
func (AuthenUserMessage) Len ¶
func (t AuthenUserMessage) Len() int
Len returns the length of AuthenUserMessage.
func (AuthenUserMessage) String ¶
func (t AuthenUserMessage) String() string
String maps AuthenUserMessage to string.
func (AuthenUserMessage) Validate ¶
func (t AuthenUserMessage) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorACL ¶
type AuthorACL int
AuthorACL A number representing a connection access list. Applicable only to session-based shell authorization. For details of text encoding, see "Treatment of Text Strings" (Section 3.7). https://datatracker.ietf.org/doc/html/rfc8907#section-8.2 https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
type AuthorAddr ¶
AuthorAddr A network address. https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
func (AuthorAddr) String ¶
func (t AuthorAddr) String() string
String returns AuthorAddr as a string.
func (AuthorAddr) Validate ¶
func (t AuthorAddr) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorAddrPool ¶
type AuthorAddrPool string
AuthorAddrPool The identifier of an address pool from which the client can assign an address. https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
func (AuthorAddrPool) Len ¶
func (t AuthorAddrPool) Len() int
Len returns the length of AuthorAddrPool.
func (AuthorAddrPool) String ¶
func (t AuthorAddrPool) String() string
String returns AuthorAddrPool as a string.
func (AuthorAddrPool) Validate ¶
func (t AuthorAddrPool) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorAutoCmd ¶
type AuthorAutoCmd string
AuthorAutoCmd An auto-command to run. Applicable only to session-based shell authorization. https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
func (AuthorAutoCmd) Len ¶
func (t AuthorAutoCmd) Len() int
Len returns the length of AuthorAutoCmd.
func (AuthorAutoCmd) String ¶
func (t AuthorAutoCmd) String() string
String returns AuthorAutoCmd as a string.
func (AuthorAutoCmd) Validate ¶
func (t AuthorAutoCmd) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorCmd ¶
type AuthorCmd string
AuthorCmd A shell (exec) command. This indicates the command name of the command that is to be run. The "cmd" argument MUST be specified if service equals "shell".
Authorization of shell commands is a common use case for the TACACS+ protocol. Command Authorization generally takes one of two forms: session based or command based.
For session-based shell authorization, the "cmd" argument will have an empty value. The client determines which commands are allowed in a session according to the arguments present in the authorization.
In command-based authorization, the client requests that the server determine whether a command is allowed by making an authorization request for each command. The "cmd" argument will have the command name as its value. https://datatracker.ietf.org/doc/html/rfc8907#section-8.2
type AuthorCmdArg ¶
type AuthorCmdArg string
AuthorCmdArg An argument to a shell (exec) command. This indicates an argument for the shell command that is to be run. Multiple cmd-arg arguments may be specified, and they are order dependent. https://datatracker.ietf.org/doc/html/rfc8907#section-8.2
func (AuthorCmdArg) String ¶
func (t AuthorCmdArg) String() string
String returns AuthorCmdArg as a string.
func (AuthorCmdArg) Validate ¶
func (t AuthorCmdArg) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorData ¶
type AuthorData string
AuthorData is a printable US-ASCII string that may be presented on an administrative display, console or log. The decision to present this message is client specific.
func (AuthorData) String ¶
func (t AuthorData) String() string
String returns AuthorData as a string.
func (AuthorData) Validate ¶
func (t AuthorData) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorIdleTime ¶
type AuthorIdleTime int
AuthorIdleTime An idle-timeout for the connection (in minutes). A value of zero indicates no timeout. https://datatracker.ietf.org/doc/html/rfc8907#section-8.2
func (AuthorIdleTime) Len ¶
func (t AuthorIdleTime) Len() int
Len returns the length of AuthorIdleTime.
func (AuthorIdleTime) String ¶
func (t AuthorIdleTime) String() string
String returns AuthorIdleTime as a string.
func (AuthorIdleTime) Validate ¶
func (t AuthorIdleTime) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorInACL ¶
type AuthorInACL string
AuthorInACL The identifier (name) of an interface input access list. For details of text encoding, see "Treatment of Text Strings" (Section 3.7). https://datatracker.ietf.org/doc/html/rfc8907#section-8.2 https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
func (AuthorInACL) String ¶
func (t AuthorInACL) String() string
String returns AuthorInACL as a string.
func (AuthorInACL) Validate ¶
func (t AuthorInACL) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorNoEscape ¶
type AuthorNoEscape bool
AuthorNoEscape Prevents the user from using an escape character. Applicable only to session-based shell authorization. https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
func (AuthorNoEscape) Len ¶
func (t AuthorNoEscape) Len() int
Len returns the length of AuthorNoEscape.
func (AuthorNoEscape) String ¶
func (t AuthorNoEscape) String() string
String returns AuthorNoEscape as a string.
func (AuthorNoEscape) Validate ¶
func (t AuthorNoEscape) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorNoHangup ¶
type AuthorNoHangup bool
AuthorNoHangup Do not disconnect after an automatic command. Applicable only to session-based shell authorization. https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
func (AuthorNoHangup) Len ¶
func (t AuthorNoHangup) Len() int
Len returns the length of AuthorNoHangup.
func (AuthorNoHangup) String ¶
func (t AuthorNoHangup) String() string
String returns AuthorNoHangup as a string.
func (AuthorNoHangup) Validate ¶
func (t AuthorNoHangup) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorOutACL ¶
type AuthorOutACL string
AuthorOutACL The identifier (name) of an interface output access list. For details of text encoding, see "Treatment of Text Strings" (Section 3.7). https://datatracker.ietf.org/doc/html/rfc8907#section-8.2 https://datatracker.ietf.org/doc/html/rfc8907#section-3.7
func (AuthorOutACL) String ¶
func (t AuthorOutACL) String() string
String returns AuthorOutACL as a string.
func (AuthorOutACL) Validate ¶
func (t AuthorOutACL) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorProtocol ¶
type AuthorProtocol string
AuthorProtocol A field that may be used to indicate a subset of a service. https://datatracker.ietf.org/doc/html/rfc8907#section-8.2
func (AuthorProtocol) Len ¶
func (t AuthorProtocol) Len() int
Len returns the length of AuthorProtocol.
func (AuthorProtocol) String ¶
func (t AuthorProtocol) String() string
String returns AuthorProtocol as a string.
func (AuthorProtocol) Validate ¶
func (t AuthorProtocol) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorReply ¶
type AuthorReply struct { Status AuthorStatus Args Args ServerMsg AuthorServerMsg Data AuthorData }
AuthorReply https://datatracker.ietf.org/doc/html/rfc8907#section-6.2
func NewAuthorReply ¶
func NewAuthorReply(opts ...AuthorReplyOption) *AuthorReply
NewAuthorReply will create a new AuthorReply based on the provided options
func NewAuthorReplyFromBytes ¶
func NewAuthorReplyFromBytes(data []byte) (*AuthorReply, error)
NewAuthorReplyFromBytes decodes decrypted tacacs bytes into AuthorReply
func (AuthorReply) Fields ¶
func (a AuthorReply) Fields() map[string]string
Fields returns fields from this packet compatible with a structured logger
func (AuthorReply) Len ¶
func (a AuthorReply) Len() int
Len will return the unmarshalled size of the component types
func (*AuthorReply) MarshalBinary ¶
func (a *AuthorReply) MarshalBinary() ([]byte, error)
MarshalBinary encodes AuthorReply into tacacs bytes
func (*AuthorReply) UnmarshalBinary ¶
func (a *AuthorReply) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes decrypted tacacs bytes into AuthorReply
func (*AuthorReply) Validate ¶
func (a *AuthorReply) Validate() error
Validate all fields on this type
type AuthorReplyOption ¶
type AuthorReplyOption func(*AuthorReply)
AuthorReplyOption is used to inject options when creating new AuthorRequest types
func SetAuthorReplyArgs ¶
func SetAuthorReplyArgs(args ...string) AuthorReplyOption
SetAuthorReplyArgs sets the Args.
func SetAuthorReplyData ¶
func SetAuthorReplyData(v AuthorData) AuthorReplyOption
SetAuthorReplyData sets the AuthorData.
func SetAuthorReplyServerMsg ¶
func SetAuthorReplyServerMsg(v string) AuthorReplyOption
SetAuthorReplyServerMsg sets the AuthorServerMsg.
func SetAuthorReplyStatus ¶
func SetAuthorReplyStatus(v AuthorStatus) AuthorReplyOption
SetAuthorReplyStatus sets the AuthorStatus.
type AuthorRequest ¶
type AuthorRequest struct { Method AuthenMethod PrivLvl PrivLvl Type AuthenType Service AuthenService User AuthenUser Port AuthenPort RemAddr AuthenRemAddr Args Args }
AuthorRequest https://datatracker.ietf.org/doc/html/rfc8907#section-6.1
func NewAuthorRequest ¶
func NewAuthorRequest(opts ...AuthorRequestOption) *AuthorRequest
NewAuthorRequest will create a new AuthorRequest based on the provided options
func (AuthorRequest) Fields ¶
func (a AuthorRequest) Fields() map[string]string
Fields returns fields from this packet compatible with a structured logger
func (AuthorRequest) Len ¶
func (a AuthorRequest) Len() int
Len will return the unmarshalled size of the component types
func (*AuthorRequest) MarshalBinary ¶
func (a *AuthorRequest) MarshalBinary() ([]byte, error)
MarshalBinary encodes AuthroRequest into tacacs bytes
func (*AuthorRequest) UnmarshalBinary ¶
func (a *AuthorRequest) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes decrypted tacacs bytes into AuthorRequest
func (*AuthorRequest) Validate ¶
func (a *AuthorRequest) Validate() error
Validate all fields on this type
type AuthorRequestOption ¶
type AuthorRequestOption func(*AuthorRequest)
AuthorRequestOption is used to inject options when creating new AuthorRequest types
func SetAuthorRequestArgs ¶
func SetAuthorRequestArgs(v Args) AuthorRequestOption
SetAuthorRequestArgs sets the Args.
func SetAuthorRequestMethod ¶
func SetAuthorRequestMethod(v AuthenMethod) AuthorRequestOption
SetAuthorRequestMethod sets the AuthenMethod.
func SetAuthorRequestPort ¶
func SetAuthorRequestPort(v AuthenPort) AuthorRequestOption
SetAuthorRequestPort sets the AuthenPort.
func SetAuthorRequestPrivLvl ¶
func SetAuthorRequestPrivLvl(v PrivLvl) AuthorRequestOption
SetAuthorRequestPrivLvl sets the PrivLvl
func SetAuthorRequestRemAddr ¶
func SetAuthorRequestRemAddr(v AuthenRemAddr) AuthorRequestOption
SetAuthorRequestRemAddr sets the AuthenRemAddr.
func SetAuthorRequestService ¶
func SetAuthorRequestService(v AuthenService) AuthorRequestOption
SetAuthorRequestService sets the AuthenService.
func SetAuthorRequestType ¶
func SetAuthorRequestType(v AuthenType) AuthorRequestOption
SetAuthorRequestType sets the AuthenType.
func SetAuthorRequestUser ¶
func SetAuthorRequestUser(v AuthenUser) AuthorRequestOption
SetAuthorRequestUser sets the AuthenUser.
type AuthorServerMsg ¶
type AuthorServerMsg string
AuthorServerMsg a printable US-ASCII string that may be presented to theuser.
func (AuthorServerMsg) Len ¶
func (t AuthorServerMsg) Len() int
Len returns the length of AuthorServerMsg.
func (AuthorServerMsg) String ¶
func (t AuthorServerMsg) String() string
String returns AuthorServerMsg as a string.
func (AuthorServerMsg) Validate ¶
func (t AuthorServerMsg) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorService ¶
type AuthorService string
AuthorService the primary service. Specifying a service argument indicates that this is a request for authorization or accounting of that service. For example: "shell", "tty-server", "connection", "system" and "firewall"; others may be chosen for the required application. This argument MUST always be included. https://datatracker.ietf.org/doc/html/rfc8907#section-8.2
func (AuthorService) Len ¶
func (t AuthorService) Len() int
Len returns the length of AuthorService.
func (AuthorService) String ¶
func (t AuthorService) String() string
String returns AuthorService as a string.
func (AuthorService) Validate ¶
func (t AuthorService) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorStatus ¶
type AuthorStatus uint8
AuthorStatus indicates the authorization status https://datatracker.ietf.org/doc/html/rfc8907#section-6.2
const ( // AuthorStatusPassAdd per rfc AuthorStatusPassAdd AuthorStatus = 0x01 // AuthorStatusPassRepl per rfc AuthorStatusPassRepl AuthorStatus = 0x02 // AuthorStatusFail per rfc AuthorStatusFail AuthorStatus = 0x10 // AuthorStatusError per rfc AuthorStatusError AuthorStatus = 0x11 )
func (AuthorStatus) String ¶
func (t AuthorStatus) String() string
String returns AuthorStatus as a string.
func (AuthorStatus) Validate ¶
func (t AuthorStatus) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type AuthorTimeout ¶
type AuthorTimeout int
AuthorTimeout An absolute timer for the connection (in minutes). A value of zero indicates no timeout. https://datatracker.ietf.org/doc/html/rfc8907#section-8.2
func (AuthorTimeout) Len ¶
func (t AuthorTimeout) Len() int
Len returns the length of AuthorTimeout.
func (AuthorTimeout) String ¶
func (t AuthorTimeout) String() string
String returns AuthorTimeout as a string.
func (AuthorTimeout) Validate ¶
func (t AuthorTimeout) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type BadSecretErr ¶
type BadSecretErr struct {
// contains filtered or unexported fields
}
BadSecretErr ...
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client base client implementation for server/client communication
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient creates a new client
type ClientOption ¶
ClientOption is a setter type for Client
func SetClientDialer ¶
func SetClientDialer(network, address string, secret []byte) ClientOption
SetClientDialer see net.ResolveTCPAddr for details, this follows the same input requirements for network and address. It will then use net.DialTCP with a nil source addr and a constructed TCPAddr from the provided network and address. A secret for the connection must also be provided.
func SetClientDialerWithLocalAddr ¶
func SetClientDialerWithLocalAddr(network, raddr, laddr string, secret []byte) ClientOption
SetClientDialerWithLocalAddr see net.ResolveTCPAddr for details, this follows the same input requirements for network and address. raddr is the destination tcp address to dial to, and laddr is the client address to dial from, if set to an empty string, then the function will fall back to DialTCP's default selection of a local interface with a nil source addr and a constructed TCPAddr from the provided network and address. A secret for the connection must also be provided.
type ClientSequenceNumber ¶
type ClientSequenceNumber uint8
ClientSequenceNumber is used when we want to consider sequences that the client sends and validate that they are allowed
func (ClientSequenceNumber) Validate ¶
func (t ClientSequenceNumber) Validate(condition interface{}) error
Validate ensures we don't have even sequence numbers from clients
type ContextKey ¶
type ContextKey string
ContextKey is used in Request contexts
const ContextAcctType ContextKey = "type"
ContextAcctType ...
const ContextConnLocalAddr ContextKey = "conn-local-addr"
ContextConnLocalAddr is the tacquito server address
const ContextConnRemoteAddr ContextKey = "conn-remote-addr"
ContextConnRemoteAddr is used to store the net.conn remoteAddr within a session. This value would be present in any sub contexts that share the underlying net.conn
const ContextFlags ContextKey = "flags"
ContextFlags logs the flags attribute of Accounting requests
const ContextLoaderDuration ContextKey = "loader_duration_ms"
ContextLoaderDuration is total processing time taken by loader i.e how long it takes for the loader to map an IP to a scope
const ContextPort ContextKey = "port"
ContextPort ...
const ContextPrivLvl ContextKey = "priv-lvl"
ContextPrivLvl ...
const ContextRemoteAddr ContextKey = "rem-addr"
ContextRemoteAddr ...
const ContextReqArgs ContextKey = "req-args"
ContextReqArgs for logging context arguments with replies
const ContextReqID ContextKey = "reqID"
ContextReqID ...
const ContextSessionID ContextKey = "session-id"
ContextSessionID is used to store the context for a session in Request as a wrapped context
const ContextUser ContextKey = "user"
ContextUser is used to store the username within a session.
const ContextUserMsg ContextKey = "user-msg"
ContextUserMsg ...
type DeadlineListener ¶
DeadlineListener is a net.Listener that supports Deadlines
type EncoderDecoder ¶
type EncoderDecoder interface { MarshalBinary() ([]byte, error) UnmarshalBinary(data []byte) error Fields() map[string]string }
EncoderDecoder will encode or decode from wire format, any of the tacacs packet types
type Field ¶
type Field interface { // Validate is executed on all MarshalBinary and UnmarshalBinary operations on // Authenticate, Authorize and Accounting Packet types Validate(condition interface{}) error // Len of Field value Len() int // String representation for printing. Obscure operations also happen here String() string }
Field is a tacacs field interface used across all three AAA types.
type HandlerFunc ¶
HandlerFunc is an adapter that allows higher order functions to be used as Handler interfaces
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(response Response, request Request)
Handle satisfies the Handler interface
type Header ¶
type Header struct { Version Version Type HeaderType SeqNo SequenceNumber SessionID SessionID Flags HeaderFlag Length uint32 }
Header holds the tacacs header fields found in all tacacs packet types.
func NewHeader ¶
func NewHeader(opts ...HeaderOption) *Header
NewHeader will create a new Header based on the provided options, starting with common defaults. the defaults will be overwritten, if provided in the options
func (*Header) MarshalBinary ¶
MarshalBinary encodes Header into tacacs bytes
func (*Header) UnmarshalBinary ¶
UnmarshalBinary decodes tacacs bytes into Header
type HeaderFlag ¶
type HeaderFlag uint8
HeaderFlag set obfuscation and connect options.
const ( // UnencryptedFlag indicates that the sender did not obfuscate the body of the packet. // Normal tacacs pacekts have this set to 0x0. UnencryptedFlag HeaderFlag = 0x01 // SingleConnect is used to allow a client and server to negotiate single connection mode SingleConnect HeaderFlag = 0x04 )
func (*HeaderFlag) Has ¶
func (b *HeaderFlag) Has(f HeaderFlag) bool
Has returns true when b has the f bit set.
type HeaderOption ¶
type HeaderOption func(*Header)
HeaderOption used to modify existing headers that were decoded and reuse them in a response, or to create a new Header with options
func SetHeaderFlag ¶
func SetHeaderFlag(v HeaderFlag) HeaderOption
SetHeaderFlag sets HeaderFlag to a specific value This field contains various bitmapped flags.
func SetHeaderLen ¶
func SetHeaderLen(v int) HeaderOption
SetHeaderLen sets the length of the header. This is automatically done for you but if you wish to set a length explictly for tests...
func SetHeaderRandomSessionID ¶
func SetHeaderRandomSessionID() HeaderOption
SetHeaderRandomSessionID sets a weaker math/rand session id. To meet the requirements of the rfc, you should use SetHeaderSessionID with a cryptographically strong random number. this setter should only be used in examples and tests
func SetHeaderSeqNo ¶
func SetHeaderSeqNo(v int) HeaderOption
SetHeaderSeqNo sets SequenceNumber to a specific value
func SetHeaderSessionID ¶
func SetHeaderSessionID(v SessionID) HeaderOption
SetHeaderSessionID sets SessionID to a specific value. This number MUST be generated by a cryptographically strong random number generation method.
type HeaderType ¶
type HeaderType uint8
HeaderType indicates the type of tacacs packet contained in the bytes that follow.
const ( // Authenticate per rfc Authenticate HeaderType = 0x01 // Authorize per rfc Authorize HeaderType = 0x02 // Accounting per rfc Accounting HeaderType = 0x03 )
func (HeaderType) String ¶
func (t HeaderType) String() string
String returns HeaderType as a string.
func (HeaderType) Validate ¶
func (t HeaderType) Validate(condition interface{}) error
Validate characterics of type based on rfc and usage.
type LastSequence ¶
type LastSequence uint8
LastSequence is used to compare the previous sequence nubmber with the current sequence number and validate it
func (LastSequence) Validate ¶
func (t LastSequence) Validate(condition interface{}) error
Validate ensures we have a sane progression of sequence numbers in a packet exchange
type Option ¶
type Option func(s *Server)
Option is used to set optional behaviors on the server. Required behaviors are set in NewServer. Omitting options will not adversely affect the service
func SetUseProxy ¶
SetUseProxy will enable ASCII based proxy support defined by http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
type Packet ¶
type Packet struct { // Header is a well known structure, so it's always populated. it's also the only // part of a tacacs message that isn't crypted, so it can be freely read. Header *Header // Body may be crypted or uncrypted bytes of the body, length indicated in the header.Length Body []byte }
Packet is used as a request and response packet. Header is the decoded header fields from the tacacs packet RawBody may be obfuscated or deobfuscated, depending on where the packet is in the req/resp flow Body will always be a decoded type, eg AuthenStart, AuthenReply, AcctRequest, etc.
func NewPacket ¶
func NewPacket(opts ...PacketOption) *Packet
NewPacket will create a new Packet based on the provided options.
func (*Packet) MarshalBinary ¶
MarshalBinary encodes Packet into tacacs bytes. It is unaware of crypt. RawBody must have valid values
func (*Packet) UnmarshalBinary ¶
UnmarshalBinary decodes Packet into tacacs bytes. It is unaware of crypt.
type PacketOption ¶
type PacketOption func(*Packet)
PacketOption is used to inject options when creating new Packet types
func SetPacketBody ¶
func SetPacketBody(v []byte) PacketOption
SetPacketBody sets the body of packet
func SetPacketBodyUnsafe ¶
func SetPacketBodyUnsafe(v EncoderDecoder) PacketOption
SetPacketBodyUnsafe sets the body of packet by calling MarshalBinary on v. errors trigger a panic. this setter is ONLY meant for testing scenarios if you use this in production handler code you're asking for panics to kill your service.
type PrivLvl ¶
type PrivLvl uint8
PrivLvl indicates the privilege level that the User is authenticating as. Please refer to https://datatracker.ietf.org/doc/html/rfc8907#section-9
type Response ¶
type Response interface { Reply(v EncoderDecoder) (int, error) ReplyWithContext(ctx context.Context, v EncoderDecoder, writers ...Writer) (int, error) Write(p *Packet) (int, error) Next(next Handler) RegisterWriter(Writer) // Context sets context of response to ctx Context(ctx context.Context) }
Response controls what we send back to the client. Calls to Write should be considered final on the packet back to the client. You may not call Exchange after Write.
type SecretProvider ¶
type SecretProvider interface {
Get(ctx context.Context, remote net.Addr) ([]byte, Handler, error)
}
SecretProvider is responsible for secret selection for incoming client connections It provides configuration items for the server to process any connections that originate on a given net.Conn. Only the RemoteAddr is provided to make this determination.
type SequenceNumber ¶
type SequenceNumber uint16
SequenceNumber is the sequence number of the current packet. The first packet in a session MUST have the sequence number 1 and each subsequent packet will increment the sequence number by one. Thus clients only send packets containing odd sequence numbers, and TACACS+ servers only send packets containing even sequence numbers.
The sequence number must never wrap i.e. if the sequence number 2^8-1 is ever reached, that session must terminate and be restarted with a sequence number of 1.
func (SequenceNumber) Inc ¶
func (t SequenceNumber) Inc() int
Inc will return the next seqno as an int
func (SequenceNumber) Len ¶
func (t SequenceNumber) Len() int
Len returns the length of SequenceNumber.
func (SequenceNumber) String ¶
func (t SequenceNumber) String() string
String returns SequenceNumber as a string.
func (SequenceNumber) Validate ¶
func (t SequenceNumber) Validate(condition interface{}) error
Validate Sequence Number.
type Server ¶
type Server struct { SecretProvider // contains filtered or unexported fields }
Server ...
func NewServer ¶
func NewServer(l loggerProvider, sp SecretProvider, opts ...Option) *Server
NewServer returns a new server. loggerProvider - the logging backend to use listener - net.Listener sp SecretProvider - enables server to translate net.conn.remaddr into associated config for that device
type SessionID ¶
type SessionID uint32
SessionID is the Id for a TACACS+ session. This field does not change for the duration of the TACACS+ session. This number MUST be generated by a cryptographically strong random number generation method.
func (*SessionID) MarshalBinary ¶
MarshalBinary just returns a uint32 in bytes, BigEndian byte order
func (*SessionID) UnmarshalBinary ¶
UnmarshalBinary populates data parameter with Uint32 in BigEndian byte order
type Version ¶
Version stores MajorVersion and MinorVersion in a single uint8. The upper 4 bits hold major, and the lower 4 bits hold minor. a uint8 is used to represent both at the struct level, but are bitshifted into a single uint8 during MarshalBinary and unshifted at UnmarshalBinary
func (*Version) MarshalBinary ¶
MarshalBinary encodes T into a wire format
func (*Version) UnmarshalBinary ¶
UnmarshalBinary decodes T from a wire format into struct values
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmds
|
|
client
Package main provides a basic tacacs test client for use with tacacs servers and tacquito
|
Package main provides a basic tacacs test client for use with tacacs servers and tacquito |
server/config
Package config provides an example implementation of the tacquito.ConfigProvider interface.
|
Package config provides an example implementation of the tacquito.ConfigProvider interface. |
server/config/accounters/local
Package local supports writing Accounting logs to the local system via a log.Logger
|
Package local supports writing Accounting logs to the local system via a log.Logger |
server/config/accounters/syslog
Package syslog supports ending Accounting data in JSON format to syslog Windows is unsupported
|
Package syslog supports ending Accounting data in JSON format to syslog Windows is unsupported |
server/config/authenticators
Package authenticators provides reusable functions for types interested in implementing custom authenticators
|
Package authenticators provides reusable functions for types interested in implementing custom authenticators |
server/config/authenticators/bcrypt
Package bcrypt implements a tqcquito Config interface.
|
Package bcrypt implements a tqcquito Config interface. |
server/config/authenticators/bcrypt/generator
Package main provides a utility to create or verify bcrypt strings used by the bcrypt authenticator
|
Package main provides a utility to create or verify bcrypt strings used by the bcrypt authenticator |
server/config/authorizers/stringy
Package stringy implements the only authorizer package available in tacquito.
|
Package stringy implements the only authorizer package available in tacquito. |
server/loader
Package loader provides an injectable config loading mechanism.
|
Package loader provides an injectable config loading mechanism. |
Package proxy provides a reader writer that can add PROXY ASCII strings to bytes or strip the PROXY ASCII strings from bytes.
|
Package proxy provides a reader writer that can add PROXY ASCII strings to bytes or strip the PROXY ASCII strings from bytes. |