sift icon indicating copy to clipboard operation
sift copied to clipboard

Docker build fails for desktop container

Open joecasanova opened this issue 2 years ago • 3 comments

I'm trying to build a docker image based on ubuntu 20.04 desktop for use in Kasm Workspaces.

DISCLAIMER: I honestly do not believe this is an issue with SIFT and more an issue of my inexperience with building such docker containers.

If I try to build using sift-linux-cli it results in an issue with /etc/sift-version with the following output:

Error: Update returned exit code not zero
    at ChildProcess.<anonymous> (/snapshot/sift-cli/sift-cli.js:556:23)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1058:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)`

My Dockerfile in that instance looks like:

`FROM kasmweb/core-ubuntu-focal:1.11.0
USER root

ENV HOME /home/kasm-default-profile
ENV STARTUPDIR /dockerstartup
ENV INST_SCRIPTS $STARTUPDIR/install
WORKDIR $HOME

######### Customize Container Here ###########

RUN  wget https://github.com/teamdfir/sift-cli/releases/download/v1.14.0-rc1/sift-cli-linux https://github.com/teamdfir/sift-cli/releases/download/v1.14.0-rc1/sift-cli-linux.sig https://github.com/teamdfir/sift-cli/releases/download/v1.14.0-rc1/sift-cli.pub https://github.com/sigstore/cosign/releases/download/v1.11.1/cosign_1.11.1_amd64.deb \
    && dpkg -i cosign_1.11.1_amd64.deb \
    && cosign verify-blob --key sift-cli.pub --signature sift-cli-linux.sig sift-cli-linux \
    && mv sift-cli-linux /usr/local/bin/sift \
    && chmod 755 /usr/local/bin/sift \
    && apt install sudo 

######### End Customizations ###########

RUN chown 1000:0 $HOME
RUN $STARTUPDIR/set_user_permission.sh $HOME

ENV HOME /home/kasm-user
WORKDIR $HOME
RUN mkdir -p $HOME && chown -R 1000:0 $HOME

RUN sudo /usr/local/bin/sift install --user=kasm-user

USER 1000

With a pretty vanilla docker build:

sudo docker build -t sift-workstation:latest -f Dockerfile .

If I comment out the sift install line in the Dockerfile and then run that command inside a session of that running image I get the same issue. It seems to be an issue with the use of timedatectl looking for init. I get the following error message when I try to run timedatectl within the container:

System has not been booted with systemd as init system (PID 1). Can't operate. Failed to create bus connection: Host is down

If I set --mode=server the install process works fine however my analysts are looking for the desktop flavor. (I'm not familiar with the intricacies of SIFT - just the guy who builds platforms/tools/solutions for analysts to use - but absolutely willing to learn.)

I also tried performing the manual install via SIFT from here: https://github.com/teamdfir/sift-saltstack

However, and I could be mistaken with my interpretation here, but it appears the instructions may be outdated as the repo URLs are no longer available - they have switched to something like "https://repo.saltproject.io/py3/ubuntu/20.04/amd64/3004/SALTSTACK-GPG-KEY.pub". But when I try 3004, which SIFT 1.14.0-rc1 references in the diff between it and 1.13, I receive several errors which research indicates a version mismatch between SIFT and salt.

I feel like I'm close but scraping the bottom of the barrel and could use some assistance from someone who objectively know better than I.

joecasanova avatar Aug 26 '22 15:08 joecasanova

Hi @joecasanova , I've actually got a sift Dockerfile created which you should be able to modify for your purposes, but I haven't updated it recently for Saltstack 3004. If you give me an hour I can have it finished for you. You can find it here when it's done. Alternatively, I also have one which has SIFT and REMnux as well here. I'll let you know when they're updated!

digitalsleuth avatar Aug 26 '22 20:08 digitalsleuth

Hi @joecasanova , I was just re-reading your original message and realized I skipped over the error message you provided. The message occurs because the operating system within the docker container doesn't run with system level operation, and as such cannot run system-level commands such as timedatectl. Your best bet to set the timezone might be to set it manually using configuration files.

As for the errors between the two SIFT CLI versions, if you're still encountering those with the Dockerfile I provided, let me know and I'll help you out with resolving that as well.

digitalsleuth avatar Aug 28 '22 00:08 digitalsleuth

Hi @joecasanova , just checking in to see how things have progressed with this.

digitalsleuth avatar Sep 21 '22 02:09 digitalsleuth

Closing due to stale.

ekristen avatar Feb 01 '23 23:02 ekristen