Skip to content

Commit 93d91bb

Browse files
Merge branch 'dev' into reimport_fix_available
2 parents e7e12a4 + 1df2832 commit 93d91bb

3 files changed

Lines changed: 32 additions & 13 deletions

File tree

docs/content/en/open_source/ldap-authentication.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ weight: 4
77

88
## LDAP Authentication
99

10-
Out of the box Defect Dojo does not support LDAP authentication.
10+
Out of the box DefectDojo does not support LDAP authentication.
1111

12-
*However*, since Defect Dojo is built using Django, it isn't too difficult to add support for LDAP.
12+
*However*, since DefectDojo is built using Django, it isn't too difficult to add support for LDAP.
1313
So long as you don't mind building your own Docker images...
1414

15-
We will need to modify a grand total of 4-5 files, depending on how you want to pass Dojo your LDAP secrets.
15+
We will need to modify a grand total of 4-5 files, depending on how you want to pass DefectDojo your LDAP secrets.
1616

1717
- Dockerfile.django-*
1818
- Dockerfile.nginx-*
@@ -23,7 +23,14 @@ We will need to modify a grand total of 4-5 files, depending on how you want to
2323

2424
#### Dockerfile modifications
2525

26-
In both Dockerfile.django and Dockerfile.nginx, you want to add the following lines to the apt-get install layers:
26+
In both `Dockerfile.django-alpine` and `Dockerfile.nginx-alpine`, you need to add the following lines to the `apk add` layers:
27+
28+
```bash
29+
openldap-dev \
30+
cyrus-sasl-dev \
31+
```
32+
33+
Also, in `Dockerfile.django-debian`, you need to add the following lines to the `apt-get install` layers:
2734

2835
```bash
2936
libldap2-dev \
@@ -42,8 +49,8 @@ Please check for the latest version of these requirements at the time of impleme
4249
Otherwise add the following to requirements.txt:
4350

4451
```python
45-
python-ldap==3.4.2
46-
django-auth-ldap==4.1.0
52+
python-ldap==3.4.5
53+
django-auth-ldap==5.2.0
4754
```
4855

4956

@@ -55,21 +62,25 @@ At the top of the file:
5562
```python
5663
import ldap
5764
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
65+
import environ
5866
```
5967

6068
Then further down add LDAP settings to the env dict:
6169
```python
6270
# LDAP
63-
DD_LDAP_SERVER_URI=(str, 'ldap://ldap.example.com'),
64-
DD_LDAP_BIND_DN=(str, ''),
65-
DD_LDAP_BIND_PASSWORD=(str, ''),
71+
env = environ.FileAwareEnv(
72+
DD_LDAP_SERVER_URI=(str, 'ldap://ldap.example.com'),
73+
DD_LDAP_BIND_DN=(str, ''),
74+
DD_LDAP_BIND_PASSWORD=(str, ''),
75+
)
6676
```
6777

6878
Then under the env dict add:
6979
```python
7080
AUTH_LDAP_SERVER_URI = env('DD_LDAP_SERVER_URI')
7181
AUTH_LDAP_BIND_DN = env('DD_LDAP_BIND_DN')
7282
AUTH_LDAP_BIND_PASSWORD = env('DD_LDAP_BIND_PASSWORD')
83+
7384
AUTH_LDAP_USER_SEARCH = LDAPSearch(
7485
"ou=Groups,dc=example,dc=com", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"
7586
)
@@ -116,7 +127,7 @@ Read the docs for Django Authentication with LDAP here: https://django-auth-ldap
116127

117128
#### docker-compose.yml
118129

119-
In order to pass the variables to the local_settings.py file via docker, it's a good idea to add these to the docker compose file.
130+
In order to pass the variables to the `local_settings.py` file via docker, it's a good idea to add these to the `docker-compose.yml` file.
120131

121132
You can do this by adding the following variables to the environment section for the uwsgi image:
122133
```yaml
@@ -125,4 +136,4 @@ DD_LDAP_BIND_DN: "${DD_LDAP_BIND_DN:-}"
125136
DD_LDAP_BIND_PASSWORD: "${DD_LDAP_BIND_PASSWORD:-}"
126137
```
127138
128-
Alternatively you can set these values in a local_settings.py file.
139+
Alternatively you can set these values in a `local_settings.py` file.

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ titlecase==2.4.1
4343
social-auth-app-django==5.6.0
4444
social-auth-core==4.8.1
4545
gitpython==3.1.45
46-
python-gitlab==6.5.0
46+
python-gitlab==7.0.0
4747
cpe==1.3.1
4848
packageurl-python==0.17.5
4949
django-crum==0.7.9
@@ -62,7 +62,7 @@ django-ratelimit==4.1.0
6262
argon2-cffi==25.1.0
6363
blackduck==1.1.3
6464
pycurl==7.45.7 # Required for Celery Broker AWS (SQS) support
65-
boto3==1.40.60 # Required for Celery Broker AWS (SQS) support
65+
boto3==1.40.62 # Required for Celery Broker AWS (SQS) support
6666
netaddr==1.3.0
6767
vulners==3.1.1
6868
fontawesomefree==6.6.0

run-unittest.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ usage() {
1717
echo "You must specify a test case (arg)!"
1818
echo "Any additional arguments will be passed to the test command."
1919
echo
20+
echo "Make sure you run this script in dev mode."
21+
echo "You can enter dev mode using the following command:"
22+
echo "./docker/setEnv.sh dev"
23+
echo
24+
echo "Lastly, make sure the application is running by using the following docker commands:"
25+
echo "docker compose build"
26+
echo "docker compose up"
27+
echo
2028
echo "Example commands:"
2129
echo "./run-unittest.sh --test-case unittests.tools.test_stackhawk_parser.TestStackHawkParser"
2230
echo "./run-unittest.sh --test-case unittests.tools.test_stackhawk_parser.TestStackHawkParser -v3 --failfast"

0 commit comments

Comments
 (0)