gocrack icon indicating copy to clipboard operation
gocrack copied to clipboard

Docker Build Process is Difficult/Doesn't Work Properly

Open festanie opened this issue 7 years ago • 10 comments

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.

festanie avatar Apr 13 '18 09:04 festanie

@festanie it works for you?

I-Iugo avatar May 17 '18 16:05 I-Iugo

The builds worked but then I didn't manage to understand how to configure everything and I stopped there because of alack of time.

festanie avatar May 17 '18 17:05 festanie

Ok thanks, I was able to configure and launch. But I had to customize worker Dockerfile with this

I-Iugo avatar May 28 '18 11:05 I-Iugo

Sorry for the docker problems... It's just me on this project within the Company and I've had other duties in between this release and now. Q3 (starting monday) I should have some time to fix a lot of these pains when dealing with docker so stay tuned.

tankbusta avatar Jun 29 '18 15:06 tankbusta

Tankbusta,

I've attempted to try all the steps, and still not able to successfully run (Make gocrack). Any thoughts, oh give me an address send you a case of beer.

Removing intermediate container 77f80ec9108f Successfully built 1dbe4079b4ad docker run --rm --net=host -e USER_ID=0
-v /home/repo/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

huwilerp avatar Jul 02 '18 03:07 huwilerp

@huwilerp yeah,i met the same problem. It seems a bug.

rsj123 avatar Jul 11 '18 07:07 rsj123

@tankbusta Hey Brother, I know you are busy and your're doing a awesome job with this project.. Just curious if you could throw some ideas out to get this running... Should I pull a previous version?

huwilerp avatar Jul 31 '18 00:07 huwilerp

@huwilerp Looks like you haven't set Golang Paths. Also use "go get". Also Referenced here #43

install go and setup path

export GOROOT=$HOME/go1.X
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/go
go get github.com/fireeye/gocrack
cd ~/go/src/github.com/fireeye/gocrack/docker
make build

0xIn7rud3r avatar Aug 06 '18 02:08 0xIn7rud3r

@0xIn7rud3r I tired this way,but it semms not helpful,it still doesn't work.

rsj123 avatar Aug 13 '18 14:08 rsj123