Documentation
¶
Index ¶
Constants ¶
const ( DefaultCACommonName = "DVFS Offline Root CA" DefaultCAOrganization = "DVFS Project" DefaultCAOU = "Security" DefaultCACountry = "IN" DefaultCAProvince = "Gujarat" DefaultCALocality = "Gandhinagar" DefaultCAValidityDays = 3652 // 10 years + 2 leap days DefaultCAKeyBits = 4096 )
DefaultRootCAConfig defines standard parameters for the DVFS Root CA.
const ( DefaultNodeValidityDays = 730 // 2 years DefaultNodeKeyBits = 4096 )
Variables ¶
This section is empty.
Functions ¶
func LoadCACert ¶
func LoadCACert(certPath string) (*x509.Certificate, []byte, error)
LoadCACert reads and parses only the public CA certificate without requiring the private key.
func SyncClientCA ¶
SyncClientCA finds the repository root and automatically updates internal/client/ca.go with the provided certPEM.
Types ¶
type NodeCertOptions ¶
type NodeCertOptions struct {
NodeName string
Organization string
ValidityDays int
KeyBits int
ExtraDNS []string
ExtraIPs []net.IP
}
NodeCertOptions configures the generation of a node certificate.
func DefaultNodeCertOptions ¶
func DefaultNodeCertOptions(nodeName string) NodeCertOptions
DefaultNodeCertOptions returns production options with standard SANs for a cluster node.
type NodeCertificate ¶
type NodeCertificate struct {
NodeName string
Certificate *x509.Certificate
PrivateKey *rsa.PrivateKey
CertPEM []byte
KeyPEM []byte
}
NodeCertificate holds in-memory artifacts for a signed node certificate.
func GenerateNodeCert ¶
func GenerateNodeCert(ca *RootCA, opts NodeCertOptions) (*NodeCertificate, error)
GenerateNodeCert generates an RSA private key and a leaf certificate signed by the Root CA.
func (*NodeCertificate) Save ¶
func (nc *NodeCertificate) Save(nodeDir string) error
Save writes server.crt and server.key into the specified directory. server.key is written with 0600 permissions.
type RootCA ¶
type RootCA struct {
Certificate *x509.Certificate
PrivateKey *rsa.PrivateKey
CertPEM []byte
KeyPEM []byte
}
RootCA holds the generated in-memory certificate, private key, and PEM encodings.
func GenerateRootCA ¶
func GenerateRootCA(opts RootCAOptions) (*RootCA, error)
GenerateRootCA creates a new self-signed Root CA with a 10+ year validity period. The private key must be kept offline and never copied to server or client devices.
type RootCAOptions ¶
type RootCAOptions struct {
CommonName string
Organization string
OU string
Country string
Province string
Locality string
ValidityDays int
KeyBits int
}
RootCAOptions configures generation of the Root CA.
func DefaultRootCAOptions ¶
func DefaultRootCAOptions() RootCAOptions
DefaultRootCAOptions returns standard production-grade options for the Root CA.