How To
Summary
セキュリティ上の要件により、リモートから高い権限のユーザーの接続を許可したくない場合、接続プロシージャーを利用して接続を制御できます。
Steps
たとえば、データベース管理者はローカル・ホストからの接続のみを許可し、リモートからの接続を許可したくない場合、以下のように設定します。
- 任意のテキスト・エディターで以下のような接続プロシージャーを記述します。
注:プロシージャーのスキーマ名として便宜的に db2inst1 を指定していますが、任意のスキーマ名が使用できます。
(ファイル名:connect_proc.sql)create or replace procedure db2inst1.conn_proc1 language SQL begin declare str_msg varchar(100); if exists (select 1 from table(SYSPROC.AUTH_LIST_AUTHORITIES_FOR_AUTHID (session_user, 'U') ) as T where authority='DBADM' and (D_USER='Y' or D_GROUP='Y')) AND client_ipaddr is not NULL then set str_msg = session_user || 'is not allowed to connect from remote client.'; signal sqlstate '42502' set message_text = str_msg; end if; end @
- 対象データベースに DBADM で接続し、接続プロシージャーを実装します。
db2 connect to <db_name> db2 -td@ -vf connect_proc.sql db2 grant execute on procedure db2inst1.conn_proc1 to public db2 update db cfg using CONNECT_PROC db2inst1.conn_proc1
- 対象データベースに DBADM がリモートから接続すると、SQL0438N で拒否されます。
db2 connect to <db_name> user <dbadm> Enter current password for <dbadm>: SQL0438N Application raised error or warning with diagnostic text: "<DBADM> is not allowed to connect from remote client.". SQLSTATE=42502
関連情報
パスポート・アドバンテージによく寄せられる質問
[Db2] 特定の Db2 クライアントからのみ接続を許可する方法
お問合せ先
技術的な内容に関して、パスポート・アドバンテージの契約のもと Db2 テクニカル・サポートへお問い合わせください。
Db2 テクニカル・サポート
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"ARM Category":[{"code":"a8m500000008PlOAAU","label":"Security and Plug-Ins-\u003EAuthorization and Privilege"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.1.0;10.5.0;11.1.0;11.5.0"}]
Was this topic helpful?
Document Information
Modified date:
15 August 2023
UID
ibm16457483