lib

package
v0.0.0-...-1813842 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestTimeoutValue           = 5 //the timeout in seconds for ISE requests
	AccessLanguage                = "application/json"
	ContentType                   = "application/json"
	PxGridCreateClientEndPoint    = "pxgrid/control/AccountCreate"
	PxGridAccountActivateEndPoint = "pxgrid/control/AccountActivate"
	ServiceLookup                 = "pxgrid/control/ServiceLookup"
	ServiceLookupSessions         = "com.cisco.ise.session"
	AccessSecretEndpoint          = "pxgrid/control/AccessSecret"
	NoServiceAvailable            = "no service available"
	Enabled                       = "ENABLED"
	GetSessionEndpoint            = "getSessions"
	//FUID
	UserNtlmIdentityEndpoint = "user/ntlm-identity"
	UserEndpoint             = "user"
	FuidAllUsers             = "users"
	AUTHENTICATED            = "AUTHENTICATED"
	AUTHENTICATING           = "AUTHENTICATING"
	POSTURED                 = "POSTURED"
	DISCONNECTED             = "DISCONNECTED"
	ChangeTypeAdd            = "add"
	ChangeTypeModify         = "modify"
	ChangeTypeDelete         = "delete"
)

Variables

View Source
var (
	NotFound error = errors.New("User Not Found in FUID Database")
)

Functions

func ExtractServerCert

func ExtractServerCert(host string, port int) ([]byte, error)

func FixJson

func FixJson(data []byte, st interface{}) error

func GetEndpointUrl

func GetEndpointUrl(endpointName string) string

func GetSessionRestUrl

func GetSessionRestUrl(services []Services) (string, string, error)

GetSessionRestUrl extract the Session REST API URL from a service

func IsFileExist

func IsFileExist(filePath string) bool

func NewADConnector

func NewADConnector() (*ldap.Conn, error)

func ProcessSessions

func ProcessSessions(sessions *IseSessions, timeStampFilePath string, fuidController *FUIDController, displayProcess bool) error

ProcessSessions process list of session events

func SessionListener

func SessionListener(secret, restUrl, timeStampFilePath string, controller *Controller, fuidController *FUIDController, displayProcess bool) error

SessionListener listen to session events

func SetupCloseHandler

func SetupCloseHandler()

func ValidateUsernamePassword

func ValidateUsernamePassword() error

ValidateUsernamePassword ensure the yaml config file contains ISE Credentials

Types

type AccessSecretInput

type AccessSecretInput struct {
	PeerNodeName string `json:"peerNodeName"`
}

type AccessSecretOutput

type AccessSecretOutput struct {
	Secret string `json:"secret"`
}

func AccessSecret

func AccessSecret(peerNodeName string, controller *Controller) (*AccessSecretOutput, error)

AccessSecret return an access secret for a service provider

type AccountActivate

type AccountActivate struct {
	AccountState string `json:"accountState"`
	Version      string `json:"version"`
}

type AllUsers

type AllUsers struct {
	Users []FUIDUser `json:"users"`
}

type Attributes

type Attributes struct {
	Cn             string   `json:"cn"`
	MemberOf       []string `json:"memberOf"`
	ObjectGUID     string   `json:"objectGUID"`
	SAMAccountName string   `json:"sAMAccountName"`
}

type Config

type Config struct {
}

func NewConfig

func NewConfig() *Config

NewConfig create a new config file

func (*Config) GetTLSConfig

func (c *Config) GetTLSConfig() (*tls.Config, error)

GetTLSConfig generate TLS Config

type Controller

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

func GetController

func GetController() (*Controller, error)

func NewControl

func NewControl(config *Config) (*Controller, error)

NewControl create a new controller for ISE API

func (*Controller) GetTlsConfig

func (c *Controller) GetTlsConfig() *tls.Config

GetTlsConfig return the controller TLS config

func (*Controller) ReadSessions

func (c *Controller) ReadSessions(secret, url string, requestBody interface{}) (*http.Response, error)

ReadSessions Read session events from PxGrid

func (*Controller) SendRequest

func (c *Controller) SendRequest(url string, requestBody interface{}, requestMethod string, requireAuth bool) (*http.Response, error)

SendRequest Send request to ISE API

type CreateClient

type CreateClient struct {
	NodeName string `json:"nodeName"`
}

func (*CreateClient) AccountActivate

func (c *CreateClient) AccountActivate(controller *Controller) (*AccountActivate, error)

AccountActivate Activate ISE Client Account

func (*CreateClient) Create

func (c *CreateClient) Create(controller *Controller) (*ISEClient, error)

Create create a ISE Client Account

type FUIDController

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

func NewFUIDController

func NewFUIDController() (*FUIDController, error)

NewFUIDController Create a Controller for FUID API

func (*FUIDController) GetTLSConfig

func (f *FUIDController) GetTLSConfig() (*tls.Config, error)

GetTLSConfig Get TLS Config for FUID API

func (*FUIDController) GetUser

func (f *FUIDController) GetUser(userNTLMIdentity string) (*FUIDUser, error)

GetUser Search for a specific use in FUID Database

func (*FUIDController) PostUser

func (f *FUIDController) PostUser(userEntity *LdapElement, sess *Sessions, displayProcess bool) error

PostUser Create a user in FUID Database.

func (*FUIDController) PutUser

func (f *FUIDController) PutUser(user *FUIDUser, sess *Sessions, displayProcess bool) error

PutUser Update a user's IP addresses and Groups

func (*FUIDController) SendRequest

func (f *FUIDController) SendRequest(endPoint, parameters string, requestBody interface{}, requestMethod string) (*http.Response, error)

SendRequest send a request to FUID API

func (*FUIDController) UserManager

func (f *FUIDController) UserManager(sess *Sessions, displayProcess bool) error

UserManager manager a session, if your is not exists in FUID database, create it, otherwise update the user IP Addresses ang Groups

type FUIDUser

type FUIDUser struct {
	Dn             string   `json:"dn,omitempty"`
	ChangeType     string   `json:"changetype,omitempty"`
	SAMAccountName string   `json:"sAMAccountName,omitempty"`
	NTLMIdentity   string   `json:"NTLMIdentity,omitempty"`
	Mail           string   `json:"mail,omitempty"`
	Ipv4Addresses  []string `json:"ipv4_addresses,omitempty"`
	Ipv6Addresses  []string `json:"ipv6_addresses,omitempty"`
	ObjectGUID     string   `json:"objectGUID,omitempty"`
	Groups         []string `json:"groups,omitempty"`
	Timestamp      string   `json:"timestamp,omitempty"`
}

type ISEClient

type ISEClient struct {
	NodeName string `json:"nodeName"`
	Password string `json:"password"`
	UserName string `json:"userName"`
}

type IseSessions

type IseSessions struct {
	Sessions []Sessions `json:"sessions"`
}

type KeyValue

type KeyValue map[string]interface{}

type LdapElement

type LdapElement struct {
	DN         string `json:"DN"`
	Attributes Attributes
}

LdapElement holds the DN and Attributes of an LDAP/AD entry.

func GetLdapElement

func GetLdapElement(username string, ldapConnector *ldap.Conn) (*LdapElement, error)

func HandleElement

func HandleElement(element LdapEntity) (*LdapElement, error)

type LdapEntity

type LdapEntity struct {
	DN         string
	Attributes []KeyValue
}

type ReadSessionInput

type ReadSessionInput struct {
	StartTimestamp *time.Time `json:"startTimestamp"`
}

func GetLatestSessionTimeStamp

func GetLatestSessionTimeStamp(timeStampFilePAth string) (*ReadSessionInput, error)

GetLatestSessionTimeStamp get the timestamp for the latest processed session

type ServiceLookupInput

type ServiceLookupInput struct {
	Name string `json:"name"`
}

type ServiceLookupOutput

type ServiceLookupOutput struct {
	Services []Services `json:"services"`
}

func ServiceLookupRequest

func ServiceLookupRequest(serviceName string, controller *Controller) (*ServiceLookupOutput, error)

type ServiceProperties

type ServiceProperties struct {
	SessionTopic    string `json:"sessionTopic,omitempty"`
	GroupTopic      string `json:"groupTopic,omitempty"`
	WsPubSubService string `json:"wsPubsubService,omitempty"`
	RestBaseURL     string `json:"restBaseURL,omitempty"`
	RestBaseUrl     string `json:"restBaseUrl,omitempty"`
	WsUrl           string `json:"wsUrl"`
}

type Services

type Services struct {
	Name       string            `json:"name,omitempty"`
	NodeName   string            `json:"nodeName,omitempty"`
	Properties ServiceProperties `json:"properties,omitempty"`
}

type Sessions

type Sessions struct {
	Timestamp                *time.Time `json:"timestamp"`
	State                    string     `json:"state"`
	Username                 string     `json:"userName"`
	CallingStationId         string     `json:"callingStationId"`
	IpAddresses              []string   `json:"ipAddresses"`
	MacAddress               string     `json:"macAddress"`
	NasIpAddress             string     `json:"nasIpAddress"`
	NasIdentifier            string     `json:"nasIdentifier"`
	AdNormalizedUser         string     `json:"adNormalizedUser"`
	AdUserDomainName         string     `json:"adUserDomainName"`
	AdUserNetBiosName        string     `json:"adUserNetBiosName"`
	AdUserResolvedIdentities string     `json:"adUserResolvedIdentities"`
	AdUserResolvedDns        string     `json:"adUserResolvedDns"`
	AdUserQualifiedName      string     `json:"adUserQualifiedName"`
	AdUserSamAccountName     string     `json:"adUserSamAccountName"`
	Providers                []string   `json:"providers"`
	EndpointCheckResult      string     `json:"endpointCheckResult"`
	IdentitySourcePortStart  int        `json:"identitySourcePortStart"`
	IdentitySourcePortEnd    int        `json:"identitySourcePortEnd"`
	IdentitySourcePortFirst  int        `json:"identitySourcePortFirst"`
	IsMachineAuthentication  string     `json:"isMachineAuthentication"`
	NetworkDeviceProfileName string     `json:"networkDeviceProfileName"`
	MdmRegistered            bool       `json:"mdmRegistered"`
	MdmCompliant             bool       `json:"mdmCompliant"`
	MdmDiskEncrypted         bool       `json:"mdmDiskEncrypted"`
	MdmJailBroken            bool       `json:"mdmJailBroken"`
	MdmPinLocked             bool       `json:"mdmPinLocked"`
}

Jump to

Keyboard shortcuts

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