-
Notifications
You must be signed in to change notification settings - Fork 16
Add BMC certificate management #836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
152f1b3
31ef0ea
dd5873a
f0b0c1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -141,6 +141,21 @@ type BMC interface { | |||||||||||||||||||||||||
| // CheckBMCPendingComponentUpgrade checks if there are pending/staged firmware upgrades | ||||||||||||||||||||||||||
| // for the given component type. | ||||||||||||||||||||||||||
| CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // GetCertificateService retrieves the certificate service for the BMC. | ||||||||||||||||||||||||||
| GetCertificateService(ctx context.Context) (*schemas.CertificateService, error) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // GenerateCSR generates a Certificate Signing Request on the BMC. | ||||||||||||||||||||||||||
| GenerateCSR(ctx context.Context, req CSRRequest) (*CSRResponse, error) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // InstallCertificate installs a certificate on the BMC. | ||||||||||||||||||||||||||
| InstallCertificate(ctx context.Context, certificatePEM string, certificateType CertificateType) error | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // GetCertificates retrieves all installed certificates on the BMC. | ||||||||||||||||||||||||||
| GetCertificates(ctx context.Context) ([]CertificateInfo, error) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // DeleteCertificate deletes a certificate from the BMC. | ||||||||||||||||||||||||||
| DeleteCertificate(ctx context.Context, certificateURI string) error | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| type Entity struct { | ||||||||||||||||||||||||||
|
|
@@ -300,3 +315,73 @@ type Manager struct { | |||||||||||||||||||||||||
| MACAddress string | ||||||||||||||||||||||||||
| OemLinks json.RawMessage | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // CertificateType defines the type of certificate. | ||||||||||||||||||||||||||
| type CertificateType string | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const ( | ||||||||||||||||||||||||||
| // CertificateTypeHTTPS is the HTTPS/TLS certificate type | ||||||||||||||||||||||||||
| CertificateTypeHTTPS CertificateType = "PEM" | ||||||||||||||||||||||||||
| // CertificateTypeCA is the CA certificate type | ||||||||||||||||||||||||||
| CertificateTypeCA CertificateType = "PEM" | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
Comment on lines
+322
to
+327
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both certificate type constants share the same value "PEM" — filtering by type is broken.
🐛 Minimal fix to differentiate the two values const (
// CertificateTypeHTTPS is the HTTPS/TLS certificate type
CertificateTypeHTTPS CertificateType = "PEM"
// CertificateTypeCA is the CA certificate type
- CertificateTypeCA CertificateType = "PEM"
+ CertificateTypeCA CertificateType = "CA"
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // CertificatePurpose defines the purpose/usage of a certificate. | ||||||||||||||||||||||||||
| type CertificatePurpose string | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const ( | ||||||||||||||||||||||||||
| // CertificatePurposeHTTPS indicates an HTTPS/TLS server certificate | ||||||||||||||||||||||||||
| CertificatePurposeHTTPS CertificatePurpose = "HTTPS" | ||||||||||||||||||||||||||
| // CertificatePurposeCA indicates a CA certificate | ||||||||||||||||||||||||||
| CertificatePurposeCA CertificatePurpose = "CA" | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // CSRRequest contains parameters for generating a Certificate Signing Request. | ||||||||||||||||||||||||||
| type CSRRequest struct { | ||||||||||||||||||||||||||
| // CommonName is the common name for the certificate (typically hostname or IP) | ||||||||||||||||||||||||||
| CommonName string | ||||||||||||||||||||||||||
| // Organization is the organization name | ||||||||||||||||||||||||||
| Organization string | ||||||||||||||||||||||||||
| // OrganizationalUnit is the organizational unit | ||||||||||||||||||||||||||
| OrganizationalUnit string | ||||||||||||||||||||||||||
| // Country is the two-letter country code | ||||||||||||||||||||||||||
| Country string | ||||||||||||||||||||||||||
| // State is the state or province | ||||||||||||||||||||||||||
| State string | ||||||||||||||||||||||||||
| // City is the city or locality | ||||||||||||||||||||||||||
| City string | ||||||||||||||||||||||||||
| // Email is the email address | ||||||||||||||||||||||||||
| Email string | ||||||||||||||||||||||||||
| // KeyPairAlgorithm is the key pair algorithm (e.g., "RSA2048", "RSA4096", "EC256") | ||||||||||||||||||||||||||
| KeyPairAlgorithm string | ||||||||||||||||||||||||||
| // AlternativeNames are subject alternative names (DNS names, IP addresses) | ||||||||||||||||||||||||||
| AlternativeNames []string | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // CSRResponse contains the generated Certificate Signing Request. | ||||||||||||||||||||||||||
| type CSRResponse struct { | ||||||||||||||||||||||||||
| // CSRString is the PEM-encoded PKCS#10 CSR | ||||||||||||||||||||||||||
| CSRString string | ||||||||||||||||||||||||||
| // CertificateCollection is the URI where the signed certificate should be installed | ||||||||||||||||||||||||||
| CertificateCollection string | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // CertificateInfo contains information about an installed certificate. | ||||||||||||||||||||||||||
| type CertificateInfo struct { | ||||||||||||||||||||||||||
| // URI is the Redfish URI of the certificate resource | ||||||||||||||||||||||||||
| URI string | ||||||||||||||||||||||||||
| // Type is the certificate type | ||||||||||||||||||||||||||
| Type CertificateType | ||||||||||||||||||||||||||
| // Issuer is the certificate issuer distinguished name | ||||||||||||||||||||||||||
| Issuer string | ||||||||||||||||||||||||||
| // Subject is the certificate subject distinguished name | ||||||||||||||||||||||||||
| Subject string | ||||||||||||||||||||||||||
| // ValidNotBefore is the certificate validity start time | ||||||||||||||||||||||||||
| ValidNotBefore string | ||||||||||||||||||||||||||
| // ValidNotAfter is the certificate validity end time | ||||||||||||||||||||||||||
| ValidNotAfter string | ||||||||||||||||||||||||||
| // SerialNumber is the certificate serial number | ||||||||||||||||||||||||||
| SerialNumber string | ||||||||||||||||||||||||||
| // Fingerprint is the certificate fingerprint/thumbprint | ||||||||||||||||||||||||||
| Fingerprint string | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.