1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-26 16:32:13 +01:00
Files
archived-doc-es/reference/ssh2/functions/ssh2-connect.xml
2014-09-05 20:55:10 +00:00

329 lines
10 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 14af302c9c0e561fa6f9cdd956268758ba9a89c5 Maintainer: pablorr85 Status: ready -->
<!-- Reviewed: no -->
<refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.ssh2-connect">
<refnamediv>
<refname>ssh2_connect</refname>
<refpurpose>Conecta a un servidor SSH</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>ssh2_connect</methodname>
<methodparam><type>string</type><parameter>host</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>22</initializer></methodparam>
<methodparam choice="opt"><type>array</type><parameter>methods</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>callbacks</parameter></methodparam>
</methodsynopsis>
<para>
Establece una conexión a un servidor SSH remoto.
</para>
<para>
Una vez conectado, el cliente debería verificar la clave de host del servidor usando
<function>ssh2_fingerprint</function>, y entonces, autenticarse usando
la contreseña o la clave pública.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>host</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>methods</parameter></term>
<listitem>
<para>
<parameter>methods</parameter> puede ser un array asociativo con, hasta 4 parámetros
descritos aquí abajo.
</para>
<para>
<table>
<title><parameter>methods</parameter> puede ser un array asociativo
con todos o alguno de los siguientes parámetros.</title>
<tgroup cols="3">
<thead>
<row>
<entry>Índice</entry>
<entry>Significado</entry>
<entry>Valores aceptados*</entry>
</row>
</thead>
<tbody>
<row>
<entry>kex</entry>
<entry>
Lista de métodos de intercambio de claves a revelar, separados por comas
en orden de preferencia.
</entry>
<entry>
<literal>diffie-hellman-group1-sha1</literal>,
<literal>diffie-hellman-group14-sha1</literal>, y
<literal>diffie-hellman-group-exchange-sha1</literal>
</entry>
</row>
<row>
<entry>hostkey</entry>
<entry>
Lista de métodos clave-host a desvelar, separados por comas
en orden de preferencia.
</entry>
<entry>
<literal>ssh-rsa</literal> y
<literal>ssh-dss</literal>
</entry>
</row>
<row>
<entry>client_to_server</entry>
<entry>
Associative array containing crypt, compression, and
message authentication code (MAC) method preferences
for messages sent from client to server.
</entry>
<entry/>
</row>
<row>
<entry>server_to_client</entry>
<entry>
Array asociativo que contiene el cifrado, la compresión, y
las preferencias del método de código de autenticación de mensajes (MAC)
para mensajes enviados del servidor al cliente.
</entry>
<entry/>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
* - Los valores soportados dependen de los métodos soportados por la librería subyacente.
Mirar la documentación <link xlink:href="&url.libssh2;">libssh2</link> para obtener información
adicional.
</para>
<para>
<table>
<title>
<parameter>client_to_server</parameter> y
<parameter>server_to_client</parameter> pueden ser un array asociativo
con todos o algunos de los siguientes parámetros.
</title>
<tgroup cols="3">
<thead>
<row>
<entry>Índice</entry>
<entry>Significado</entry>
<entry>Valores soportados*</entry>
</row>
</thead>
<tbody>
<row>
<entry>crypt</entry>
<entry>Lista de métodos de cifrado a desvelar, separados por comas y en orden de preferencia.</entry>
<entry>
<literal>rijndael-cbc@lysator.liu.se</literal>,
<literal>aes256-cbc</literal>,
<literal>aes192-cbc</literal>,
<literal>aes128-cbc</literal>,
<literal>3des-cbc</literal>,
<literal>blowfish-cbc</literal>,
<literal>cast128-cbc</literal>,
<literal>arcfour</literal>, y
<literal>none**</literal>
</entry>
</row>
<row>
<entry>comp</entry>
<entry>Lista de los métodos de compresión a desvelar, separados por comas y en orden de preferencia.</entry>
<entry>
<literal>zlib</literal> y
<literal>none</literal>
</entry>
</row>
<row>
<entry>mac</entry>
<entry>Lista de métodos MAC a desvelar, separados por comas
y en orden de preferencia.</entry>
<entry>
<literal>hmac-sha1</literal>,
<literal>hmac-sha1-96</literal>,
<literal>hmac-ripemd160</literal>,
<literal>hmac-ripemd160@openssh.com</literal>, y
<literal>none**</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<note>
<title>Método de encriptación y MAC "<literal>none</literal>"</title>
<para>
Por razones de seguridad, <literal>none</literal> está deshabilitado por la librería subyacente
<link xlink:href="&url.libssh2;">libssh2</link> a menos que esté habilitado explícitamente
durante el tiempo de construcción usando la optión apropiada de ./configure. Lea la documentación
de dicha librería para más información.
</para>
</note>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>callbacks</parameter></term>
<listitem>
<para>
<parameter>callbacks</parameter> puede ser un array asociativo con todos o alguno de los siguientes parámtros.
<table>
<title>
Parámetros de devolución
</title>
<tgroup cols="3">
<thead>
<row>
<entry>Índice</entry>
<entry>Significado</entry>
<entry>Prototipo</entry>
</row>
</thead>
<tbody>
<row>
<entry>ignore</entry>
<entry>
Nombre de la función a llamar cuando el paquete
<constant>SSH2_MSG_IGNORE</constant> es recibido
</entry>
<entry>void ignore_cb($message)</entry>
</row>
<row>
<entry>debug</entry>
<entry>
Nombre de la función a llamar cuando el paquete
<constant>SSH2_MSG_DEBUG</constant> es recibido
</entry>
<entry>void debug_cb($message, $language, $always_display)</entry>
</row>
<row>
<entry>macerror</entry>
<entry>
Name of function to call when a packet is received but the
message authentication code failed. If the callback returns
&true;, the mismatch will be ignored, otherwise the connection
will be terminated.
</entry>
<entry>bool macerror_cb($packet)</entry>
</row>
<row>
<entry>disconnect</entry>
<entry>
Nombre de la función a llamar cuando el paquete
<constant>SSH2_MSG_DISCONNECT</constant> es recibido
</entry>
<entry>void disconnect_cb($reason, $message, $language)</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Devuelve un recurso en caso de éxito, o &false; en caso de error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>ssh2_connect</function></title>
<para>
Abre una conexión forzando 3des-cbc cuando envía paquetes, cualquier grado de
cifrado aes cuando se reciben paquetes, sin comprensión ni dirección,
y Group1 como clave de cambio.
</para>
<programlisting role="php">
<![CDATA[
<?php
/* Notifica al usuario si el servidor ha terminado la conexión */
function my_ssh_disconnect($reason, $message, $language) {
printf("Servidor desconectado con el siguiente código [%d] y mensaje: %s\n",
$reason, $message);
}
$methods = array(
'kex' => 'diffie-hellman-group1-sha1',
'client_to_server' => array(
'crypt' => '3des-cbc',
'comp' => 'none'),
'server_to_client' => array(
'crypt' => 'aes256-cbc,aes192-cbc,aes128-cbc',
'comp' => 'none'));
$callbacks = array('disconnect' => 'my_ssh_disconnect');
$connection = ssh2_connect('shell.example.com', 22, $methods, $callbacks);
if (!$connection) die('Conexión fallida');
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_fingerprint</function></member>
<member><function>ssh2_auth_none</function></member>
<member><function>ssh2_auth_password</function></member>
<member><function>ssh2_auth_pubkey_file</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->