util

package
v1.11.12 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

View Source
const JwkConfFile = "athenz.conf"
View Source
const SshSupport = true

Variables

This section is empty.

Functions

func AppendUri added in v1.10.39

func AppendUri(uriList []*url.URL, uriValue string) []*url.URL

func Copy

func Copy(sourceFile, destFile string, perm os.FileMode) error

func CopyCertKeyFile

func CopyCertKeyFile(srcKey, destKey, srcCert, destCert string, keyPerm int) error

func EnsureBackUpDir

func EnsureBackUpDir(backUpDir string) error

func EnvOrDefault added in v1.11.3

func EnvOrDefault(name string, defaultValue string) string

func ExecIdCommand added in v1.10.48

func ExecIdCommand(arg string) int

func ExtractServiceName

func ExtractServiceName(arn, comp string) (string, string, error)

func FileExists

func FileExists(path string) bool

func GenerateKeyPair

func GenerateKeyPair(bits int) (*rsa.PrivateKey, error)

func GenerateRoleCertCSR added in v1.10.40

func GenerateRoleCertCSR(key *rsa.PrivateKey, countryName, orgName, domain, service, roleName, instanceId, provider, emailDomain string) (string, error)

func GenerateSSHHostCSR added in v1.10.40

func GenerateSSHHostCSR(sshPubKeyFile string, domain, service, ip string, ztsAwsDomains []string) (string, error)

func GenerateSvcCertCSR added in v1.10.40

func GenerateSvcCertCSR(key *rsa.PrivateKey, countryName, orgName, domain, service, commonName, instanceId, provider string, ztsDomains []string, wildCardDnsName, instanceIdSanDNS bool) (string, error)

func GenerateX509CSR

func GenerateX509CSR(key *rsa.PrivateKey, csrDetails CertReqDetails) (string, error)

func GetAthenzJwkConfModTime added in v1.11.2

func GetAthenzJwkConfModTime(siaDir string) rdl.Timestamp

func GetPEMBlock

func GetPEMBlock(privateKey *rsa.PrivateKey) []byte

func GetRoleCertFileName

func GetRoleCertFileName(certDir, fileName, certName string) string

func GetSvcCertFileName added in v1.10.40

func GetSvcCertFileName(certDir, fileName, domain, service string) string

func GetUtilPath added in v1.11.9

func GetUtilPath(command string) string

func NewSysLogger

func NewSysLogger() (io.Writer, error)

func Nonce added in v1.10.41

func Nonce() (string, error)

func ParseAssumedRoleArn added in v1.10.40

func ParseAssumedRoleArn(roleArn, serviceSuffix, accessProfileSeparator string) (string, string, string, string, error)

func ParseCASpiffeUri added in v1.10.41

func ParseCASpiffeUri(uri string) (string, string)

func ParseEnvBooleanFlag added in v1.10.40

func ParseEnvBooleanFlag(varName string) bool

func ParseEnvIntFlag added in v1.10.41

func ParseEnvIntFlag(varName string, defaultValue int) int

func ParseRoleArn added in v1.10.40

func ParseRoleArn(roleArn, rolePrefix, roleSuffix, profileSeparator string) (string, string, string, string, error)

func ParseRoleSpiffeUri added in v1.10.41

func ParseRoleSpiffeUri(uri string) (string, string)

func ParseServiceSpiffeUri added in v1.10.41

func ParseServiceSpiffeUri(uri string) (string, string)

func ParseTaskArn added in v1.10.40

func ParseTaskArn(taskArn string) (string, string, string, error)

func PrivateKey

func PrivateKey(keyFile string, rotateKey bool) (*rsa.PrivateKey, error)

func PrivateKeyFromFile

func PrivateKeyFromFile(filename string) (*rsa.PrivateKey, error)

func PrivatePem

func PrivatePem(privateKey *rsa.PrivateKey) string

func ReadAthenzJwkConf added in v1.11.2

func ReadAthenzJwkConf(jwkConfFile string, jwkConfObj *zts.AthenzJWKConfig) error

func SaveCertKey added in v1.10.40

func SaveCertKey(key, cert []byte, file, keyPrefix, certPrefix string, uid, gid, fileMode int, createKey, rotateKey bool, keyDir, certDir, backupDir string) error

func SetupSIADirs

func SetupSIADirs(siaMainDir, siaLinkDir string, ownerUid, ownerGid int) error

func SplitDomain

func SplitDomain(domain string) (string, string)

func SplitRoleName

func SplitRoleName(roleName string) (string, string, error)

func SvcAttrs

func SvcAttrs(username, groupname string) (int, int, int)

func SyscallSetGid added in v1.10.53

func SyscallSetGid(gid int) error

func SyscallSetUid added in v1.10.53

func SyscallSetUid(uid int) error

func TestGidForGroupCommand added in v1.10.40

func TestGidForGroupCommand(t *testing.T)

func TestGidForInvalidGroupCommand added in v1.10.40

func TestGidForInvalidGroupCommand(t *testing.T)

func TestUidGidForUserGroupCommand added in v1.10.40

func TestUidGidForUserGroupCommand(t *testing.T)

func UidGidForUserGroup

func UidGidForUserGroup(username, groupname string) (int, int)

func UpdateFile

func UpdateFile(fileName string, contents []byte, uid, gid int, perm os.FileMode) error

func UpdateKey

func UpdateKey(keyFile string, uid, gid int)

func WriteAthenzJWKFile added in v1.11.2

func WriteAthenzJWKFile(athenzJwk *zts.AthenzJWKConfig, siaDir string, uid int, gid int) error

func ZtsClient

func ZtsClient(ztsUrl, ztsServerName string, keyFile, certFile, caCertFile string) (*zts.ZTSClient, error)

func ZtsHostName

func ZtsHostName(identity, ztsAwsDomain string) string

Types

type CertReqDetails

type CertReqDetails struct {
	CommonName string
	Country    string
	Province   string
	Locality   string
	Org        string
	OrgUnit    string
	IpList     []string
	HostList   []string
	EmailList  []string
	URIs       []*url.URL
}

type SSHKeyReq added in v1.10.40

type SSHKeyReq struct {
	Principals []string `json:"principals"`
	Ips        []string `json:"ips,omitempty" rdl:"optional"`
	Pubkey     string   `json:"pubkey"`
	Reqip      string   `json:"reqip"`
	Requser    string   `json:"requser"`
	Certtype   string   `json:"certtype"`
	Transid    string   `json:"transid"`
	Command    string   `json:"command,omitempty" rdl:"optional"`
}

SSHKeyReq - congruent with certsign-rdl/certsign.rdl

Jump to

Keyboard shortcuts

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