Skip to content

Commit 8f8add4

Browse files
committed
Revert "Add automatic CA certificate trust setup"
This reverts commit f9aff32.
1 parent f9aff32 commit 8f8add4

File tree

2 files changed

+0
-69
lines changed

2 files changed

+0
-69
lines changed

main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ func runBoundary(inv *serpent.Invocation) error {
154154
return fmt.Errorf("failed to create certificate manager: %v", err)
155155
}
156156

157-
// Automatically install CA certificate for system and tool trust
158-
if err := certManager.InstallCACertificate(); err != nil {
159-
logger.Warn("Failed to install CA certificate, manual setup may be required", "error", err)
160-
}
161-
162157
tlsConfig = certManager.GetTLSConfig()
163158

164159
// Get CA certificate for environment

tls/tls.go

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"math/big"
1313
"net"
1414
"os"
15-
"os/exec"
1615
"path/filepath"
1716
"sync"
1817
"time"
@@ -294,69 +293,6 @@ func (cm *CertificateManager) generateServerCertificate(hostname string) (*tls.C
294293
return tlsCert, nil
295294
}
296295

297-
// InstallCACertificate installs the CA certificate into the system trust store
298-
func (cm *CertificateManager) InstallCACertificate() error {
299-
// Get CA certificate in PEM format
300-
caCertPEM, err := cm.GetCACertPEM()
301-
if err != nil {
302-
return fmt.Errorf("failed to get CA certificate: %v", err)
303-
}
304-
305-
// Install system-wide certificate (Linux)
306-
if err := cm.installSystemCertificate(caCertPEM); err != nil {
307-
cm.logger.Warn("Failed to install system certificate, continuing anyway", "error", err)
308-
}
309-
310-
// Set up environment variables for tool-specific trust
311-
if err := cm.setupEnvironmentVariables(); err != nil {
312-
cm.logger.Warn("Failed to setup environment variables", "error", err)
313-
}
314-
315-
cm.logger.Info("CA certificate trust setup completed")
316-
return nil
317-
}
318-
319-
// installSystemCertificate installs the CA certificate system-wide on Linux
320-
func (cm *CertificateManager) installSystemCertificate(caCertPEM []byte) error {
321-
// Write certificate to system certificate directory
322-
certPath := "/usr/local/share/ca-certificates/boundary-ca.crt"
323-
if err := os.WriteFile(certPath, caCertPEM, 0644); err != nil {
324-
return fmt.Errorf("failed to write certificate to %s: %v", certPath, err)
325-
}
326-
327-
// Update system certificate store
328-
cmd := exec.Command("update-ca-certificates")
329-
if output, err := cmd.CombinedOutput(); err != nil {
330-
return fmt.Errorf("failed to update ca certificates: %v, output: %s", err, output)
331-
}
332-
333-
cm.logger.Info("System CA certificate installed", "path", certPath)
334-
return nil
335-
}
336-
337-
// setupEnvironmentVariables sets up environment variables for tool-specific certificate trust
338-
func (cm *CertificateManager) setupEnvironmentVariables() error {
339-
caCertPath := filepath.Join(cm.configDir, "ca-cert.pem")
340-
341-
// Set environment variables for various tools
342-
envVars := map[string]string{
343-
"SSL_CERT_FILE": caCertPath,
344-
"REQUESTS_CA_BUNDLE": caCertPath,
345-
"CURL_CA_BUNDLE": caCertPath,
346-
"NODE_EXTRA_CA_CERTS": caCertPath,
347-
}
348-
349-
for key, value := range envVars {
350-
if err := os.Setenv(key, value); err != nil {
351-
cm.logger.Warn("Failed to set environment variable", "key", key, "error", err)
352-
} else {
353-
cm.logger.Debug("Set environment variable", "key", key, "value", value)
354-
}
355-
}
356-
357-
return nil
358-
}
359-
360296
// GetConfigDir returns the configuration directory path
361297
func GetConfigDir() (string, error) {
362298
homeDir, err := os.UserHomeDir()

0 commit comments

Comments
 (0)