Documentation
¶
Index ¶
- Constants
- Variables
- func DialOptionForTransportConfig(cfg *TransportConfig) (grpc.DialOption, error)
- func FaultInvalidCert(err error) *fault.Fault
- func FaultInvalidCertFile(filePath string, err error) *fault.Fault
- func FaultMissingCertFile(filePath string) *fault.Fault
- func FaultUnreadableCertFile(filePath string) *fault.Fault
- func GetClientTransportCredentials(cfg *TransportConfig) (credentials.TransportCredentials, error)
- func GetServerTransportCredentials(cfg *TransportConfig) (credentials.TransportCredentials, error)
- func LoadCertificate(certPath string) (*x509.Certificate, error)
- func LoadPEMData(filePath string, perms os.FileMode) ([]byte, error)
- func LoadPrivateKey(keyPath string) (crypto.PrivateKey, error)
- func MethodToComponent(method string) (build.Component, error)
- func ServerOptionForTransportConfig(cfg *TransportConfig) (grpc.ServerOption, error)
- func ValidateCertDirectory(certDir string) error
- type CertificateConfig
- type ClientUserMap
- type Component
- type CredentialConfig
- type DomainInfo
- type MappedClientUser
- type TokenSigner
- type TransportConfig
- type UnsupportedKeyError
Constants ¶
const ( MaxUserOnlyKeyPerm os.FileMode = 0400 MaxGroupKeyPerm os.FileMode = 0440 MaxCertPerm os.FileMode = 0664 MaxDirPerm os.FileMode = 0750 )
const ServerCommonName = "server"
Variables ¶
var ( FaultUnknown = securityFault( code.SecurityUnknown, "unknown security error", "", ) )
Functions ¶
func DialOptionForTransportConfig ¶
func DialOptionForTransportConfig(cfg *TransportConfig) (grpc.DialOption, error)
func FaultInvalidCert ¶
FaultInvalidCert indicates that a certificate was invalid.
func FaultInvalidCertFile ¶
FaultInvalidCertFile indicates that a certificate loaded from a file was invalid.
func FaultMissingCertFile ¶
func FaultUnreadableCertFile ¶
func GetClientTransportCredentials ¶
func GetClientTransportCredentials(cfg *TransportConfig) (credentials.TransportCredentials, error)
func GetServerTransportCredentials ¶
func GetServerTransportCredentials(cfg *TransportConfig) (credentials.TransportCredentials, error)
func LoadCertificate ¶
func LoadCertificate(certPath string) (*x509.Certificate, error)
LoadCertificate loads the certificate specified at the given path into an x509 Certificate object
func LoadPEMData ¶
LoadPEMData handles security checking on the PEM file based on perms and returns the bytes in the PEM file
func LoadPrivateKey ¶
func LoadPrivateKey(keyPath string) (crypto.PrivateKey, error)
LoadPrivateKey loads the private key specified at the given path into an crypto.PrivateKey interface compliant object.
func MethodToComponent ¶
MethodToComponent resolves a gRPC method string to a build.Component.
func ServerOptionForTransportConfig ¶
func ServerOptionForTransportConfig(cfg *TransportConfig) (grpc.ServerOption, error)
func ValidateCertDirectory ¶
ValidateCertDirectory ensures the certificate directory has safe permissions set on it.
Types ¶
type CertificateConfig ¶
type CertificateConfig struct { ServerName string `yaml:"-"` ClientCertDir string `yaml:"client_cert_dir,omitempty"` CARootPath string `yaml:"ca_cert"` CertificatePath string `yaml:"cert"` PrivateKeyPath string `yaml:"key"` // contains filtered or unexported fields }
CertificateConfig contains the specific certificate information for the daos component. ServerName is only needed if the config is being used as a transport credential for a gRPC tls client.
type ClientUserMap ¶
type ClientUserMap map[uint32]*MappedClientUser
ClientUserMap is a map of uids to mapped client users.
func (ClientUserMap) Lookup ¶
func (cm ClientUserMap) Lookup(uid uint32) *MappedClientUser
Lookup attempts to resolve the supplied uid to a mapped client user. If the uid is not in the map, the default map key is returned. If the default map key is not found, nil is returned.
func (*ClientUserMap) UnmarshalYAML ¶
func (cm *ClientUserMap) UnmarshalYAML(unmarshal func(interface{}) error) error
type Component ¶
type Component int
Component represents the DAOS component being granted authorization.
func CommonNameToComponent ¶
CommonNameToComponent returns the correct component based on the CommonName
type CredentialConfig ¶
type CredentialConfig struct { CacheExpiration time.Duration `yaml:"cache_expiration,omitempty"` ClientUserMap ClientUserMap `yaml:"client_user_map,omitempty"` }
CredentialConfig contains configuration details for managing user credentials.
type DomainInfo ¶
type DomainInfo struct {
// contains filtered or unexported fields
}
DomainInfo holds our socket credentials to be used by the DomainSocketServer
func DomainInfoFromUnixConn ¶
DomainInfoFromUnixConn determines credentials from a unix socket.
func InitDomainInfo ¶
func InitDomainInfo(creds *syscall.Ucred, ctx string) *DomainInfo
InitDomainInfo returns an initialized DomainInfo structure
func (*DomainInfo) Ctx ¶
func (d *DomainInfo) Ctx() string
Ctx returns the additional security information obtained from the domain socket
func (*DomainInfo) Gid ¶
func (d *DomainInfo) Gid() uint32
Gid returns the GID obtained from the domain socket
func (*DomainInfo) Pid ¶
func (d *DomainInfo) Pid() int32
Pid returns the PID obtained from the domain socket
func (*DomainInfo) String ¶
func (d *DomainInfo) String() string
func (*DomainInfo) Uid ¶
func (d *DomainInfo) Uid() uint32
Uid returns the UID obtained from the domain socket
type MappedClientUser ¶
type MappedClientUser struct { User string `yaml:"user"` Group string `yaml:"group"` Groups []string `yaml:"groups"` }
MappedClientUser represents a client user that is mapped to a uid.
type TokenSigner ¶
type TokenSigner struct {
// contains filtered or unexported fields
}
TokenSigner serves to encapsulate the functionality needed to sign and verify auth token signatures.
func DefaultTokenSigner ¶
func DefaultTokenSigner() *TokenSigner
DefaultTokenSigner creates a TokenSigner with an instantiated entropy pool.
func (*TokenSigner) Hash ¶
func (s *TokenSigner) Hash(data []byte) ([]byte, error)
Hash returns the SHA-512 hash of the byte array passed in.
func (*TokenSigner) Sign ¶
func (s *TokenSigner) Sign(key crypto.PrivateKey, data []byte) ([]byte, error)
Sign takes an unhashed set of bytes and hashes and signs the result with the key passed in.
type TransportConfig ¶
type TransportConfig struct { AllowInsecure bool `yaml:"allow_insecure"` CertificateConfig `yaml:",inline"` }
TransportConfig contains all the information on whether or not to use certificates and their location if their use is specified.
func DefaultAgentTransportConfig ¶
func DefaultAgentTransportConfig() *TransportConfig
DefaultAgentTransportConfig provides a default transport config disabling certificate usage and specifying certificates located under /etc/daos/certs.
func DefaultClientTransportConfig ¶
func DefaultClientTransportConfig() *TransportConfig
DefaultClientTransportConfig provides a default transport config disabling certificate usage and specifying certificates located under /etc/daos/certs. As this credential is meant to be used as a client credential it specifies a default ServerName as well.
func DefaultServerTransportConfig ¶
func DefaultServerTransportConfig() *TransportConfig
DefaultServerTransportConfig provides a default transport config disabling certificate usage and specifying certificates located under /etc/daos.
func (*TransportConfig) PreLoadCertData ¶
func (tc *TransportConfig) PreLoadCertData() error
PreLoadCertData reads the certificate files in and parses them into TLS key pair and Certificate pool to provide a mechanism for detecting certificate error before first use.
func (*TransportConfig) PrivateKey ¶
func (tc *TransportConfig) PrivateKey() (crypto.PrivateKey, error)
PrivateKey returns the private key stored in the certificates loaded into the TransportConfig
func (*TransportConfig) PublicKey ¶
func (tc *TransportConfig) PublicKey() (crypto.PublicKey, error)
PublicKey returns the private key stored in the certificates loaded into the TransportConfig
func (*TransportConfig) ReloadCertData ¶
func (tc *TransportConfig) ReloadCertData() error
ReloadCertData reloads and stores the certificate data in the case when certificate data has changed since initial loading.
func (*TransportConfig) String ¶
func (tc *TransportConfig) String() string
type UnsupportedKeyError ¶
type UnsupportedKeyError struct{}
UnsupportedKeyError is a structured error used to indicate that the PublicKey or PrivateKey interface passed in represents a key type we do not support.
func (*UnsupportedKeyError) Error ¶
func (err *UnsupportedKeyError) Error() string
Error is the implementation of the error interface.