forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.bash
executable file
·102 lines (89 loc) · 3.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# setup.bash automates installing DefectDojo for the following install types:
#
# - Single server installs
# - Dev installs
# - Stand-alone server installs
# - Container Single server e.g. Docker
# - Container Stand-alone server install e.g. Docker
#
# The setup.bash and supported install methods are documented in depth at
# https://github.com/DefectDojo/django-DefectDojo/tree/master/entrypoint_scripts
#
# Not addressed:
# - Updates to a new version of DefectDojo
#
# Make sure setup.bash is run from the same directory it is located in
cd ${0%/*} # same as `cd "$(dirname "$0")"` without relying on dirname
REPO_BASE=`pwd`
# Set install config values and load the 'libraries' needed for install
LIB_PATH="$REPO_BASE/entrypoint_scripts/common"
. "$LIB_PATH/config-vars.sh" # Set install configuration default values
. "$LIB_PATH/cmd-args.sh" # Get command-line args and set config values as needed
. "$LIB_PATH/prompt.sh" # Prompt for config values if install is interactive
. "$LIB_PATH/common-os.sh" # Determine what OS the installer is running on
. "$LIB_PATH/install-dojo.sh" # Complete an install of Dojo based on previously run code
# Read command-line arguments, if any and set/override config defaults as needed
# Function in ./entrypoint_scripts/common/cmd-args.sh
read_cmd_args
# Prompt for config values if install is interactive - the default
# Function in ./entrypoint_scripts/common/prompt.sh
if [ "$PROMPT" = true ] ; then
prompt_for_config_vals
else
init_install_creds
fi
# Check for OS installer is running on and that python version is correct
# Funcions below in ./entrypoint-scripts/common/common-os.sh
check_install_os
# Bootstrap any programs needed specifically for the installer to run
bootstrap_install
check_python_version
# Do the install - broken into pieces by OS
# Functions below in ./entrypoint-scripts/common/install-dojo.sh
install_dojo
#echo "Blah is $BLAH"
#echo "DD_ENV is $DD_ENV"
echo ""
echo "DEBUG JUNK:"
echo "PROMPT is $PROMPT"
echo "====> "
echo "INSTALL_OS is $INSTALL_OS"
echo "INSTALL_DISTRO is $INSTALL_DISTRO"
echo "INSTALL_OS_VER is $INSTALL_OS_VER"
echo "DOJO_SOURCE is $DOJO_SOURCE"
echo ""
echo "DB_ROOT=$DB_ROOT"
echo "DB_PASS=$DB_PASS"
echo "DEV_DB_PASS=$DEV_DB_PASS"
echo "OS_PASS=$OS_PASS"
echo "DEV_OS_PASS=$DEV_OS_PASS"
echo "ADMIN_PASS=$ADMIN_PASS"
echo "DEV_ADMIN_PASS=$DEV_ADMIN_PASS"
echo "DB URL is:"
echo "$DD_DATABASE_URL"
echo "End of refactoring"
## Echo out important generated variables/passwords from this install
exit
#-----------------------[ Old stuff ]-----------------------#
# Install the actual application
install_app
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