@@ -165,8 +165,8 @@ func ubuntuInstPostgreSQLClient(id string, b *osCmds) {
165
165
b .id = id
166
166
b .cmds = []string {
167
167
"DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql-client-12" ,
168
- "/usr/sbin/groupadd -f postgres" ,
169
- "/usr/sbin/useradd -s /bin/bash -m -g postgres postgres" ,
168
+ "/usr/sbin/groupadd -f postgres" , // TODO: consider using os.Group.Lookup before calling this
169
+ "/usr/sbin/useradd -s /bin/bash -m -g postgres postgres" , // TODO: consider using os.User.Lookup before calling this
170
170
}
171
171
b .errmsg = []string {
172
172
"Unable to install PostgreSQL client" ,
@@ -276,10 +276,10 @@ func ubuntuOSPrep(id string, inst *config.InstallConfig, b *osCmds) {
276
276
b .cmds = []string {
277
277
"python3 -m virtualenv --python=/usr/bin/python3 " + inst .Root ,
278
278
inst .Root + "/bin/python3 -m pip install --upgrade pip" ,
279
- inst .Root + "/bin/pip3 install --use-deprecated=legacy-resolver - r " + inst .Root + "/django-DefectDojo/requirements.txt" ,
279
+ inst .Root + "/bin/pip3 install -r " + inst .Root + "/django-DefectDojo/requirements.txt" ,
280
280
"mkdir " + inst .Root + "/logs" ,
281
- "/usr/sbin/groupadd -f " + inst .OS .Group ,
282
- "id " + inst .OS .User + " &>/dev/null; if [ $? -ne 0 ]; then useradd -s /bin/bash -m -g " + inst .OS .Group + " " + inst .OS .User + "; fi" ,
281
+ "/usr/sbin/groupadd -f " + inst .OS .Group , // TODO: check with os.Group.Lookup
282
+ "id " + inst .OS .User + " &>/dev/null; if [ $? -ne 0 ]; then useradd -s /bin/bash -m -g " + inst .OS .Group + " " + inst .OS .User + "; fi" , // TODO: check with os.User.Lookup
283
283
"chown -R " + inst .OS .User + "." + inst .OS .Group + " " + inst .Root ,
284
284
}
285
285
b .errmsg = []string {
@@ -334,12 +334,18 @@ func ubuntuSetupDDjango(id string, inst *config.InstallConfig, b *osCmds) {
334
334
addCmd (b , "cd " + inst .Root + "/django-DefectDojo && source ../bin/activate && python3 manage.py migrate" ,
335
335
"Failed during database migrate" , true )
336
336
337
+ // Ensure there's a value for email as the call will fail without one
338
+ adminEmail := "default.user@defectdojo.org"
339
+ if len (inst .Admin .Email ) > 0 {
340
+ // If user configures an incorrect email, this will still fail but that's on them, not godojo
341
+ adminEmail = inst .Admin .Email
342
+ }
337
343
addCmd (b , "cd " + inst .Root + "/django-DefectDojo && source ../bin/activate && python3 manage.py createsuperuser --noinput --username=\" " +
338
- inst .Admin .User + "\" --email=\" " + inst . Admin . Email + "\" " ,
344
+ inst .Admin .User + "\" --email=\" " + adminEmail + "\" " ,
339
345
"Failed while creating DefectDojo superuser" , true )
340
346
341
347
addCmd (b , "cd " + inst .Root + "/django-DefectDojo && source ../bin/activate && " +
342
- inst .Root + "/django-DefectDojo/setup-superuser.expect " + inst .Admin .User + " " + inst .Admin .Pass ,
348
+ inst .Root + "/django-DefectDojo/setup-superuser.expect " + inst .Admin .User + " \" " + escSpCar ( inst .Admin .Pass ) + " \" " ,
343
349
"Failed while setting the password for the DefectDojo superuser" , true )
344
350
345
351
// Roles showed up in 2.x.x
0 commit comments