# Restricciones sobre la IP de llamada

No todos los scripts de servicios web en *main/webservices/* lo respetan, pero *registration.soap.php* permite definir restricciones sobre la dirección IP que puede llamar a los servicios web que contiene (esto no ha sido probado con IPv6 todavía).

Esta funcionalidad es posible gracias al pedazo de código siguiente dentro de la función *WSHelperVerifyKey()*

```
// Check if a file that limits access from webservices exists
// and contains the restraining check
if (is_file('webservice-auth-ip.conf.php')) {
    include 'webservice-auth-ip.conf.php';
    if ($debug) error_log("webservice-auth-ip.conf.php file included");

    if (!empty($ws_auth_ip)) {
        $check_ip = true;
        $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip);
        if ($debug) error_log("ip_matches: $ip_matches");
    }
}
```

Como lo habrá entendido, necesita crear un archivo llamado « webservice-auth-ip.conf.php » dentro de la misma carpeta que \_registration.soap.php\_y añadir una lista de las direcciones IP (o los rangos) dentro del archivo mismo. Solo las direcciones IP que correspondan a los rangos o las IP indicadas serán aceptadas.

Cuando se haga uso de este método, el algoritmo que vimos antes para construir una clave de seguridad deberá ser modificado, ya que dejaremos de necesitar una dirección IP dentro de la clave.

```
$finalKey = sha1($key) ;
```

Para los portales en los cuales la seguridad es una preocupación mayor, es una buena idea de usar este método.


---

# 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://docs.chamilo.org/1.11.x-pt_br/manual-del-desarrollador/servicios_web/restricciones_sobre_la_ip_de_llamada.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.
