Skip to content

Commit

Permalink
修改compose
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhiyi committed Mar 9, 2022
1 parent b7ddd5f commit 90edbe2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
21 changes: 21 additions & 0 deletions vulfocus-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3
LABEL maintainer="vulfocus" version="0.3.2.11" description="Vulfocus for Docker"

RUN mkdir /vulfocus-api/
WORKDIR /vulfocus-api/
ADD . /vulfocus-api/

ENV VUL_IP=""
ENV EMAIL_HOST=""
ENV EMAIL_HOST_USER=""
ENV EMAIL_HOST_PASSWORD=""
ENV DOCKER_URL="unix://var/run/docker.sock"


RUN python3 -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package -r requirements.txt

EXPOSE 8000

CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]

Binary file modified vulfocus-api/db.sqlite3
Binary file not shown.
12 changes: 8 additions & 4 deletions vulfocus-api/layout_image/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,8 @@ def upload_zip_file(request):
for single_network in docker_networks:
config_list = single_network.attrs['IPAM']['Config']
for single_config in config_list:
network_list.append(single_config["Gateway"].split(".")[0:2])
if "Gateway" in single_config:
network_list.append(single_config["Gateway"].split(".")[0:2])
if single_network.name == network_name:
network_name_temp = network_name
network_name = str(uuid.uuid4())
Expand Down Expand Up @@ -1392,7 +1393,8 @@ def upload_zip_file(request):
return JsonResponse({"code": 400, "msg": "编排环境中子网或者网关设置错误"})
net_work_client_id = str(net_work.id)
if not gateway:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
if "Gateway" in net_work.attrs['IPAM']['Config']:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
created_network = NetWorkInfo(net_work_id=str(uuid.uuid4()),
net_work_client_id=net_work_client_id,
create_user=user.id,
Expand Down Expand Up @@ -1646,7 +1648,8 @@ def download_official_website_layout(request):
for single_network in docker_networks:
config_list = single_network.attrs['IPAM']['Config']
for single_config in config_list:
network_list.append(single_config["Gateway"].split(".")[0:2])
if "Gateway" in single_config:
network_list.append(single_config["Gateway"].split(".")[0:2])
if single_network.name == network_name:
network_name_temp = network_name
network_name = str(uuid.uuid4())
Expand Down Expand Up @@ -1679,7 +1682,8 @@ def download_official_website_layout(request):
return JsonResponse({"code": 400, "msg": "编排环境中子网或者网关设置错误"})
net_work_client_id = str(net_work.id)
if not gateway:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
if "Gateway" in net_work.attrs['IPAM']['Config']:
gateway = net_work.attrs['IPAM']['Config']['Gateway']
created_network = NetWorkInfo(net_work_id=str(uuid.uuid4()),
net_work_client_id=net_work_client_id,
create_user=user.id,
Expand Down
22 changes: 16 additions & 6 deletions vulfocus-api/vulfocus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,28 @@
'notice',
]

# redis host
REDIS_HOST = "127.0.0.1"
REDIS_HOST = os.environ.get('REDIS_HOST')
if not REDIS_HOST or REDIS_HOST == '':
REDIS_HOST = "127.0.0.1"

# redis port
REDIS_PORT = 6379
REDIS_PORT = os.environ.get('REDIS_PORT')
if not REDIS_PORT or REDIS_PORT == '' or REDIS_PORT == 0:
REDIS_PORT = "6379"

# redis pass
REDIS_PASS = ""
REDIS_PASS = os.environ.get('REDIS_PASS')
if not REDIS_PASS or REDIS_PASS == '':
REDIS_PASS = ""

if REDIS_PASS:
CELERY_BROKER_URL = "redis://:%s@%s:%s/0" % (REDIS_PASS, str(REDIS_HOST), str(REDIS_PORT))
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, decode_responses=True, db=1)
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, decode_responses=True,
db=1)
else:
CELERY_BROKER_URL = 'redis://%s:%s/0' % (REDIS_HOST, str(REDIS_PORT))
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), decode_responses=True,db=1)
REDIS_POOL = redis.ConnectionPool(host=REDIS_HOST, port=int(REDIS_PORT), decode_responses=True, db=1)

if REDIS_PASS:
REDIS_IMG = redis.Redis(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, db=6, decode_responses=True)
REDIS_USER_CACHE = redis.Redis(host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASS, db=7, decode_responses=True)
Expand Down

0 comments on commit 90edbe2

Please sign in to comment.