service

package
v0.0.0-...-adf3037 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_VERSION = 1

	SUCCESS              = 0
	COULD_NOT_WRITE_FILE = 1
	COULD_NOT_ENROLL     = 2

	UNKNOWN_ERROR          = 100
	ERROR                  = 500
	ERROR_DISCONNECTING_ID = 50
	IDENTITY_NOT_FOUND     = 1000

	MFA_FAILED_TO_GENERATE_CODES = 200
	MFA_FAILED_TO_RETURN_CODES   = 201
	MFA_FINGERPRINT_NOT_FOUND    = 202

	DEFAULT_REFRESH_INTERVAL = 10

	InformationEvent = 0 //1
	ContinueEvent    = 0 //2
	PauseEvent       = 0 //3
	InstallEvent     = 0 //4
	InterrogateEvent = 0 //5
	StopEvent        = 0 //6
	ShutdownEvent    = 0 //7
	ErrorEvent       = 0 //1000

	// power events microsoft docs https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-powermanagementevent?redirectedfrom=MSDN
	PBT_APMSUSPEND           = 4  // Entering Suspend
	PBT_APMRESUMESUSPEND     = 7  // Resume from Suspend
	PBT_APMPOWERSTATUSCHANGE = 10 // Power Status Change
	PBT_APMRESUMEAUTOMATIC   = 18 // Resume Automatic

	// windows session changes microsoft docs https://docs.microsoft.com/en-us/windows/win32/termserv/wm-wtssession-change
	WTS_SESSION_LOCK   = 7
	WTS_SESSION_UNLOCK = 8

	// This is the name you will use for the NET START command
	SvcStartName = "ziti"

	// This is the name that will appear in the Services control panel
	SvcName = "Ziti Tunneler"

	// This is the longer description that will be shown in Services
	SvcNameLong = "Provides a client for accessing Ziti networks"

	// see: https://docs.microsoft.com/en-us/windows/win32/secauthz/sid-strings
	// breaks down to
	//		"allow" 	  	 - A   (A;;
	// 	 	"full access" 	 - FA  (A;;FA
	//		"well-known sid" - IU  (A;;FA;;;IU)
	InteractivelyLoggedInUser = "(A;;GRGW;;;IU)" //generic read/write. We will want to tune this to a specific group but that is not working with Windows 10 home at the moment
	System                    = "(A;;FA;;;SY)"
	BuiltinAdmins             = "(A;;FA;;;BA)"
	LocalService              = "(A;;FA;;;LS)"

	NF_GROUP_NAME = "NetFoundry Tunneler Users"
	TunName       = "ZitiTUN"

	STATUS_ENROLLED = "enrolled"

	ConfigFileName = "config.json"
)

Variables

View Source
var Debug bool
View Source
var TunStarted time.Time

Functions

func AddMetrics

func AddMetrics(id *Id)

func Clean

func Clean(src *Id) dto.Identity

Removes the Config from the provided identity and returns a 'cleaned' id

func CleanUpZitiTUNAdapters

func CleanUpZitiTUNAdapters(tunName string)

func EnsurePermissions

func EnsurePermissions(group string) string

func IpcPipeName

func IpcPipeName() string

func ResetFrequency

func ResetFrequency(newFrequency int)

func SubMain

func SubMain(ops chan string, changes chan<- svc.Status, winEvents <-chan WindowsEvents) error

func UpdateRuntimeStateIpv4

func UpdateRuntimeStateIpv4(ip string, ipv4Mask int, addDns string, apiPageSize int) error

Types

type Id

type Id struct {
	dto.Identity
	CId *cziti.ZIdentity
}

type Pipes

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

func (*Pipes) Close

func (p *Pipes) Close()

type RuntimeState

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

func (*RuntimeState) AddRoute

func (t *RuntimeState) AddRoute(destination net.IPNet, nextHop net.IP, metric uint32) error

func (*RuntimeState) BroadcastEvent

func (t *RuntimeState) BroadcastEvent(event interface{})

func (*RuntimeState) Close

func (t *RuntimeState) Close()

func (*RuntimeState) CreateTun

func (t *RuntimeState) CreateTun(ipv4 string, ipv4mask int, applyDns bool) (net.IP, *tun.Device, error)

func (*RuntimeState) Find

func (t *RuntimeState) Find(fingerprint string) *Id

func (*RuntimeState) InterceptDNS

func (t *RuntimeState) InterceptDNS()

func (*RuntimeState) InterceptIP

func (t *RuntimeState) InterceptIP()

func (*RuntimeState) LoadConfig

func (t *RuntimeState) LoadConfig()

func (*RuntimeState) LoadIdentity

func (t *RuntimeState) LoadIdentity(id *Id, refreshInterval int)

func (*RuntimeState) ReleaseDNS

func (t *RuntimeState) ReleaseDNS()

func (*RuntimeState) ReleaseIP

func (t *RuntimeState) ReleaseIP()

func (*RuntimeState) RemoveByFingerprint

func (t *RuntimeState) RemoveByFingerprint(fingerprint string)

func (*RuntimeState) RemoveRoute

func (t *RuntimeState) RemoveRoute(destination net.IPNet, nextHop net.IP) error

func (*RuntimeState) RemoveZitiTun

func (t *RuntimeState) RemoveZitiTun()

func (*RuntimeState) SaveState

func (t *RuntimeState) SaveState()

func (*RuntimeState) SetNotified

func (t *RuntimeState) SetNotified(fingerprint string, notified bool)

func (*RuntimeState) ToMetrics

func (t *RuntimeState) ToMetrics() dto.TunnelStatus

func (*RuntimeState) ToStatus

func (t *RuntimeState) ToStatus(onlyInitialized bool) dto.TunnelStatus

func (*RuntimeState) UpdateControllerAddress

func (t *RuntimeState) UpdateControllerAddress(configFile string, newAddress string)

func (*RuntimeState) UpdateIpv4

func (t *RuntimeState) UpdateIpv4(ipv4 string)

func (*RuntimeState) UpdateIpv4Mask

func (t *RuntimeState) UpdateIpv4Mask(ipv4mask int)

func (*RuntimeState) UpdateMfa

func (t *RuntimeState) UpdateMfa(fingerprint string, mfaEnabled bool, mfaNeeded bool)

func (*RuntimeState) UpdateNotificationFrequency

func (t *RuntimeState) UpdateNotificationFrequency(notificationFreq int) error

type WindowsEvents

type WindowsEvents struct {
	WinPowerEvent   uint32
	WinSessionEvent uint32
}

Jump to

Keyboard shortcuts

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