2

Vista デスクトップ上にある Windows Server 2003 を実行する仮想マシン上に、IBM の WebSphere MQ バージョン 6 のサーバー側があります。デスクトップにはクライアントがインストールされています。

メッセージをキューに入れ、再び削除する小さなテスト プログラムを (彼らのコード サンプルから) 入手しました。このプログラムは、サーバー バインディングを使用してサーバー上で直接実行すると機能しました。ただし、クライアント バインディングを使用してクライアント側から動作させることはできません。

表示されるエラーは CompCode 2、Reason 2035 で、認証エラーです。

これは、プログラムがデフォルトで私のユーザーの下で実行されるという事実に関係していると思われます。これは、仮想マシンが認識していない(そしてアクセスできない)ドメインにあります。

接続したい vm にローカル ユーザー (ユーザー: websphere、パスワード: websphere) を設定しましたが、これをすべて機能させる方法がわかりません。以下で使用しているコードがあり、チャネルとエンドポイントでセキュリティ出口設定のさまざまな組み合わせを試しましたが、2035 から逃れることはできません。

誰でもこれを経験したことがありますか?助けていただければ幸いです。

コード:

using System;
using System.Collections;

using IBM.WMQ;

class MQSample
{
    // The type of connection to use, this can be:-
    // MQC.TRANSPORT_MQSERIES_BINDINGS for a server connection.
    // MQC.TRANSPORT_MQSERIES_CLIENT for a non-XA client connection
    // MQC.TRANSPORT_MQSERIES_XACLIENT for an XA client connection
    // MQC.TRANSPORT_MQSERIES_MANAGED for a managed client connection
    const String connectionType = MQC.TRANSPORT_MQSERIES_CLIENT;

    // Define the name of the queue manager to use (applies to all connections)
    const String qManager = "QM_vm_win2003";

    // Define the name of your host connection (applies to client connections only)
    const String hostName = "vm-win2003";

    // Define the name of the channel to use (applies to client connections only)
    const String channel = "S_vm_win2003";

    /// <summary>
    /// Initialise the connection properties for the connection type requested
    /// </summary>
    /// <param name="connectionType">One of the MQC.TRANSPORT_MQSERIES_ values</param>
    static Hashtable init(String connectionType)
    {
        Hashtable connectionProperties = new Hashtable();

        // Add the connection type
        connectionProperties.Add(MQC.TRANSPORT_PROPERTY, connectionType);

        // Set up the rest of the connection properties, based on the
        // connection type requested
        switch (connectionType)
        {
            case MQC.TRANSPORT_MQSERIES_BINDINGS:
                break;
            case MQC.TRANSPORT_MQSERIES_CLIENT:
                connectionProperties.Add(MQC.HOST_NAME_PROPERTY, hostName);
                connectionProperties.Add(MQC.CHANNEL_PROPERTY, channel);
                connectionProperties.Add(MQC.USER_ID_PROPERTY, "websphere");
                connectionProperties.Add(MQC.PASSWORD_PROPERTY, "websphere");
                break;
        }

        return connectionProperties;
    }

    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static int Main(string[] args)
    {
        try
        {
            Hashtable connectionProperties = init(connectionType);

            // Create a connection to the queue manager using the connection
            // properties just defined
            MQQueueManager qMgr = new MQQueueManager(qManager, connectionProperties);

            // Set up the options on the queue we wish to open
            int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;

            // Now specify the queue that we wish to open,and the open options
            MQQueue system_default_local_queue =
              qMgr.AccessQueue("clq_default_vm_sql2000", openOptions);

            // Define a WebSphere MQ message, writing some text in UTF format
            MQMessage hello_world = new MQMessage();
            hello_world.WriteUTF("Hello World!");

            // Specify the message options
            MQPutMessageOptions pmo = new MQPutMessageOptions(); 
            // accept the defaults,
            // same as MQPMO_DEFAULT

            // Put the message on the queue
            system_default_local_queue.Put(hello_world, pmo);

            // Get the message back again

            // First define a WebSphere MQ message buffer to receive the message
            MQMessage retrievedMessage = new MQMessage();
            retrievedMessage.MessageId = hello_world.MessageId;

            // Set the get message options
            MQGetMessageOptions gmo = new MQGetMessageOptions(); //accept the defaults
            //same as MQGMO_DEFAULT

            // Get the message off the queue
            system_default_local_queue.Get(retrievedMessage, gmo);

            // Prove we have the message by displaying the UTF message text
            String msgText = retrievedMessage.ReadUTF();
            Console.WriteLine("The message is: {0}", msgText);

            // Close the queue
            system_default_local_queue.Close();

            // Disconnect from the queue manager
            qMgr.Disconnect();
        }

        //If an error has occurred in the above,try to identify what went wrong.

        //Was it a WebSphere MQ error?
        catch (MQException ex)
        {
            Console.WriteLine("A WebSphere MQ error occurred: {0}", ex.ToString());
        }

        catch (System.Exception ex)
        {
            Console.WriteLine("A System error occurred: {0}", ex.ToString());
        }

        Console.ReadLine();
        return 0;
    }//end of start
}//end of sample
4

2 に答える 2

2

Windows から Windows への接続では、WMQ は SID と "短い ID" (この場合は "websphere") を渡します。これは、短い ID のみを使用する Windows 以外の WMQ で得られる認証よりも少し優れています。問題は、Windows 以外のサーバー上の誰かが短い ID "websphere" を使用して接続でき、SID がないため、WMQ が Windows アカウントであると見なして接続を受け入れることです

これに対処するには2つの方法があります。QMgr ホストでは、setmqaut コマンドを実行して、実際に接続に使用している SID を承認できます。VMは、Windows アカウントが存在するドメインを照会できる必要があり、setmqaut コマンドは -p user@domain 構文を使用する必要があります。

または、チャネルの MCAUSER でローカルに定義された ID を使用することもできます。

ALTER CHL(チャンネル名) CHLTYPE(SVRCONN) MCAUSER('webaphere@vm')

...ここで、「vm」は仮想マシンの名前であり、setmqaut コマンドを使用するか、アカウントを mqm または管理者グループに入れることによってアカウントを承認しました。

これはテスト用であることに注意してください。ブランクまたは管理 MCAUSER を持つチャネルは、WMQ を管理できるだけでなく、基盤となるホスト サーバーで任意のコマンドを実行することもできます。現実の世界では、キューと QMgr へのアクセス権はあるが管理へのアクセス権は持たないアカウントを作成し、それらをすべての MCAUSER 値に入れてから、すべての SYSTEM.DEF および SYSTEM.AUTO チャネルに MCAUSER('nobody') を設定します。 .

これについては、私の Web サイト t-rob.net の MQ および Links ページでさらに多くの情報を入手できます。また、チェックアウト:

コメント行: T.Rob Wyatt: WebSphere MQ セキュリティーについて知らなかったこと

コメント行: T.Rob Wyatt: WebSphere MQ のセキュリティが過熱

于 2009-11-19T15:05:00.070 に答える
-1

私も同じ問題を抱えていました。ソリューションでは、ユーザーウィンドウアカウントをMQAグループまたは管理者グループに割り当てる必要があります。次に、ウィンドウアカウントのユーザー名をチャネルのMCAユーザーに追加します。

お役に立てれば

于 2010-08-11T05:07:32.143 に答える