mandiant / gocrack

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

Docker `make build` fails #25

Closed Meatballs1 closed 6 years ago

Meatballs1 commented 6 years ago

Theres a few of errors starting at:

docker run --rm --net=host -e USER_ID=1000 \
                -v /home/benc/go/src/github.com/fireeye/gocrack/docker/dist/hashcat:/out \
                gocrack/hashcat_shared
/bin/sh: 1: git: not found

Fixed by adding git to the dockerfile apt-get install.

Then:

docker run --rm --net=host -e USER_ID=1000 \
                -v /home/benc/go/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
install: cannot create directory '/out/share': Permission denied
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
src/Makefile:328: recipe for target 'install_docs' failed
make: *** [install_docs] Error 1
make: *** Waiting for unfinished jobs....
install: cannot create directory '/out/share': Permission denied
make: *** [install_shared] Error 1
src/Makefile:358: recipe for target 'install_shared' failed

Permissions on dist appear to be created with root ? Chowned that back to my user (1000).

I also get some additional errors but I think that is due to UMASK 027

Meatballs1 commented 6 years ago

There is some details on running here https://github.com/fireeye/gocrack/blob/master/docs/administrator/docker.md, but doesn't appear correct as it doesn't map to /opt/gocrack etc.

Adding user `gocrack' ...
Adding new group `gocrack' (1000) ...
Adding new user `gocrack' (1000) with group `gocrack' ...
Creating home directory `/home/gocrack' ...
Copying files from `/etc/skel' ...
/usr/local/bin/entrypoint.sh: line 4: cd: /opt/gocrack/: No such file or directory
{"time":"2018-01-11T12:31:15Z","level":"fatal","error":"open /opt/gocrack/config.yaml: no such file or directory","message":"Failed to load configuration file"}
tankbusta commented 6 years ago

When you say you added apt-get install to the Dockerfile, which one? It's located here. You should also have git installed on your local host as the Makefile does a checkout of the hashcat code there.

Regarding the directory issue - you are correct. The runscripts for the docker container are expecting a config in /opt/gocrack/config.yaml but the documentation says /var/lib/gocrack - I'll go ahead and update the documentation to fix that.

Regarding the permissions/user issue... when a docker container drops files, they're usually owned by root hence why the documentation tells you to pass -e USER_ID=$(echo "$UID") when you create a container so that the container can create a gocrack user within the container that has the same UID as the user you're running as.

Meatballs1 commented 6 years ago

git is missing from https://github.com/fireeye/gocrack/blob/master/docker/Dockerfile.hashcat.ubuntu - The hashcat makefile calls out to git

tankbusta commented 6 years ago

Git has now been added to the Hashcat Build Container