This repository has been archived by the owner on Mar 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working on getting a local docker env
- Loading branch information
1 parent
0febeee
commit b879788
Showing
29 changed files
with
285 additions
and
719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.117.1/containers/docker-existing-docker-compose | ||
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. | ||
{ | ||
"name": "ACE", | ||
|
||
// Update the 'dockerComposeFile' list if you have more compose files or use different names. | ||
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. | ||
"dockerComposeFile": [ | ||
"..\\docker-compose-dev.yml" | ||
], | ||
|
||
// The 'service' property is the name of the service for the container that VS Code should | ||
// use. Update this value and .devcontainer/docker-compose.yml to the real service name. | ||
"service": "ace", | ||
|
||
// The optional 'workspaceFolder' property is the path VS Code should open by default when | ||
// connected. This is typically a file mount in .devcontainer/docker-compose.yml | ||
"workspaceFolder": "/opt/ace", | ||
|
||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"terminal.integrated.shell.linux": null | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [] | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Uncomment the next line if you want start specific services in your Docker Compose config. | ||
// "runServices": [], | ||
|
||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down. | ||
// "shutdownAction": "none", | ||
|
||
// Uncomment the next line to run commands after the container is created - for example installing git. | ||
// "postCreateCommand": "apt-get update && apt-get install -y git", | ||
|
||
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. | ||
// "remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM python:3.8-buster | ||
ENV SAQ_HOME /opt/ace | ||
ENV SAQ_USER ace | ||
ENV SAQ_GROUP ace | ||
ENV TZ UTC | ||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN groupadd ace \ | ||
&& useradd -g ace -G sudo -m -s /bin/bash ace \ | ||
&& sed -i -e 's/main$/main contrib non-free/g' /etc/apt/sources.list \ | ||
&& apt -y update \ | ||
&& apt -y install --no-install-recommends apt-utils \ | ||
&& mkdir -p /usr/share/man/man1/ \ | ||
&& apt -y install --no-install-recommends \ | ||
nmap \ | ||
libldap2-dev \ | ||
libsasl2-dev \ | ||
libffi-dev \ | ||
libimage-exiftool-perl \ | ||
p7zip-full \ | ||
p7zip-rar \ | ||
unzip \ | ||
zip \ | ||
unrar \ | ||
unace-nonfree \ | ||
libxml2-dev libxslt1-dev \ | ||
libyaml-dev \ | ||
ssdeep \ | ||
poppler-utils \ | ||
rng-tools \ | ||
wireshark-common \ | ||
build-essential \ | ||
file \ | ||
less \ | ||
nginx \ | ||
default-jre \ | ||
bsdmainutils \ | ||
node-esprima \ | ||
python2.7 \ | ||
python-pip \ | ||
&& mkdir /opt/signatures \ | ||
&& chown ace:ace /opt/signatures \ | ||
&& mkdir /opt/ace \ | ||
&& chown ace:ace /opt/ace \ | ||
&& python3 -m pip install pip virtualenv --upgrade \ | ||
&& python2.7 -m pip install officeparser | ||
SHELL ["/bin/bash", "-c"] | ||
USER ace | ||
COPY --chown=ace:ace installer/requirements-3.6.txt /home/ace/python-requirements-3.6.txt | ||
RUN python3 -m virtualenv --python=python3 /home/ace/venv && source /home/ace/venv/bin/activate && python3 -m pip install -r /home/ace/python-requirements-3.6.txt | ||
RUN echo 'source /home/ace/venv/bin/activate' >> /home/ace/.bashrc | ||
RUN echo 'export PATH="$PATH:/opt/ace/bin:/opt/ace"' >> /home/ace/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM ace-base:latest | ||
USER root | ||
RUN apt -y install git | ||
USER ace | ||
WORKDIR /opt/ace | ||
VOLUME [ "/opt/ace", "/opt/ace/data" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ace-base:latest | ||
USER ace | ||
WORKDIR /opt/ace | ||
COPY --chown=ace:ace . /opt/ace | ||
# TODO get rid of this ace-ssl image somehow | ||
COPY --from=ace-ssl:latest --chown=ace:ace /ssl /opt/ace/ssl | ||
RUN docker/provision/ace/install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os.path | ||
import random | ||
import string | ||
|
||
def main(): | ||
user_password = ''.join(random.choices(string.ascii_letters, k=random.randint(23, 32))) | ||
target_path = os.path.join('sql', 'templates', 'create_db_user.sql') | ||
with open(target_path, 'r') as fp_in: | ||
sql = fp_in.read().replace('ACE_DB_USER_PASSWORD', user_password) | ||
with open(os.path.join('sql', '70-create-db-user.sql'), 'w') as fp: | ||
fp.write(sql) | ||
|
||
print(f"created {target_path}") | ||
|
||
target_path = os.path.join('docker', 'provision', 'ace', 'etc', 'mysql_defaults') | ||
with open(target_path, 'w') as fp: | ||
fp.write(f"""[client] | ||
host=localhost | ||
user=ace-user | ||
password={user_password}""") | ||
|
||
print(f"created {target_path}") | ||
|
||
admin_password = ''.join(random.choices(string.ascii_letters, k=random.randint(23, 32))) | ||
target_path = os.path.join('sql', 'templates', 'create_db_super_user.sql') | ||
with open(target_path, 'r') as fp_in: | ||
sql = fp_in.read().replace('ACE_SUPERUSER_DB_USER_PASSWORD', admin_password) | ||
with open(os.path.join('sql', '71-create-db-super-user.sql'), 'w') as fp: | ||
fp.write(sql) | ||
|
||
print(f"created {target_path}") | ||
|
||
target_path = os.path.join('docker', 'provision', 'ace', 'etc', 'mysql_defaults.root') | ||
with open(target_path, 'w') as fp: | ||
fp.write(f"""[client] | ||
host=localhost | ||
user=ace-superuser | ||
password={admin_password}""") | ||
|
||
print(f"created {target_path}") | ||
|
||
target_path = os.path.join('docker', 'provision', 'ace', 'etc', 'saq.docker.passwords.ini') | ||
with open(target_path, 'w') as fp: | ||
fp.write(f""" | ||
[database_ace] | ||
password = {user_password} | ||
[database_collection] | ||
password = {user_password} | ||
[database_email_archive] | ||
password = {user_password} | ||
[database_brocess] | ||
password = {user_password} | ||
[database_vt_hash_cache] | ||
password = {user_password}""") | ||
|
||
print(f"created {target_path}") | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
docker image build -f Dockerfile.ssl -t ace-ssl:latest . | ||
docker image build -f Dockerfile.ace-base -t ace-base:latest . | ||
docker image build -f Dockerfile.ace-dev -t ace-dev:latest . | ||
docker image build -f Dockerfile.ace-prod -t ace-prod:latest . | ||
docker image build -f Dockerfile.nginx -t ace-nginx:latest . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker run -it -u ace --rm --network ace_default --mount "type=bind,source=$(pwd),target=/opt/ace" ace-dev:latest /bin/bash -il |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker run -it -u ace --rm --network ace_default --mount source=ace-data,target=/opt/ace/data ace-prod:latest /bin/bash -il |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
version: '3.4' | ||
services: | ||
ace-db: | ||
image: mysql:5.7 | ||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_520_ci | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 'ace' | ||
expose: | ||
- '3306' | ||
volumes: | ||
- ace-db-volume:/var/lib/mysql | ||
- ./sql:/docker-entrypoint-initdb.d | ||
hostname: ace-db | ||
|
||
ace: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.ace-dev | ||
image: ace-dev:latest | ||
depends_on: | ||
- ace-db | ||
command: /bin/sh -c "while sleep 1000; do :; done" | ||
restart: always | ||
volumes: | ||
- .:/opt/ace | ||
- ace-data-volume:/opt/ace/data | ||
#- ./aceapi:/opt/ace/aceapi | ||
#- ./app:/opt/ace/app | ||
#- ./bin:/opt/ace/bin | ||
#- ./bro:/opt/ace/bro | ||
#- ./cron:/opt/ace/cron | ||
#- ./docker:/opt/ace/docker | ||
#- ./documentation:/opt/ace/documentation | ||
#- ./etc:/opt/ace/etc | ||
#- ./hunts:/opt/ace/hunts | ||
#- ./installer:/opt/ace/installer | ||
#- ./saq:/opt/ace/saq | ||
#- ./sql:/opt/ace/sql | ||
#- ./ssl:/opt/ace/ssl | ||
#- ./test_data:/opt/ace/test_data | ||
#- ./tests:/opt/ace/tests | ||
hostname: ace | ||
volumes: | ||
ace-data-volume: | ||
name: ace-data-dev | ||
|
||
ace-db-volume: | ||
name: ace-db-dev | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.