mandiant / mandiant/gocrack

Docker Build Process is Difficult/Doesn't Work Properly

Open
#44 10 comments 0 reactions 1 assignee View on GitHub

@tankbusta is already working on this.

Since Jun 29, 2018.

bug
Dominant language
Go
Stars
1.3k
Forks
238
PR merge metrics
No merged PRs in 30d

Description

I got a few error when trying to build the docker images.

First, if I simply run **make build** I got the following:
_docker run --rm --net=host -e USER_ID=1000 \
-v /home/oper/code/golang/src/github.com/fireeye/gocrack/docker/dist/hashcat:/out \
gocrack/hashcat_shared
install -m 755 -d /out/share/doc/hashcat
install -m 755 -d /out/share/hashcat
gcc -c -pipe -std=gnu99 -Iinclude/ -Iinclude/lzma_sdk/ -IOpenCL/ -O2 -Ideps/OpenCL-Headers/ -DWITH_HWMON src/affinity.c -o obj/affinity.NATIVE.SHARED.o -fpic
gcc -c -pipe -std=gnu99 -Iinclude/ -Iinclude/lzma_sdk/ -IOpenCL/ -O2 -Ideps/OpenCL-Headers/ -DWITH_HWMON src/autotune.c -o obj/autotune.NATIVE.SHARED.o -fpic
gcc -c -pipe -std=gnu99 -Iinclude/ -Iinclude/lzma_sdk/ -IOpenCL/ -O2 -Ideps/OpenCL-Headers/ -DWITH_HWMON src/benchmark.c -o obj/benchmark.NATIVE.SHARED.o -fpic
gcc -c -pipe -std=gnu99 -Iinclude/ -Iinclude/lzma_sdk/ -IOpenCL/ -O2 -Ideps/OpenCL-Headers/ -DWITH_HWMON src/bitmap.c -o obj/bitmap.NATIVE.SHARED.o -fpic
install: cannot create directory '/out/share': Permission denied
install: cannot create directory '/out/share': Permission denied
src/Makefile:328: recipe for target 'install_docs' failed
make: *** [install_docs] Error 1
make: *** Waiting for unfinished jobs....
make: *** [install_shared] Error 1
src/Makefile:358: recipe for target 'install_shared' failed
Makefile:19: recipe for target 'hashcat' failed
make: *** [hashcat] Error 2_

So there is a problem in the run of the hashcat docker container.

I then tried to run the same thing using sudo. This time, the hashcat part of the make build works, but in the gocrack one, I get the following error:
_docker run --rm --net=host -e USER_ID=0 \
-v /home/oper/code/golang/src/github.com/fireeye/gocrack/docker/dist/gocrack:/out \
-v /src/github.com/fireeye/gocrack:/go/src/github.com/fireeye/gocrack \
gocrack/build
make: *** No targets specified and no makefile found. Stop.
Makefile:31: recipe for target 'gocrack' failed
make: *** [gocrack] Error 2_

I then tried to make the different target seperately:
**sudo make hashcat
make gocrack**

I get a permission denied error after the make gocrack:
_mkdir: cannot create directory ‘/home/oper/code/golang/src/github.com/fireeye/gocrack/docker/dist/gocrack’: Permission denied
Makefile:31: recipe for target 'gocrack' failed
make: *** [gocrack] Error 1_

So I change the permissions of the dist directory and tried again **make gocrack**.
The docker build command works but the docker run fails:
_docker run --rm --net=host -e USER_ID=1000 \
-v /home/oper/code/golang/src/github.com/fireeye/gocrack/docker/dist/gocrack:/out \
-v /home/oper/code/golang/src/github.com/fireeye/gocrack:/go/src/github.com/fireeye/gocrack \
gocrack/build
mkdir -p builds/
go build -tags """" -o /out/gocrack_worker -ldflags \
"-X github.com/fireeye/gocrack/worker.CompileRev=dc14ad5 \
-X github.com/fireeye/gocrack/worker.CompileTime=1523610442 \
-X github.com/fireeye/gocrack/worker/engines/hashcat.HashcatVersion=v3.6.0" \
cmd/gocrack_worker/*.go
go: disabling cache (/home/build/.cache/go-build) due to initialization failure: mkdir /home/build: permission denied
go build -tags """" -o /out/gocrack_server -ldflags \
"-X github.com/fireeye/gocrack/server.CompileRev=dc14ad5 \
-X github.com/fireeye/gocrack/server.CompileTime=1523610442" \
cmd/gocrack_server/*.go
go: disabling cache (/home/build/.cache/go-build) due to initialization failure: mkdir /home/build: permission denied_

I modified the file Dockerfile.build.ubuntu in order to add _--create-home_ to _RUN useradd --non-unique --uid $USER_ID build_ and now make gocrack works properly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.