メインコンテンツまでスキップ

4. 通常の運用

ユーザが管理アプリケーションに何らかの処理を指示する際、party やコンテキストの情報を指定する必要はないはずである。

これを実現する一つのアプローチは次のとおりである。ユーザは操作対象となる管理オブジェクトを示すテキスト文字列を提供し、管理アプリケーションは「コンテキストリゾルバ」を呼び出してそれを「コンテキストハンドル (context handle)」にマッピングする。その後、SNMPv2 操作が実行される際に、「コンテキストハンドル」と最小限のセキュリティ要件の集合が管理 API に提供される。

4.1. コンテキストハンドルの取得​

「コンテキストハンドル」は、管理アプリケーションが (おそらくユーザから与えられた) テキスト文字列を提供したときに生成される。「コンテキストリゾルバ」は、アプリケーションの入力に基づいて次の手順を実行する。

    (1)  In the local party database, each context has associated
with it a unique string, termed its "textual handle". If
a context in the local database has a textual handle
which exactly matches the textual string, then the
"context resolver" returns a handle identifying that
context.
         So, if the application supplies "router.xyz.com-public",
then the "context resolver" returns a handle to the first
context; instead, if the application supplies
"router.xyz.com-all", then the "context resolver" returns
a handle to the second context.
    (2)  Otherwise, if any contexts are present whose textual
handle is longer than the textual string, and whose
initial characters exactly match the entire textual
string, then the "context resolver" returns a handle
identifying all of those contexts.
         So, if the application supplies "router.xyz.com", then
         the "context resolver" returns a handle to both contexts.
    (3)  Otherwise, if the textual string specifies an IP address
or a domain name which resolves to a single IP address,
then the "context resolver" adds to the local party
database, a volatile noAuth/noPriv party pair, a volatile
context, and a volatile access control entry allowing
interrogation operations, using the "initialPartyId" and
"initialContextId" conventions. The "context resolver"
returns a handle identifying the newly created context.
         So, if the application supplies "89.0.0.1", then the
"context resolver" adds the following information to the
local party database:
              partyIdentifier:         initialPartyId.89.0.0.1.1
partyIndex: 101
partyTAddress: 89.0.0.1:161
partyLocal: false
partyAuthProtocol: noAuth
partyPrivProtocol: noPriv
partyStorageType: volatile
              partyIdentifier:         initialPartyId.89.0.0.1.2
partyIndex: 102
partyTAddress: local address
partyLocal: true
partyAuthProtocol: noAuth
partyPrivProtocol: noPriv
partyStorageType: volatile
              contextIdentifier:       initialContextId.89.0.0.1.1
contextIndex: 101
contextLocal: false
contextStorageType: volatile
textual handle: 89.0.0.1
              aclTarget (dest. party): 101
aclSubject (src party): 102
aclResources (context): 101
aclPrivileges: get, get-next, get-bulk
aclStorageType: volatile
         and the "context resolver" returns a handle to the newly
created context.
    (4)  Otherwise, if the textual string specifies a domain name
which resolves to multiple IP addresses, then for each
         such IP address, the "context resolver" adds to the local
party database, a volatile noAuth/noPriv party pair, a
volatile context, and a volatile access control entry
allowing interrogation operations, using the
"initialPartyId" and "initialContextId" conventions.
Then, the "context resolver" returns a handle identifying
all of those newly created contexts.
    (5)  Otherwise, if the textual string contains a '/'-
character, and everything to the left of the first
occurrence of this character specifies an IP address or a
domain name which resolves to a single IP address, then
the "context resolver" adds to the local party database,
a volatile SNMPv1 party, a volatile context, and a
volatile access control entry allowing interrogation
operations. (The SNMPv1 community string consists of any
characters following the first occurrence of the '/'-
character in the textual string.) Then, the "context
resolver" returns a handle identifying the newly created
context.
         So, if the application supplied "89.0.0.2/public", then
the "context resolver" adds the following information to
the local party database:
              partyIdentifier:         initialPartyId.89.0.0.2.1
partyIndex: 201
partyTDomain: rfc1157Domain
partyTAddress: 89.0.0.2:161
partyLocal: false
partyAuthProtocol: rfc1157noAuth
partyAuthPrivate: public
partyPrivProtocol: noPriv
partyStorageType: volatile
              contextIdentifier:       initialContextId.89.0.0.2.1
contextIndex: 201
contextLocal: false
contextStorageType: volatile
textual handle: 89.0.0.2
              aclTarget (dest. party): 201
aclSubject (src party): 201
aclResources (context): 201
aclPrivileges: get, get-next, get-bulk
aclStorageType: volatile
         and the "context resolver" returns a handle to the the
         newly created context.
    (6)  Otherwise, if the textual string contains a '/'-
character, and everything to the left of the first
occurrence of this character specifies a domain name
which resolves to multiple IP addresses, then for each
such IP address, the "context resolver" adds to the local
party database, a volatile SNMPv1 party, a volatile
context, and a volatile access control entry allowing
interrogation operations. (The SNMPv1 community string
consists of any characters following the first occurrence
of the '/'-character in the textual string.) Then, the
"context resolver" returns a handle identifying all of
those newly created contexts.
    (7)  Otherwise, an error is raised.

4.2. 操作の要求​

後ほど SNMPv2 操作を実行する際、管理アプリケーションは「コンテキストハンドル」と最小限のセキュリティ要件の集合を管理 API に提供する。

    (1)  If the "context handle" refers to a single context, then
all access control entries having that context as its
aclResources, allowing the specified operation, having a
non-local SNMPv2 party as its aclTarget, which satisfies
the privacy requirements, and having a local party as its
aclSubject, which satisfies the authentication
requirements, are identified.
         So, if the application wanted to issue a get-next
operation, with no security requirements, and supplied a
"context handle" identifying context #1, then acl #1
would be identified.
    (2)  For each such access control entry, the one which
minimally meets the security requirements is selected for
use. If no such entry is identified, and authentication
requirements are present, then the operation will be not
performed.
         So, if the application requests a get-next operation,
with no security requirements, and supplies a "context
handle" identifying context #1, and step 1 above
identified acl #1, then because acl #1 satisfies the no-
security requirements, the operation would be generated
using acl #1, i.e., using party #1, party #2, and context
         #1.
    (3)  Otherwise, all access control entries having the (single)
context as its aclResources, allowing the specified
operation, and having a non-local SNMPv1 party as its
aclTarget, are identified. If no such entry is
identified, then the operation will not performed.
Otherwise, any of the identified access control entries
may be selected for use.
         The effect of separating out step 3 is to prefer SNMPv2
communications over SNMPv1 communications.
    (4)  If the "context handle" refers to more than one context,
then all access control entries whose aclResources refers
any one of the contexts, are identified. For each such
context, step 2 is performed, and any (e.g., the first)
access control entry identified is selected for use. If
no access control entry is identified, then step 3 is
performed for each such context, and any (e.g., the
first) access control entry identified is selected for
use.
         So, if the application wanted to issue a get-bulk
operation, with no security requirements, and supplied a
"context handle" identifying contexts #1 and #2, then
acls #1 and #2 would be identified in step 1; and, in
step 2, party #1, party #2, and context #1 would be
selected.
         However, if the application wanted to issue an
authenticated get-bulk operation, and supplied a "context
handle" identifying contexts #1 and #2, then acls #1 and
#2 would still be identified in step 1; but, in step 2,
only acl #2 satisfies the security requirement, and so,
party #3, party #4, and context #2 would be selected.
    (5)  If no access control entry is identified, then an error
is raised.

なお、手順 1 と手順 3 については、実装が各コンテキストについて、そのコンテキストを aclResources とするアクセス制御エントリを事前に計算 (すなわちキャッシュ) する選択肢があり得る。