getCertificateForPrivateKey returns path and name for optional OpenSSH certificate https://www.man7.org/linux/man-pages/man1/ssh-keygen.1.html#CERTIFICATES https://github.com/ddev/ddev/issues/6832
(path string, name string)
| 169 | // https://www.man7.org/linux/man-pages/man1/ssh-keygen.1.html#CERTIFICATES |
| 170 | // https://github.com/ddev/ddev/issues/6832 |
| 171 | func getCertificateForPrivateKey(path string, name string) (string, string) { |
| 172 | cert := path + "-cert.pub" |
| 173 | if !fileutil.FileExists(cert) { |
| 174 | return "", "" |
| 175 | } |
| 176 | certPath, err := filepath.EvalSymlinks(cert) |
| 177 | if err != nil { |
| 178 | util.Warning("Unable to read %s file: %v", cert, err) |
| 179 | return "", "" |
| 180 | } |
| 181 | if !fileutil.FileIsReadable(certPath) { |
| 182 | util.Warning("Unable to read %s file: file is not readable", certPath) |
| 183 | return "", "" |
| 184 | } |
| 185 | certName := name + "-cert.pub" |
| 186 | return certPath, certName |
| 187 | } |
| 188 | |
| 189 | // GetAuthSSHCmd wraps the command to be run inside the SSH auth container. |
| 190 | // SSH auth container mounts the SSH keys into /tmp/sshtmp location, |
no test coverage detected