MCPcopy Create free account
hub / github.com/anchordotdev/cli / installCA

Method installCA

truststore/platform_linux.go:114–131  ·  view source on GitHub ↗
(ca *CA)

Source from the content-addressed store, hash-verified

112}
113
114func (s *Platform) installCA(ca *CA) (bool, error) {
115 cert, err := os.ReadFile(ca.FilePath)
116 if err != nil {
117 return false, fatalErr(err, "failed to read root certificate")
118 }
119
120 cmd := s.SysFS.Command("tee", s.trustFilenamePath(ca))
121 cmd.Stdin = bytes.NewReader(cert)
122 if out, err := s.SysFS.SudoExec(cmd); err != nil {
123 return false, fatalCmdErr(err, "tee", out)
124 }
125
126 if out, err := s.SysFS.SudoExec(s.SysFS.Command(s.trustCommand[0], s.trustCommand[1:]...)); err != nil {
127 return false, fatalCmdErr(err, strings.Join(s.trustCommand, " "), out)
128 }
129
130 return true, nil
131}
132
133func (s *Platform) listCAs() ([]*CA, error) {
134 if ok, err := s.check(); !ok {

Callers 1

InstallCAMethod · 0.95

Calls 6

trustFilenamePathMethod · 0.95
fatalErrFunction · 0.85
fatalCmdErrFunction · 0.85
CommandMethod · 0.65
SudoExecMethod · 0.65
ReadFileMethod · 0.45

Tested by

no test coverage detected