diff --git a/Dockerfile b/Dockerfile index 2b25fa3..06b423c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,21 @@ FROM ubuntu:18.04 -LABEL version="Velociraptor v0.3.9" +LABEL version="Velociraptor v0.4.5" LABEL description="Velociraptor server in a Docker container" LABEL maintainer="Wes Lambert, @therealwlambert" -ENV VERSION="0.3.9" - +ENV VERSION="0.4.5" COPY ./entrypoint . RUN chmod +x entrypoint && \ apt-get update && \ apt-get install -y wget && \ - mkdir -p /velociraptor && \ - mkdir -p /velociraptor/clients/linux && \ - mkdir -p /velociraptor/clients/mac && \ - mkdir -p /velociraptor/clients/windows && \ - wget -O /velociraptor/velociraptor https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-linux-amd64 && \ - chmod +x /velociraptor/velociraptor && \ - cp /velociraptor/velociraptor /velociraptor/clients/linux/velociraptor_client && \ - wget -O /velociraptor/clients/mac/velociraptor_client https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-darwin-amd64 && \ - wget -O /velociraptor/clients/windows/velociraptor_client.exe https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-windows-amd64.exe && \ - chmod -R +x /velociraptor/clients && \ + # Create dirs for Velox binaries + mkdir -p /opt/velociraptor && \ + for i in linux mac windows; do mkdir -p /opt/velociraptor/$i; done && \ + # Get Velox binaries + wget -O /opt/velociraptor/linux/velociraptor https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-linux-amd64 && \ + wget -O /opt/velociraptor/mac/velociraptor_client https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-darwin-amd64 && \ + wget -O /opt/velociraptor/windows/velociraptor_client.exe https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-windows-amd64.exe && \ + # Clean up + apt-get remove -y --purge wget && \ apt-get clean WORKDIR /velociraptor CMD ["/entrypoint"] diff --git a/docker-compose.yaml b/docker-compose.yaml index fe83f7d..ab6700f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,11 +1,14 @@ version: '2' services: velox: - container_name: velociraptor + container_name: velox image: wlambert/velociraptor + #build: + # context: ./ + # dockerfile: Dockerfile volumes: - - ./velociraptor/:/velociraptor/:rw - - ./entrypoint:/entrypoint:ro + - ./velociraptor:/velociraptor/:rw + #- ./entrypoint:/entrypoint:ro ports: - "8000:8000" - "8889:8889" diff --git a/entrypoint b/entrypoint index d41dfcf..0b65141 100755 --- a/entrypoint +++ b/entrypoint @@ -1,22 +1,37 @@ #!/bin/bash -VERSION="0.3.9" +#VERSION="0.4.5" BIND_ADDRESS="0.0.0.0" PUBLIC_PATH="public" LOG_DIR="." -SERVER_URL="https://velociraptor:8000/" +SERVER_URL="https://VelociraptorServer:8000/" USER="admin" PASSWORD="admin" -DATASTORE_LOCATION="." -FILESTORE_DIRECTORY="." +ROLE="administrator" +DATASTORE_LOCATION="./" +FILESTORE_DIRECTORY="./" +CLIENT_DIR="/velociraptor/clients" +# Move binaries into place +cp /opt/velociraptor/linux/velociraptor . && chmod +x velociraptor +mkdir -p $CLIENT_DIR/linux && cp /opt/velociraptor/linux/velociraptor /velociraptor/clients/linux/velociraptor_client +mkdir -p $CLIENT_DIR/mac && mv /opt/velociraptor/mac/velociraptor_client /velociraptor/clients/mac/velociraptor_client +mkdir -p $CLIENT_DIR/windows && mv /opt/velociraptor/windows/velociraptor_client.exe /velociraptor/clients/windows/velociraptor_client.exe + +# If no existing server config, set it up if [ ! -f server.config.yaml ]; then - ./velociraptor config generate > server.config.yaml --merge '{"Frontend": {"public_path":"'$PUBLIC_PATH'"}, "API": { "bind_address": "'$BIND_ADDRESS'" }, "GUI": { "bind_address": "'$BIND_ADDRESS'"}, "Monitoring": {"bind_address": "'$BIND_ADDRESS'" }, "Logging": {"output_directory":"'$LOG_DIR'","separate_logs_per_component": true, "Client": { "server_urls": ["'$SERVER_URL'"]}, "Datastore": {"location": "'$DATASTORE_LOCATION'", "filestore_directory": "'$FILESTORE_DIRECTORY'"}}}' + ./velociraptor config generate > server.config.yaml --merge '{"Frontend":{"public_path":"'$PUBLIC_PATH'"},"API":{"bind_address":"'$BIND_ADDRESS'"},"GUI":{"bind_address":"'$BIND_ADDRESS'"},"Monitoring":{"bind_address":"'$BIND_ADDRESS'"},"Logging":{"output_directory":"'$LOG_DIR'","separate_logs_per_component":true},"Client":{"server_urls":["'$SERVER_URL'"],"use_self_signed_ssl":true}, "Datastore":{"location":"'$DATASTORE_LOCATION'", "filestore_directory":"'$FILESTORE_DIRECTORY'"}}' sed -i "s#https://localhost:8000/#$SERVER_URL#" server.config.yaml sed -i 's#/tmp/velociraptor#.#'g server.config.yaml - ./velociraptor --config server.config.yaml user add $USER $PASSWORD - ./velociraptor --config server.config.yaml config client > client.config.yaml - ./velociraptor config repack --exe clients/windows/velociraptor_client.exe client.config.yaml clients/windows/velociraptor_client_repacked.exe + ./velociraptor --config server.config.yaml user add $USER $PASSWORD --role $ROLE fi -cd /velociraptor -#/bin/bash + +# Re-generate client config in case server config changed +./velociraptor --config server.config.yaml config client > client.config.yaml + +# Repack clients +./velociraptor config repack --exe clients/linux/velociraptor_client client.config.yaml clients/linux/velociraptor_client_repacked +./velociraptor config repack --exe clients/mac/velociraptor_client client.config.yaml clients/mac/velociraptor_client_repacked +./velociraptor config repack --exe clients/windows/velociraptor_client.exe client.config.yaml clients/windows/velociraptor_client_repacked.exe + +# Start Velocoraptor ./velociraptor --config server.config.yaml frontend -v