forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.bash
executable file
·82 lines (69 loc) · 2.49 KB
/
setup.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# setup.bash helps you installing DefectDojo in your current environment
#
# setup.bash covers the following cases (and types of environments):
# - Fresh installs on non-transient environments (physical or virtual OS)
# - Fresh installs on transient environment blueprints (containerized environments)
# - Fresh installs on transient VMs (Vagrant and the like)
# - Updates on non-transient environments
#
# Not (yet) addressed:
# - Updates for transient environments
#
echo
echo "Welcome to DefectDojo! This is a quick script to get you up and running."
echo
# Initialize variables and functions
source entrypoint_scripts/common/dojo-shared-resources.sh
# This function invocation ensures we're running the script at the right place
verify_cwd
# Allow script to be called non-interactively using:
# export AUTO_DOCKER=yes && /opt/django-DefectDojo/setup.bash
if [ "$AUTO_DOCKER" == "yes" ]; then
# Default to MySQL install
DBTYPE=$MYSQL
else
prompt_db_type
fi
echo
echo "NEED SUDO PRIVILEGES FOR NEXT STEPS!"
echo
echo "Attempting to install required packages..."
echo
# Install OS dependencies like DB client, further package managers, etc.
install_os_dependencies
# Install database-related packages
install_db
if [ "$AUTO_DOCKER" == "yes" ]; then
start_local_mysql_db_server
fi
# Create the application DB or recreate it, if it's already present
ensure_application_db
# Adjust the settings.py file
prepare_settings_file
# Ensure, we're running on a supported python version
verify_python_version
# Install the actual application
install_app
if [ "$AUTO_DOCKER" == "yes" ]; then
stop_local_mysql_db_server
fi
echo "=============================================================================="
echo
echo "SUCCESS! Now edit your settings.py file in the 'dojo/settings/' directory to complete the installation."
echo
echo "We suggest you consider changing the following defaults:"
echo
echo " DEBUG = True # you should set this to False when you are ready for production."
echo " Uncomment the following lines if you enabled SSL/TLS on your server:"
echo " SESSION_COOKIE_SECURE = True"
echo " CSRF_COOKIE_SECURE = True"
echo " SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')"
echo " SECURE_SSL_REDIRECT = True"
echo " SECURE_BROWSER_XSS_FILTER = True"
echo " django.middleware.security.SecurityMiddleware"
echo
echo "When you're ready to start the DefectDojo server, type in this directory:"
echo
echo " python manage.py runserver"
echo