зеркало из https://github.com/mozilla/MozDef.git
Merge pull request #1432 from mozilla/create_scripts_directory
Create scripts directory
This commit is contained in:
Коммит
4ab891acad
|
@ -49,7 +49,7 @@ services:
|
||||||
max-size: "10m"
|
max-size: "10m"
|
||||||
env_file:
|
env_file:
|
||||||
- cloudy_mozdef.env
|
- cloudy_mozdef.env
|
||||||
command: bash -c 'python initial_setup.py http://elasticsearch:9200 cron/defaultMappingTemplate.json cron/mozdefStateDefaultMappingTemplate.json cron/backup.conf http://kibana:5601'
|
command: bash -c 'python initial_setup.py http://elasticsearch:9200 http://kibana:5601'
|
||||||
depends_on:
|
depends_on:
|
||||||
- base
|
- base
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -130,7 +130,7 @@ services:
|
||||||
cache_from:
|
cache_from:
|
||||||
- mozdef/mozdef_bootstrap
|
- mozdef/mozdef_bootstrap
|
||||||
- mozdef_bootstrap:latest
|
- mozdef_bootstrap:latest
|
||||||
command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && python initial_setup.py http://elasticsearch:9200 cron/defaultMappingTemplate.json cron/mozdefStateDefaultMappingTemplate.json cron/backup.conf http://kibana:5601'
|
command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && python initial_setup.py http://elasticsearch:9200 http://kibana:5601'
|
||||||
depends_on:
|
depends_on:
|
||||||
- base
|
- base
|
||||||
- elasticsearch
|
- elasticsearch
|
||||||
|
|
|
@ -2,7 +2,7 @@ FROM centos:7
|
||||||
|
|
||||||
LABEL maintainer="mozdef@mozilla.com"
|
LABEL maintainer="mozdef@mozilla.com"
|
||||||
|
|
||||||
# When changing the kibana version, we'll need to update https://github.com/mozilla/MozDef/blob/master/docker/compose/mozdef_bootstrap/files/initial_setup.py accordingly
|
# When changing the kibana version, we'll need to update https://github.com/mozilla/MozDef/blob/master/scripts/setup/initial_setup.py accordingly
|
||||||
ENV KIBANA_VERSION 6.8.0
|
ENV KIBANA_VERSION 6.8.0
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
|
|
|
@ -7,10 +7,9 @@ RUN install --owner mozdef --group mozdef --directory /opt/mozdef/envs/mozdef/do
|
||||||
COPY --chown=mozdef:mozdef cron/mozdefStateDefaultMappingTemplate.json /opt/mozdef/envs/mozdef/cron/mozdefStateDefaultMappingTemplate.json
|
COPY --chown=mozdef:mozdef cron/mozdefStateDefaultMappingTemplate.json /opt/mozdef/envs/mozdef/cron/mozdefStateDefaultMappingTemplate.json
|
||||||
COPY --chown=mozdef:mozdef cron/defaultMappingTemplate.json /opt/mozdef/envs/mozdef/cron/defaultMappingTemplate.json
|
COPY --chown=mozdef:mozdef cron/defaultMappingTemplate.json /opt/mozdef/envs/mozdef/cron/defaultMappingTemplate.json
|
||||||
COPY --chown=mozdef:mozdef docker/compose/mozdef_cron/files/backup.conf /opt/mozdef/envs/mozdef/cron/backup.conf
|
COPY --chown=mozdef:mozdef docker/compose/mozdef_cron/files/backup.conf /opt/mozdef/envs/mozdef/cron/backup.conf
|
||||||
COPY --chown=mozdef:mozdef docker/compose/mozdef_bootstrap/files/initial_setup.py /opt/mozdef/envs/mozdef/initial_setup.py
|
|
||||||
COPY --chown=mozdef:mozdef docker/compose/mozdef_bootstrap/files/index_mappings /opt/mozdef/envs/mozdef/index_mappings
|
|
||||||
COPY --chown=mozdef:mozdef docker/compose/mozdef_bootstrap/files/resources /opt/mozdef/envs/mozdef/resources
|
|
||||||
|
|
||||||
WORKDIR /opt/mozdef/envs/mozdef
|
COPY --chown=mozdef:mozdef scripts/setup /opt/mozdef/envs/mozdef/scripts/setup
|
||||||
|
|
||||||
|
WORKDIR /opt/mozdef/envs/mozdef/scripts/setup
|
||||||
|
|
||||||
USER mozdef
|
USER mozdef
|
||||||
|
|
|
@ -11,7 +11,6 @@ from datetime import datetime, timedelta
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from configlib import getConfig
|
from configlib import getConfig
|
||||||
import json
|
import json
|
||||||
import time
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -20,12 +19,35 @@ import requests
|
||||||
|
|
||||||
from mozdef_util.elasticsearch_client import ElasticsearchClient
|
from mozdef_util.elasticsearch_client import ElasticsearchClient
|
||||||
|
|
||||||
|
cron_dir_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../cron')
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Create the correct indexes and aliases in elasticsearch')
|
parser = argparse.ArgumentParser(description='Create the correct indexes and aliases in elasticsearch')
|
||||||
parser.add_argument('esserver', help='Elasticsearch server (ex: http://elasticsearch:9200)')
|
parser.add_argument('esserver', help='Elasticsearch server (ex: http://elasticsearch:9200)')
|
||||||
parser.add_argument('default_mapping_file', help='The relative path to default mapping json file (ex: cron/defaultMappingTemplate.json)')
|
|
||||||
parser.add_argument('state_mapping_file', help='The relative path to state mapping json file (ex: cron/mozdefStateDefaultMappingTemplate.json)')
|
default_file = os.path.realpath(cron_dir_path + '/defaultMappingTemplate.json')
|
||||||
parser.add_argument('backup_conf_file', help='The relative path to backup.conf file (ex: cron/backup.conf)')
|
parser.add_argument(
|
||||||
|
'default_mapping_file',
|
||||||
|
help='The relative path to default mapping json file (default: {0})'.format(default_file),
|
||||||
|
default=default_file,
|
||||||
|
nargs='?'
|
||||||
|
)
|
||||||
|
|
||||||
|
default_file = os.path.realpath(cron_dir_path + '/mozdefStateDefaultMappingTemplate.json')
|
||||||
|
parser.add_argument(
|
||||||
|
'state_mapping_file',
|
||||||
|
help='The relative path to state mapping json file (default: {0})'.format(default_file),
|
||||||
|
default=default_file,
|
||||||
|
nargs='?'
|
||||||
|
)
|
||||||
|
|
||||||
|
default_file = os.path.realpath(cron_dir_path + '/backup.json')
|
||||||
|
parser.add_argument(
|
||||||
|
'backup_conf_file',
|
||||||
|
help='The relative path to backup.conf file (default: {0})'.format(default_file),
|
||||||
|
default=default_file,
|
||||||
|
nargs='?'
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument('kibana_url', help='The URL of the kibana endpoint (ex: http://kibana:5601)')
|
parser.add_argument('kibana_url', help='The URL of the kibana endpoint (ex: http://kibana:5601)')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -189,7 +211,7 @@ if kibana_index_name in client.get_indices():
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Create visualizations/dashboards
|
# Create visualizations/dashboards
|
||||||
dashboards_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'resources')
|
dashboards_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'example_resources')
|
||||||
listing = os.listdir(dashboards_path)
|
listing = os.listdir(dashboards_path)
|
||||||
for infile in listing:
|
for infile in listing:
|
||||||
json_file_path = os.path.join(dashboards_path, infile)
|
json_file_path = os.path.join(dashboards_path, infile)
|
Загрузка…
Ссылка в новой задаче