mandiant / gocrack

GoCrack is a management frontend for password cracking tools written in Go
MIT License
1.12k stars 240 forks source link

Docker Build Process is Difficult/Doesn't Work Properly #44

Open festanie opened 6 years ago

festanie commented 6 years ago

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 USERID=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 $USERID build and now make gocrack works properly.

I-Iugo commented 6 years ago

@festanie it works for you?

festanie commented 6 years ago

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

I-Iugo commented 6 years ago

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

tankbusta commented 6 years ago

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.

huwilerp commented 6 years ago

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

rsj123 commented 6 years ago

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

huwilerp commented 6 years ago

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

0xIn7rud3r commented 6 years ago

@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
rsj123 commented 6 years ago

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

MonkeyCst commented 1 year ago

@rsj123 Hi dude, I'm facing the same problem right now, did you find any solution back in a day ?