zpu

package
v1.10.61 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

ZPE Policy Updater GO utility

License

Copyright 2017 Yahoo Holdings, Inc.

Licensed under the terms of the Apache version 2.0 license. See LICENSE file for terms.

Documentation

Overview

Package zpu is a utility library to update ZPE Policy.

Index

Constants

View Source
const (
	DEFAULT_STARTUP_DELAY = 0
	MAX_STARTUP_DELAY     = 1440
	DEFAULT_EXPIRY_CHECK  = 2880
)

Default and maximal startup delay values.

Variables

This section is empty.

Functions

func CheckState added in v1.10.41

func CheckState(config *ZpuConfiguration) ([]metrics.PolicyStatus, []error)

func GetEtagForExistingPolicy

func GetEtagForExistingPolicy(config *ZpuConfiguration, ztsClient zts.ZTSClient, domain string) string

func GetJWSPolicies added in v1.10.33

func GetJWSPolicies(config *ZpuConfiguration, ztsClient zts.ZTSClient, domain string) error

func GetPolicies

func GetPolicies(config *ZpuConfiguration, ztsClient zts.ZTSClient, domain string) error

func GetSignedPolicies added in v1.10.33

func GetSignedPolicies(config *ZpuConfiguration, ztsClient zts.ZTSClient, domain string) error

func GetSignedPolicyDataFromJson added in v1.10.33

func GetSignedPolicyDataFromJson(config *ZpuConfiguration, ztsClient zts.ZTSClient, readFile *os.File) (*zts.SignedPolicyData, error)

func GetSignedPolicyDataFromJws added in v1.10.33

func GetSignedPolicyDataFromJws(config *ZpuConfiguration, ztsClient zts.ZTSClient, readFile *os.File) (*zts.SignedPolicyData, error)

func PolicyUpdater

func PolicyUpdater(config *ZpuConfiguration) error

func PolicyView added in v1.10.39

func PolicyView(config *ZpuConfiguration, domainName string) error

func ValidateJWSPolicies added in v1.10.33

func ValidateJWSPolicies(config *ZpuConfiguration, ztsClient zts.ZTSClient, jwsPolicyData *zts.JWSPolicyData) ([]byte, error)

func ValidateSignedPolicies

func ValidateSignedPolicies(config *ZpuConfiguration, ztsClient zts.ZTSClient, data *zts.DomainSignedPolicyData) ([]byte, error)

func WritePolicies

func WritePolicies(config *ZpuConfiguration, bytes []byte, domain string) error

WritePolicies If domain policy file is not found, create the policy file and write policies in it. Else delete the existing file and write the modified policies to new file.

Types

type AthenzConf

type AthenzConf struct {
	ZtsUrl        string `json:"ztsUrl"`
	ZmsUrl        string `json:"zmsUrl"`
	ZtsPublicKeys []struct {
		Id  string `json:"id"`
		Key string `json:"key"`
	} `json:"ztsPublicKeys"`
	ZmsPublicKeys []struct {
		Id  string `json:"id"`
		Key string `json:"key"`
	} `json:"zmsPublicKeys"`
}

func ReadAthenzConf

func ReadAthenzConf(athenzConf string) (*AthenzConf, error)

type ZpuConf

type ZpuConf struct {
	Domains           string            `json:"domains"`
	User              string            `json:"user"`
	PolicyDir         string            `json:"policyDir"`
	TempPolicyDir     string            `json:"tempPolicyDir"`
	MetricsDir        string            `json:"metricsDir"`
	LogMaxSize        int               `json:"logMaxsize"`
	LogMaxAge         int               `json:"logMaxage"`
	LogMaxBackups     int               `json:"logMaxbackups"`
	LogCompress       bool              `json:"logCompress"`
	PrivateKey        string            `json:"privateKeyFile"`
	CertFile          string            `json:"certFile"`
	CaCertFile        string            `json:"caCertFile"`
	Proxy             bool              `json:"proxy"`
	ExpiryCheck       int               `json:"expiryCheck"`
	CheckZMSSignature bool              `json:"checkZMSSignature"`
	JWSPolicySupport  bool              `json:"jwsPolicySupport"`
	PolicyVersions    map[string]string `json:"policyVersions"`
}

func ReadZpuConf

func ReadZpuConf(zpuConf string) (*ZpuConf, error)

type ZpuConfiguration

type ZpuConfiguration struct {
	Zts               string
	Zms               string
	DomainList        string
	ZpuOwner          string
	PolicyFileDir     string
	TempPolicyFileDir string
	MetricsDir        string
	ZmsKeysmap        map[string]string
	ZtsKeysmap        map[string]string
	StartUpDelay      int
	ExpiryCheck       int
	LogSize           int
	LogAge            int
	LogBackups        int
	LogCompression    bool
	PrivateKeyFile    string
	CertFile          string
	CaCertFile        string
	Proxy             bool
	CheckZMSSignature bool
	JWSPolicySupport  bool
	PolicyVersions    map[string]string
	ForceRefresh      bool
}

func NewZpuConfiguration

func NewZpuConfiguration(root, athensConfFile, zpuConfFile string) (*ZpuConfiguration, error)

func (ZpuConfiguration) GetZmsPublicKey

func (config ZpuConfiguration) GetZmsPublicKey(key string) string

func (ZpuConfiguration) GetZtsPublicKey

func (config ZpuConfiguration) GetZtsPublicKey(key string) string

func (ZpuConfiguration) PutZmsPublicKey added in v1.10.33

func (config ZpuConfiguration) PutZmsPublicKey(key, publicKey string)

func (ZpuConfiguration) PutZtsPublicKey added in v1.10.33

func (config ZpuConfiguration) PutZtsPublicKey(key, publicKey string)

Directories

Path Synopsis
cmd
tools
Tools is a program that runs zpu.PolicyUpdater.
Tools is a program that runs zpu.PolicyUpdater.
Package devel provides utility functions for testing (StartMockServer and CreateFile).
Package devel provides utility functions for testing (StartMockServer and CreateFile).
Package test_data contains test data for zpe-updater as .go files.
Package test_data contains test data for zpe-updater as .go files.
Package util provides utility types and functions for zpe-updater.
Package util provides utility types and functions for zpe-updater.

Jump to

Keyboard shortcuts

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