1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-25 15:42:08 +01:00
Files
archived-doc-ja/reference/ssh2/functions/ssh2-connect.xml
KentarouTakeda 768e8d6ed7 軽微な差分を優先し26ファイルを既訳更新 (#349)
- reference/mbstring/functions/mb-decode-numericentity.xml
  1. php/doc-en@4e69a9f2b1
- reference/imap/functions/imap-headerinfo.xml
  1. php/doc-en@4e69a9f2b1
- reference/ssh2/functions/ssh2-auth-pubkey-file.xml
  1. php/doc-en@74ef2355c5
- reference/ssh2/functions/ssh2-connect.xml
  1. php/doc-en@74ef2355c5
- reference/stream/functions/stream-filter-append.xml
  1. php/doc-en@a684294e0b
- reference/stream/functions/stream-filter-prepend.xml
  1. php/doc-en@a684294e0b
- reference/filesystem/functions/fgetcsv.xml
  1. php/doc-en@e1fd0bef1d
  2. php/doc-en@0a3648a718
  3. `&warning.csv.escape-parameter;` の重複を削除(既訳のバグ修正)
- reference/spl/splfileobject/fgetcsv.xml
  1. php/doc-en@e1fd0bef1d
  2. php/doc-en@3a89b55d11
  3. php/doc-en@0a3648a718
- language/predefined/attributes/nodiscard.xml
  1. php/doc-en@30bda33771
- reference/pdo_sqlite/pdo/sqlite/createfunction.xml
  1. php/doc-en@28930349ca
- reference/math/functions/fmod.xml
  1. php/doc-en@54a788ca59
- reference/simplexml/simplexmlelement/addChild.xml
  1. php/doc-en@dca2a8354f
- reference/json/functions/json-last-error.xml
  1. php/doc-en@058ea1e842
- features/commandline.xml
  1. php/doc-en@96b10a9885
- appendices/migration85/incompatible.xml
  1. php/doc-en@048982b729
  2. php/doc-en@f81bbcf9d3
- reference/random/random/randomizer/getfloat.xml
  1. php/doc-en@1ada637cc8
  2. php/doc-en@423a1da63f
- reference/mysqli/mysqli/multi-query.xml
  1. php/doc-en@1beae37b69
- reference/image/functions/getimagesize.xml
  1. php/doc-en@6bb90d24b2
- reference/curl/functions/curl-close.xml
  1. php/doc-en@86c8ebd19e
- reference/curl/functions/curl-share-close.xml
  1. php/doc-en@29c3d13980
- reference/yaml/functions/yaml-parse-file.xml
  1. php/doc-en@132d2a8d63
- reference/mysqli/mysqli/options.xml
  1. php/doc-en@e309a62b16
  2. MYSQLI_SERVER_PUBLIC_KEY の古い「PHP 5.5.0 以降」テキストを削除(既訳のバグ修正)
- appendices/transports.xml
  1. php/doc-en@ae90ecc932
- reference/soap/soapserver/addfunction.xml
  1. php/doc-en@577239f64b
- reference/var/functions/settype.xml
  1. php/doc-en@8d49e302b4
- features/http-auth.xml
  1. php/doc-en@cd4180557a
2026-03-10 08:58:57 +09:00

317 lines
10 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 74ef2355c59e814d14f75a0792d22727be72f137 Maintainer: shimooka Status: ready -->
<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>SSH サーバーに接続する</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>resource</type><type>false</type></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>
<simpara>
リモートの SSH サーバーとの接続を確立します。
</simpara>
<simpara>
一度接続すると、クライアントは <function>ssh2_fingerprint</function>
を使用してサーバーのホスト鍵を検証し、
パスワードもしくは公開鍵を使用して認証します。
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>host</parameter></term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter></term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>methods</parameter></term>
<listitem>
<simpara>
<parameter>methods</parameter>
は以下に示された4つのパラメータを持つ連想配列です。
</simpara>
<table>
<title><parameter>methods</parameter>
は以下のパラメータのいくつかあるいは全てを含む連想配列</title>
<tgroup cols="3">
<thead>
<row>
<entry>インデックス</entry>
<entry>意味</entry>
<entry>サポートする値*</entry>
</row>
</thead>
<tbody>
<row>
<entry>kex</entry>
<entry>
通知する鍵交換メソッドのリスト。優先する順にカンマ区切りにする。
</entry>
<entry>
<literal>diffie-hellman-group1-sha1</literal>
<literal>diffie-hellman-group14-sha1</literal> および
<literal>diffie-hellman-group-exchange-sha1</literal>
</entry>
</row>
<row>
<entry>hostkey</entry>
<entry>
通知するホスト鍵メソッドのリスト。優先する順にカンマ区切りにする。
</entry>
<entry>
<literal>ssh-rsa</literal> および
<literal>ssh-dss</literal>
</entry>
</row>
<row>
<entry>client_to_server</entry>
<entry>
クライアントからサーバーに送信されるメッセージのために優先する暗号化、
圧縮、メッセージ認証コード (MAC) メソッドを含む連想配列。
</entry>
<entry/>
</row>
<row>
<entry>server_to_client</entry>
<entry>
サーバーからクライアントに送信されるメッセージのために優先する暗号化、
圧縮、メッセージ認証コード (MAC) メソッドを含む連想配列。
</entry>
<entry/>
</row>
</tbody>
</tgroup>
</table>
<simpara>
* - サポートする値は、
構成するライブラリがサポートしているメソッドに依存します。
追加情報については <link xlink:href="&url.libssh2;">libssh2</link>
ドキュメントを参照ください。
</simpara>
<table>
<title>
<parameter>client_to_server</parameter>
<parameter>server_to_client</parameter>
は以下のパラメータのいくつかあるいは全てを含む連想配列
</title>
<tgroup cols="3">
<thead>
<row>
<entry>インデックス</entry>
<entry>意味</entry>
<entry>サポートする値*</entry>
</row>
</thead>
<tbody>
<row>
<entry>crypt</entry>
<entry>通知する暗号化メソッドのリスト。
優先する順にカンマ区切りにする。</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> および
<literal>none**</literal>
</entry>
</row>
<row>
<entry>comp</entry>
<entry>通知する圧縮メソッドのリスト。
優先する順にカンマ区切りにする。</entry>
<entry>
<literal>zlib</literal> および
<literal>none</literal>
</entry>
</row>
<row>
<entry>mac</entry>
<entry>通知する MAC メソッドのリスト。
優先する順にカンマ区切りにする。</entry>
<entry>
<literal>hmac-sha1</literal>
<literal>hmac-sha1-96</literal>
<literal>hmac-ripemd160</literal>
<literal>hmac-ripemd160@openssh.com</literal> および
<literal>none**</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<title>暗号化、MAC メソッドの "<literal>none</literal>"</title>
<simpara>
セキュリティ上の問題で、<literal>none</literal>
ビルド時に適切な ./configure
オプションを使用して明示的に有効にしない限り、構成している
<link xlink:href="&url.libssh2;">libssh2</link> によって無効にされます。
詳細は構成するライブラリのドキュメントを参照ください。
</simpara>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>callbacks</parameter></term>
<listitem>
<para>
<parameter>callbacks</parameter>
は以下のパラメータのいくつかあるいは全てを含む連想配列
<table>
<title>
コールバックパラメータ
</title>
<tgroup cols="3">
<thead>
<row>
<entry>インデックス</entry>
<entry>意味</entry>
<entry>プロトタイプ</entry>
</row>
</thead>
<tbody>
<row>
<entry>ignore</entry>
<entry>
<constant>SSH2_MSG_IGNORE</constant>
パケットを受信したときにコールする関数名
</entry>
<entry>void ignore_cb($message)</entry>
</row>
<row>
<entry>debug</entry>
<entry>
<constant>SSH2_MSG_DEBUG</constant>
パケットを受信したときにコールする関数名
</entry>
<entry>void debug_cb($message, $language, $always_display)</entry>
</row>
<row>
<entry>macerror</entry>
<entry>
パケットを受信したがメッセージ認証コードに失敗した場合にコールされる関数名。
もしコールバックが &true; を返す場合、不整合は無視されます。
そうでない場合、接続は終了します。
</entry>
<entry>bool macerror_cb($packet)</entry>
</row>
<row>
<entry>disconnect</entry>
<entry>
<constant>SSH2_MSG_DISCONNECT</constant>
パケットを受信したときにコールする関数名
</entry>
<entry>void disconnect_cb($reason, $message, $language)</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
成功した場合にリソース、エラー時に &false; を返します。
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>ssh2_connect</function> の例</title>
<simpara>
パケット送信時に 3des-cbc 、
パケット受信時に任意の強度の aes cipher、
両方向で無圧縮、
Group1 での鍵交換という設定で強制的に接続をオープンします。
</simpara>
<programlisting role="php">
<![CDATA[
<?php
/* もしサーバーが接続を終了した場合、ユーザーに通知する */
function my_ssh_disconnect($reason, $message, $language) {
printf("Server disconnected with reason code [%d] and message: %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('Connection failed');
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<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</function></member>
<member><function>ssh2_auth_pubkey_file</function></member>
<member><function>ssh2_disconnect</function></member>
</simplelist>
</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
-->