Commit 606a3afb authored by Jakob Moser's avatar Jakob Moser
Browse files

Change instructions

parent ed89f604
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -48,14 +48,16 @@ For the Uni ID, use:

```python
ldap_server_url = "ldaps://ad.uni-heidelberg.de"
server = Server(ldap_server_url, use_ssl=True)
server = Server(ldap_server_url, use_ssl=True, tls=Tls(validate=ssl.CERT_REQUIRED, ca_certs_file="uni_root_ca.pem"))
```

>>> [!warning]
>>> [!note]

Binding to the Uni LDAP server currently does not require the TLS certificate to be valid. This is a security issue, because any attacker could just Man-in-the-Middle the connection and eavesdrop on all sent usernames and passwords.
Make sure that you have the `uni_root_ca.pem` file available in the directory you have spawned the shell in. You can ensure this using:

I currently discourage using the Uni LDAP server, until I have figured out a better way to do this.
```bash
wget https://gitlab.cl.uni-heidelberg.de/moser/ldap/-/raw/master/uni_root_ca.pem
```
>>>

>>> [!note]
@@ -70,8 +72,11 @@ However, setting it to true means that if there ever is a case where no scheme i
Using `input` and `getpass` prevents your credentials from being contained in the interactive session history.

```python
from getpass import getpass
user = input("Username: ")
```

```python
from getpass import getpass
password = getpass()
```

@@ -137,12 +142,10 @@ If you are okay with manually determining a users distinguished name, you can co
```python
from ldap3 import Connection

c = Connection(server, user=dn, password=password)
success = c.bind()
print(success)
Connection(server, user=dn, password=password).bind()
```

Iff `success`, the user provided the correct username and password.
The return value will be `True` if and only if the user provided the correct username and password.

The Portal implementation [provides an alternative way](https://gitlab.cl.uni-heidelberg.de/fachschaft/portal/-/blob/7018a073252860493fa2b2a0c62743e4bcb12ee8/ldap/Directory.py#L62) using context managers.