Skip to content
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

Fix GPG Agent forwarding broken #888

Merged
merged 4 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions e2e/framework/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,22 @@ func (f *Framework) SetupGPG(tmpDir string) error {
func (f *Framework) DevPodSSHGpgTestKey(ctx context.Context, workspace string) error {
pubKeyB, err := exec.Command("sh", "-c", "gpg -k --with-colons 2>/dev/null | grep sec | base64 -w0").Output()
if err != nil {
return nil
return err
}

// First run to trigger the first forwarding
stdout, _, _ := f.ExecCommandCapture(ctx, []string{
stdout, _, err := f.ExecCommandCapture(ctx, []string{
"ssh",
"--agent-forwarding",
"--gpg-agent-forwarding",
"--command",
"gpg -k --with-colons 2>/dev/null |grep sec | base64 -w0", workspace,
})

if err != nil {
return err
}

if stdout != string(pubKeyB) {
return fmt.Errorf("devpod gpg public key forwarding failed, expected %s, got %s", string(pubKeyB), stdout)
}
Expand Down
5 changes: 5 additions & 0 deletions e2e/tests/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ var _ = DevPodDescribe("devpod ssh test suite", func() {
})

ginkgo.It("should start a new workspace with a docker provider (default) and forward gpg agent into it", func() {
// skip windows for now
if runtime.GOOS == "windows" {
return
}

tempDir, err := framework.CopyToTempDir("tests/ssh/testdata/gpg-forwarding")
framework.ExpectNoError(err)
defer framework.CleanupTempDir(initialDir, tempDir)
Expand Down
11 changes: 0 additions & 11 deletions pkg/driver/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,10 @@ func (d *dockerDriver) RunDockerDevContainer(
}

// mounts
tmpfsMount := true
for _, mount := range options.Mounts {
// skip tmpfs mount on /tmp if devcontainer specifies another mount option
if strings.Contains(mount.String(), "destination=/tmp") ||
strings.Contains(mount.String(), "target=/tmp") {
tmpfsMount = false
}
args = append(args, "--mount", mount.String())
}

// ensure /tmp is a tmpfs like on regular linux distros
if tmpfsMount {
args = append(args, "--mount", "type=tmpfs,destination=/tmp")
}

// add ide mounts
switch ide {
case string(config2.IDEGoland):
Expand Down
Loading