Applies To
Scans initiated in Docker-based HawkScan implementations.
Issue
When running HawkScan, the scan fails immediately with the following error:
General Configuration Error: No default configuration file (stackhawk.yml,stackhawk.yaml) found in /hawk"
Cause
Possible Causes:
1. stackhawk.yml is not present in the directory that the docker run command is being run from
2. Permissions issue with the directory containing stackhawk.yml
In the permissions scenario:
stackhawk.ymlis present in the directory that thedockercommand is run fromThe
$(pwd):/hawk:rwportion of the docker command is present (this is what maps the local directory and its contents (such asstackhawk.yml) into the container so that HawkScan can read the configuration)running
dockerwithsudodoesn’t fix the issuelaunching the container interactively (
docker run -v ${pwd}:/hawk:rw -it --entrypoint /bin/bash stackhawk/hawkscan:latest) and runningls /hawkresults in:cannot open directory '/hawk': Permission denied
Explanation:
/hawk is a directory within the HawkScan Docker container which inherits the permissions of the pwd directory that the docker command is called from.
zap is the user within the container that HawkScan runs as, and may not have sufficient permissions to access the /hawk directory as mapped from the Docker host if that host directory is too restricted.
If that directory has open permissions (for instance,
drwxr-xr-x), thezapuser can access the directoryIf that directory does not have sufficient permissions (for instance
rwx------), it will be mapped into the container but thezapuser thathawkruns as won't be able to access it
Example (RHEL 8 environment):
Too restrictive:
stackhawk.ymlin the top level of the user's home directory:ls -ld /homedrwx------. 4 1443803177 1443800513 194 Jun 7 15:07 user
Sufficient permissions:
stackhawk.ymlin a subdirectory (/hawk) under the user's home directory:ls -ld /home/userdrwxr-xr-x. 2 1443803177 1443800513 27 Jun 8 09:26 hawk
3. Wrong directory is mapped into the Docker volume (/hawk)
In this scenario, the wrong directory is named in docker run's -v option.
Typically, the current working directory is specified and the docker run command is run from that directory:
linux/MacOS:
-v $(pwd):/hawk:rwWindows:
Powershell:
-v ${PWD}:/hawk:rw
If a different value is specified (e.g., an absolute path to a directory that doesn't contain stackhawk.yml, or an environment variable that isn't populated correctly), Docker will fail to map the host directory containing stackhawk.yml into the /hawk directory within the container, resulting in the error.
Solution
Place
stackhawk.ymlin a directory with sufficient permissions for thezapuser to access it whendockeris run from that directory.Run
docker runfrom that directory, using the appropriate volume mapping in thedocker runcommand
Notes:
Ideally, place
stackhawk.ymlin the root of the repository for the application in question, and rundocker runfrom there.Alternatively: install the HawkScan CLI, which runs locally without any Docker dependencies.
Additional Information
A similar error can occur when running the HawkScan CLI -- see 'No default configuration file' error when running the HawkScan CLI for details.
