Skip to content
Merged
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
15 changes: 15 additions & 0 deletions runtime/workspace/agent/cmd/workspace-entrypoint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const workspaceProfileBin = "/run/workspace/profile/bin"
const workspaceProfileScript = "/run/workspace/profile/etc/profile.d/99-pwn-workspace.sh"
const workspaceUserRunDir = "/run/workspace/user"
const workspaceServicesDir = "/run/workspace/user/services"
const legacyDojoWorkspaceDir = "/run/dojo/sys/workspace"
const legacyDojoPrivilegedFile = "/run/dojo/sys/workspace/privileged"
const systemProfileScript = "/etc/profile.d/99-pwn-workspace.sh"
const userShell = "/run/workspace/profile/bin/bash"

Expand Down Expand Up @@ -141,6 +143,9 @@ func prepareWorkspace(config workspaceConfig) error {
if err := setupRunDirectories(); err != nil {
return err
}
if err := setupLegacyDojoWorkspace(); err != nil {
return err
}
if err := setupSystemEnvironment(); err != nil {
return err
}
Expand Down Expand Up @@ -182,6 +187,16 @@ func setupRunDirectories() error {
return linkServiceDefinitions()
}

func setupLegacyDojoWorkspace() error {
if err := os.MkdirAll(legacyDojoWorkspaceDir, 0755); err != nil {
return err
}
if err := os.WriteFile(legacyDojoPrivilegedFile, []byte("0\n"), 0444); err != nil {
return err
}
return os.Chmod(legacyDojoPrivilegedFile, 0444)
}

func linkChallengeBin() error {
if _, err := os.Stat(challengeBin); errors.Is(err, os.ErrNotExist) {
return nil
Expand Down