forked from Patrowl/PatrowlManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker-compose PatrowlManager Backend
- Loading branch information
Showing
14 changed files
with
453 additions
and
58 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,10 @@ | ||
.DS_Store | ||
app/settings.py | ||
var/log/*.log | ||
var/log/*.log.[0-9]* | ||
var/tmp/*.pid | ||
**/migrations/[0-9]*.py | ||
media/* | ||
*.pyc | ||
__pycache__ | ||
env |
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 |
---|---|---|
|
@@ -12,6 +12,5 @@ media/policies/* | |
media/reports/* | ||
var/tmp/db.json | ||
**/migrations/[0-9]*.py | ||
.idea | ||
.scannerwork | ||
staticfiles |
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 |
---|---|---|
@@ -1,10 +1,19 @@ | ||
FROM python:2.7 | ||
#FROM python:2.7-slim | ||
ENV PYTHONUNBUFFERED 1 | ||
RUN mkdir -p /opt/patrowl-manager/ | ||
WORKDIR /opt/patrowl-manager/ | ||
COPY . /opt/patrowl-manager/ | ||
RUN pip install -r requirements.txt | ||
RUN python manage.py collectstatic --no-input | ||
COPY app/settings.py.sample /opt/patrowl-manager/app/settings.py | ||
|
||
RUN apt-get update -yq | ||
RUN apt-get install -yq --no-install-recommends virtualenv python-pip libmagic-dev | ||
RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
RUN virtualenv env | ||
RUN /bin/bash -c "source env/bin/activate && pip install -r requirements.txt && deactivate" | ||
|
||
EXPOSE 8001 | ||
CMD ["gunicorn", "--bind", ":8000", "app.wsgi:application"] | ||
ENTRYPOINT ["/opt/patrowl-manager/docker-entrypoint.sh"] | ||
CMD ["run"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# Collect static filesdd | ||
# echo "Collect static files" | ||
# python manage.py collectstatic --noinput | ||
source env/bin/activate | ||
|
||
# Collect static files | ||
echo "[+] Collect static files" | ||
python manage.py collectstatic --noinput | ||
|
||
# Apply database migrations | ||
echo "Make database migrations" | ||
echo "[+] Make database migrations" | ||
python manage.py makemigrations | ||
|
||
# Apply database migrations | ||
echo "Apply database migrations" | ||
echo "[+] Apply database migrations" | ||
python manage.py migrate | ||
|
||
# Create the default admin user | ||
echo "[+] Create the default admin user" | ||
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@dev.patrowl.io', 'Bonjour1!')" | python manage.py shell | ||
|
||
# Populate the db with default data | ||
echo "[+] Populate the db with default data" | ||
python manage.py loaddata var/data/assets.AssetCategory.json | ||
python manage.py loaddata var/data/engines.Engine.json | ||
python manage.py loaddata var/data/engines.EnginePolicyScope.json | ||
python manage.py loaddata var/data/engines.EnginePolicy.json | ||
|
||
# Start Supervisord (Celery workers) | ||
echo "[+] Start Supervisord (Celery workers)" | ||
supervisord -c var/etc/supervisord.conf | ||
|
||
# Start server | ||
# echo "Starting server" | ||
# python manage.py runserver 0.0.0.0:8000 | ||
echo "[+] Starting server" | ||
#python manage.py runserver 0.0.0.0:8001 | ||
gunicorn -b :8001 app.wsgi:application |
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,21 @@ | ||
server { | ||
listen 80; | ||
autoindex on; | ||
server_name localhost; | ||
|
||
#root .; | ||
|
||
access_log /opt/patrowl-manager/var/log/nginx.patrowlmanager-access.log; | ||
error_log /opt/patrowl-manager/var/log/nginx.patrowlmanager-error.log; | ||
|
||
location / { | ||
proxy_pass http://127.0.0.1:8000; | ||
} | ||
|
||
location /static { | ||
alias /opt/patrowl-manager/staticfiles; | ||
} | ||
location /media { | ||
alias /opt/patrowl-manager/media; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,2 +1,101 @@ | ||
/Users/nicolas/Documents/Projets/Patrowl/tmp | ||
[{"model": "engines.engine", "pk": 1, "fields": {"name": "NMAP", "description": "nmap", "allowed_asset_types": "[u'ip']", "created_at": "2017-07-09T18:41:41.473", "updated_at": "2017-07-09T18:41:41.473"}}, {"model": "engines.engine", "pk": 2, "fields": {"name": "NESSUS", "description": "ed", "allowed_asset_types": "[u'ip', u'fqdn', u'domain']", "created_at": "2017-07-12T21:57:30.467", "updated_at": "2017-07-12T21:57:30.467"}}, {"model": "engines.engine", "pk": 3, "fields": {"name": "ARACHNI", "description": "ARACHNI", "allowed_asset_types": "[u'url']", "created_at": "2017-07-16T10:49:16.107", "updated_at": "2017-07-23T14:42:44.202"}}, {"model": "engines.engine", "pk": 4, "fields": {"name": "VIRUSTOTAL", "description": "VT", "allowed_asset_types": "[u'ip', u'fqdn', u'domain', u'url']", "created_at": "2017-07-27T12:39:08.453", "updated_at": "2017-07-27T12:39:08.453"}}, {"model": "engines.engine", "pk": 5, "fields": {"name": "OWL_DNS", "description": "dns", "allowed_asset_types": "[u'ip', u'fqdn', u'domain']", "created_at": "2017-07-27T12:39:30.935", "updated_at": "2017-07-27T12:39:30.936"}}, {"model": "engines.engine", "pk": 6, "fields": {"name": "SSLLABS", "description": "SSLLABS", "allowed_asset_types": "[u'ip', u'fqdn', u'domain', u'url']", "created_at": "2017-07-27T12:39:48.520", "updated_at": "2017-07-27T12:39:48.520"}}, {"model": "engines.engine", "pk": 7, "fields": {"name": "URLVOID", "description": "URLVOID", "allowed_asset_types": "[u'url']", "created_at": "2017-07-27T12:40:10.816", "updated_at": "2017-07-27T12:40:10.816"}}, {"model": "engines.engine", "pk": 8, "fields": {"name": "CORTEX", "description": "CORTEX", "allowed_asset_types": "[u'ip', u'fqdn', u'domain', u'url']", "created_at": "2017-07-27T12:40:10.816", "updated_at": "2017-07-27T12:40:10.816"}}, {"model": "engines.engine", "pk": 9, "fields": {"name": "OWL_CODE", "description": "OWL_CODE", "allowed_asset_types": "[u'url', u'path']", "created_at": "2018-10-03T09:45:53.228", "updated_at": "2018-10-03T09:45:53.228"}}, {"model": "engines.engine", "pk": 10, "fields": {"name": "OWL_LEAKS", "description": "OWL_LEAKS", "allowed_asset_types": "[u'ip', u'ip-subnet', u'fqdn', u'domain', u'url', u'keyword', u'person']", "created_at": "2018-10-03T09:46:28.228", "updated_at": "2018-10-03T09:46:28.228"}}] | ||
[{ | ||
"model": "engines.engine", | ||
"pk": 1, | ||
"fields": { | ||
"name": "NMAP", | ||
"description": "nmap", | ||
"allowed_asset_types": "[u'ip']", | ||
"created_at": "2017-07-09T18:41:41.473", | ||
"updated_at": "2017-07-09T18:41:41.473" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 2, | ||
"fields": { | ||
"name": "NESSUS", | ||
"description": "ed", | ||
"allowed_asset_types": "[u'ip', u'fqdn', u'domain']", | ||
"created_at": "2017-07-12T21:57:30.467", | ||
"updated_at": "2017-07-12T21:57:30.467" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 3, | ||
"fields": { | ||
"name": "ARACHNI", | ||
"description": "ARACHNI", | ||
"allowed_asset_types": "[u'url']", | ||
"created_at": "2017-07-16T10:49:16.107", | ||
"updated_at": "2017-07-23T14:42:44.202" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 4, | ||
"fields": { | ||
"name": "VIRUSTOTAL", | ||
"description": "VT", | ||
"allowed_asset_types": "[u'ip', u'fqdn', u'domain', u'url']", | ||
"created_at": "2017-07-27T12:39:08.453", | ||
"updated_at": "2017-07-27T12:39:08.453" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 5, | ||
"fields": { | ||
"name": "OWL_DNS", | ||
"description": "dns", | ||
"allowed_asset_types": "[u'ip', u'fqdn', u'domain']", | ||
"created_at": "2017-07-27T12:39:30.935", | ||
"updated_at": "2017-07-27T12:39:30.936" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 6, | ||
"fields": { | ||
"name": "SSLLABS", | ||
"description": "SSLLABS", | ||
"allowed_asset_types": "[u'ip', u'fqdn', u'domain', u'url']", | ||
"created_at": "2017-07-27T12:39:48.520", | ||
"updated_at": "2017-07-27T12:39:48.520" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 7, | ||
"fields": { | ||
"name": "URLVOID", | ||
"description": "URLVOID", | ||
"allowed_asset_types": "[u'url']", | ||
"created_at": "2017-07-27T12:40:10.816", | ||
"updated_at": "2017-07-27T12:40:10.816" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 8, | ||
"fields": { | ||
"name": "CORTEX", | ||
"description": "CORTEX", | ||
"allowed_asset_types": "[u'ip', u'fqdn', u'domain', u'url']", | ||
"created_at": "2017-07-27T12:40:10.816", | ||
"updated_at": "2017-07-27T12:40:10.816" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 9, | ||
"fields": { | ||
"name": "OWL_CODE", | ||
"description": "OWL_CODE", | ||
"allowed_asset_types": "[u'url', u'path']", | ||
"created_at": "2018-10-03T09:45:53.228", | ||
"updated_at": "2018-10-03T09:45:53.228" | ||
} | ||
}, { | ||
"model": "engines.engine", | ||
"pk": 10, | ||
"fields": { | ||
"name": "OWL_LEAKS", | ||
"description": "OWL_LEAKS", | ||
"allowed_asset_types": "[u'ip', u'ip-subnet', u'fqdn', u'domain', u'url', u'keyword', u'person']", | ||
"created_at": "2018-10-03T09:46:28.228", | ||
"updated_at": "2018-10-03T09:46:28.228" | ||
} | ||
}] |
Oops, something went wrong.