ユーザーアクセス権限
システム管理者は、ユーザーにコマンドや、設定の階層レベルおよびステートメントへのアクセスまたは権限を付与します。ユーザーは、アクセス権限のあるコマンドのみを実行し、アクセス権限のあるステートメントのみを表示および設定できます。拡張正規表現を使用して、ユーザーに許可または拒否する動作モードのコマンド、設定ステートメント、階層を指定することもできます。これにより、権限のないユーザーが機密性の高いコマンドを実行したり、ネットワークに損害を与えうるステートメントを設定したりすることを防ぐことができます。
アクセス権限レベルの概要
トップレベルのCLIコマンドと 設定ステートメント には、それぞれ関連するアクセス権限レベルがあります。ユーザーは、アクセス権限のあるコマンドのみを実行し、アクセス権限のあるステートメントのみを設定および表示できます。1 つ以上のパーミッション フラグが、各ログイン クラスのアクセス権限を定義します。
ログイン クラスごとに、 permissions ステートメントで指定した権限レベルによって許可または拒否される動作モードおよび設定モードのコマンドおよびステートメント階層の使用を明示的に許可または拒否することもできます。
ログインクラスのパーミッションフラグ
パーミッション フラグを使用して、動作モードのコマンドや、構成階層レベルおよびステートメントへのアクセス権限をユーザーに付与します。ユーザーのログイン クラスのパーミッション フラグは、 [edit system login class] 階層レベルで設定します。特定のパーミッション フラグを指定すると、ユーザーはそのフラグに対応するコマンドと、構成階層レベルおよびステートメントへのアクセス権限を取得します。すべてのコマンドと設定ステートメントへのアクセスを許可するには、 all 権限フラグを使用します。
リストされている各コマンドは、そのコマンドと、そのコマンドをプレフィックスとして付いたすべてのサブコマンドを表しています。リストされている各 設定ステートメント は、そのフラグがアクセスを許可する設定階層の最上位を表しています。
permissionsステートメントは、表1に示すパーミッションフラグを1つ以上指定します。パーミッションフラグは累積されません。情報を表示するviewや設定モードに移行するconfigureなど、クラスごとに必要なすべてのパーミッションフラグをリストする必要があります。2 種類のパーミッション フォームが、構成の個々の部分に対するユーザー アクセスを制御します。
-
「プレーン」フォーム—そのパーミッションタイプに読み取り専用機能を提供します。
interfaceがその一例です。 -
-controlform—そのパーミッションタイプに読み取りと書き込み機能を提供します。interface-controlがその一例です。
設定階層レベルとステートメントへのアクセスを許可するパーミッションフラグの場合、プレーンフォームフラグはその設定への読み取り専用権限を付与します。たとえば、 interface パーミッション フラグは、 [edit interfaces] 階層レベルへの読み取り専用アクセスを許可します。 -control 形式のフラグは、その構成への読み取りおよび書き込みアクセスを許可します。たとえば、 interface-control フラグは、 [edit interfaces] 階層レベルへの読み取りおよび書き込み権限を付与します。
表 1 は、[edit system login class class-name]階層レベルで permissions ステートメントを含めることで設定できるログイン クラスのパーミッション フラグを示しています。
このパーミッションフラグは、特定のアクセス権限セットを付与します。各パーミッション フラグと、動作モードまたは設定モードのコマンド、およびそのフラグがアクセスを許可する構成階層レベルとステートメントを併記します。
| パーミッションフラグ |
説明 |
|---|---|
| 動作モードまたは構成モードでアクセス構成を表示できます。 |
|
|
|
|
| 動作モードまたは構成モードでユーザーアカウント情報を表示できます。 |
|
| ユーザーアカウント情報を表示し、 |
|
| すべての動作モードのコマンドと構成モードのコマンドにアクセスできます。すべての構成階層レベルで構成を変更できます。 |
|
| デバイスがネットワークから学習して、さまざまなネットワークデータベースに保存した情報を消去(削除)できます( |
|
| 構成モード( |
|
| すべての制御レベルの操作( |
|
| フィールド デバッグ コマンドを表示できます。デバッグ サポート用に予約されています。 |
|
| ファイアウォールフィルターの設定を動作モードまたは構成モードで表示できます。 |
|
|
|
|
| リムーバブル メディアの読み取りと書き込みができます。 |
|
| フロータップの設定を動作モードまたは構成モードで表示できます。 |
|
|
|
|
| ルーターまたはスイッチへのフロータップ要求を行うことができます。たとえば、Dynamic Tasking Control Protocol(DTCP)クライアントには、自身を管理者ユーザーとして認証するための
注:
|
|
| プロファイラデータを表示できます。 |
|
| インターフェイスの設定を動作モードおよび構成モードで表示できます。 |
|
| シャーシ、 サービス クラス (CoS)、グループ、転送オプション、インターフェイスの設定情報を表示できます。以下の階層レベルで設定を変更できます。
|
|
| デバイス上でのローカルシェルの起動、シェル内のスーパーユーザーになる( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 構成モードおよび運用モードで、一般的なルーティング、ルーティングプロトコル、およびルーティングポリシーの設定情報を表示できます。 |
|
|
|
|
| 設定内のパスワードやその他の認証キーを表示できます。 |
|
| 設定内のパスワードやその他の認証キーを表示および変更できます。 |
|
| 運用モードおよび構成モードでセキュリティ設定情報を表示できます。 |
|
|
|
|
|
|
|
| 運用モードまたは構成モードで簡易ネットワーク管理プロトコル(SNMP)の設定情報を表示できます。 |
|
|
|
|
|
|
|
storage-control |
|
| 動作モードまたは構成モードでシステム レベルの情報を表示できます。 |
|
|
|
|
| トレース ファイルの設定を表示できます。 |
|
| トレース ファイルの設定およびトレース ファイルのプロパティの構成を変更できます。 |
|
unified-edge |
|
unified-edge-control |
|
| さまざまなコマンドを使って、システム全体、ルーティングテーブル、プロトコル固有の現在の値や統計情報を表示できます。シークレット設定は表示できません。 |
|
| シークレット、システムスクリプト、イベントオプションを除くすべての設定を表示できます。
注:
|
ログインクラスに対する個々のコマンドとステートメント階層の許可および拒否
デフォルトでは、最上位のすべてのCLIコマンドおよび構成階層レベルには、関連するアクセス権限レベルがあります。ユーザーは、アクセス権限のあるコマンドのみを実行し、アクセス権限のあるステートメントのみを表示および設定できます。ログイン クラスごとに、 permissions ステートメントで指定した権限レベルによって許可または拒否される動作モードおよび設定モードのコマンドおよびステートメント階層の使用を明示的に許可または拒否できます。
パーミッションフラグは、動作モードおよび設定モードのコマンドと、設定階層レベルおよびステートメントへのアクセス権限をユーザーに付与します。 [edit system login class] 階層レベルでユーザーのログインクラスに特定のパーミッションフラグを指定することで、対応するコマンドや設定階層レベルおよびステートメントへのアクセス権限をユーザーに付与します。すべてのコマンドと設定ステートメントへのアクセス権限を付与するには、 all 権限フラグを使用します。
ログインクラスに allow-commands、 deny-commands、 allow-configuration、および deny-configuration ステートメントを設定することで、コマンドとステートメントの使用を明示的に許可または拒否できます。ステートメントでは、拡張正規表現を使用して、クラスに割り当てられたユーザーに対して許可または拒否するコマンドとステートメントを定義します。
例:アクセス権限レベルを使用したユーザー権限の設定
この例では、ログインクラスのユーザー許可を設定します。ユーザーが許可されていないアクションをネットワークで実行するのを防ぐために、ログインクラスのユーザー許可を設定します。ユーザーはこれらのコマンドのみを実行でき、アクセス権限のあるステートメントのみを表示および変更できます。この制約により、権限のないユーザーが機密性の高いコマンドを実行したり、ネットワークに損害を与えうるステートメントを設定したりすることを防ぐことができます。
要件
この例を設定する前に、デバイスの初期化以外の特別な設定を行う必要はありません。
概要
各トップレベルのCLIコマンドと各設定ステートメントには、関連するアクセス権限レベルがあります。ログインクラスを設定すると、動作モードおよび設定モードのコマンドおよび設定ステートメントの使用を明示的に許可または拒否できます。ユーザーは、アクセス権限のあるコマンドのみを実行し、アクセス権限のあるステートメントのみを表示および設定できます。
permissionsステートメントで1つ以上のパーミッションフラグを指定することで、各ログインクラスのアクセス権を定義します。パーミッションフラグは、コマンド、ステートメント、階層へのアクセスをユーザーに付与します。パーミッションフラグは累積されません。各ログインクラスに対して、情報を表示するviewや設定モードに移行するconfigureなど、必要なすべてのパーミッションフラグをリストする必要があります。ユーザーのログインクラスに特定のパーミッションフラグを指定することで、対応するコマンド、ステートメントおよび階層へのアクセスをユーザーに付与します。すべてのコマンドと設定ステートメントへのアクセス権限を付与するには、all権限フラグを使用します。パーミッションフラグは、パーミッションタイプに読み取り専用(「プレーン」形式)と読み取りおよび書き込み(末尾に-controlが付く形式)機能を提供します。
ユーザーがrollbackパーミッションフラグを有効にしてrollbackコマンドを発行すると、allログインクラスのパーミッションビットが拡張正規表現よりも優先されます。
ログインクラスのユーザーアクセス権限レベルを設定するには、[edit system login class class-name]階層レベルにpermissionsステートメントを含め、その後にパーミッションフラグを含めます。複数のパーミッションを、角括弧で囲まれたスペース区切りのリストとして設定します。
[edit system login] user@host# set class class-name permissions permission-flag user@host# set class class-name permissions [flag1 flag2 flag3]
使用可能な権限を表示するには、CLIのコンテキストに応じたヘルプを使用し、 permissions ステートメントの後に疑問符(?)を入力します。
[edit system login] user@host# set class class-name permissions ?
設定
この例では、 snmp-admin ログインクラスを設定します。このログインクラスのユーザーは、SNMPパラメーターのみを設定および表示できます。
アクセス権限レベルを使用したユーザー許可の設定
ステップバイステップの手順
ログインクラスのアクセス権限を設定するには:
-
snmp-adminログインクラスをconfigure、snmp、およびsnmp-controlパーミッションフラグで設定します。[edit system login] user@host# set class snmp-admin permissions [configure snmp snmp-control]
設定されたパーミッションフラグは、SNMPに読み取り(snmp)と読み取り書き込み(snmp-control)の両方の機能を提供します。この権限は、このログインクラスにのみ許可されるアクセス権限です。その他のアクセス権限は拒否されます。
-
snmp-adminログインクラスに割り当てられたユーザーアカウントを作成します。[edit system login] user@host# set user snmpuser class snmp-admin authentication plain-text-password New password: Retype new password:
結果
設定モードで、 show system login コマンドを入力して設定を確認します。出力に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@host# show system login
class snmp-admin {
permissions [ configure snmp snmp-control ];
}
user snmpuser {
class snmp-admin;
authentication {
encrypted-password "$ABC123"; ## SECRET-DATA
}
}
デバイスの設定後、構成モードで commit を入力します。
検証
新しいログインクラスに割り当てられたユーザー名を使用してログインし、設定が正しく機能していることを確認します。
SNMP設定の確認
目的
snmp-adminログインクラスのユーザーがSNMPを構成できることを確認します。
アクション
設定モードで、 [edit snmp] 階層レベルでSNMPステートメントを設定します。
[edit snmp] user@host# set name device1 user@host# set description switch1 user@host# set location Lab1 user@host# set contact example.com user@host# commit
意味
snmp-adminログインクラスのユーザーは、SNMPパラメーターを設定できます。このクラスに指定されたパーミッションフラグに、snmp(読み取り機能)とsnmp-control(読み取りおよび書き込み機能)の両方が含まれているため、ユーザーはこれらのパラメーターを設定できます。
SNMP以外の設定の確認
目的
snmp-adminログインクラスのユーザーがSNMP以外の設定ステートメントを変更できないことを確認します。
アクション
設定モードで、 interfaces 階層のステートメントなど、SNMP以外のステートメントを設定します。
[edit] user@host# edit interfaces Syntax error, expecting <statement> or <identifier>.
意味
この snmp-admin ログインクラスのユーザーは、このクラスに指定されたパーミッションフラグで許可されていないため、 [edit interfaces] 階層を設定することができません。この場合、CLIからエラーメッセージが発行されます。
動作モードのコマンド、設定ステートメント、階層を許可または拒否するための正規表現
このトピックでは、次のセクションについて説明します。
- 許可ステートメントと拒否ステートメントを理解する
- 許可と拒否ステートメントの構文を理解する
- 許可と拒否ステートメントの優先とマッチングを理解する
- 許可と拒否ステートメントのルールを理解する
- *-正規表現ステートメントの違いを理解する
- リモート認証サーバーでの正規表現の使用
- 正規表現の指定
- 正規表現演算子
- 正規表現の例
許可ステートメントと拒否ステートメントを理解する
トップレベルのCLIコマンドおよび設定ステートメントの各階層には、関連するアクセス権限レベルがあります。各ログインクラスは、操作モードおよび設定モードのコマンドおよび設定階層およびステートメントの使用を明示的に許可または拒否できます。そうでなければ、権限レベルによって許可または拒否されます。ユーザーは、アクセス権限のあるコマンドのみを実行し、アクセス権限のあるステートメントのみを表示および設定できます。
各ログインクラスのアクセス権限は、[edit system login class class-name]階層レベルのpermissionsステートメントで指定された1つ以上のパーミッションフラグによって定義されます。さらに、拡張正規表現を定義することで、特定のコマンドや設定階層の使用を許可または拒否することができます。ログインクラスに以下のステートメントを設定することで、正規表現を指定できます。
-
allow-commandsおよびdeny-commands-動作モードおよび設定モードのコマンドへのアクセスを許可または拒否します。 -
allow-configurationおよびdeny-configuration—特定の設定階層へのアクセスを許可または拒否します。注:これらのステートメントは、ゆっくりマッチングを実行しますが、特にワイルドカードマッチングにおいては、より柔軟性があります。しかし、フルパスの正規表現やワイルドカードの表現が多数設定されていると、可能性のあるすべての文を評価するのに非常に時間がかかり、パフォーマンスに悪影響を及ぼす可能性があります。
-
allow-commands-regexpsおよびdeny-commands-regexps-正規表現の文字列を使用して、特定のコマンドへのアクセスを許可または拒否します。 -
allow-configuration-regexpsdeny-configuration-regexps-正規表現の文字列を使用して、特定の設定階層へのアクセスを許可または拒否します。
既存の設定で allow/deny-commands または allow/deny-configuration ステートメントを使用している場合、 allow/deny-commands-regexps または allow/deny-configuration-regexps ステートメントで同じ設定オプションを使用すると、同じ結果が得られない可能性があります。これらのステートメントの 2 つの形式では、検索とマッチの方法が異なります。
allow/deny-*ステートメントを使用してコマンドや設定ステートメントの階層を明示的に許可すると、permissionsステートメントですでに定義されている権限が追加されます。同様に、allow/deny-*ステートメントを使用してコマンドや設定ステートメントの階層を明示的に拒否すると、permissionsステートメントで既に定義されている権限が削除されます。
例えば、以下の設定では、 configure パーミッションにより、ログインクラスのユーザーが設定モードに入ることができます。さらに、 allow-configuration 式を使用すると、ユーザーは [edit system services] 階層レベルで設定を変更し、コミットすることができます。
[edit system login class test] user@host# set permissions configure allow-configuration "system services"
同様に、以下の設定では、ログインクラスのユーザーは、 all 権限フラグが許可するすべての操作を実行できますが、 [edit system services] 階層レベルでの設定を表示または変更できないことを除きます。
[edit system login class test] user@host# set permissions all deny-configuration "system services"
許可と拒否ステートメントの構文を理解する
allow/deny-*ステートメントの設定は、各ログインクラスで1回のみ可能です。ステートメントを設定する場合:
-
必要な数の正規表現を設定することができます。
-
正規表現は大文字と小文字を区別しません
allow/deny-commandsステートメントはallow/deny-commands-regexpsステートメントと相互に排他的であり、allow/deny-configurationステートメントはallow/deny-configuration-regexpsステートメントと相互に排他的です。例えば、同じログインクラスにallow-configurationとallow-configuration-regexpsの両方を設定することはできません。
コマンドへのアクセス権を定義するには、 allow-commands および deny-commands ステートメントを使用して拡張正規表現を指定します。独立した完全な式をそれぞれ括弧( ) で囲み、パイプ( | )記号を使用して式を区切ります。パイプ記号で結ばれた正規表現の間にはスペースを使用しないでください。完全な式は、二重引用符で囲まれています。
allow-commands "(cmd1)|(cmd2)|(cmdn)" allow-configuration "(config1)|(config2)|(confign)"
次に例を示します。
[edit system login class test] user@host# set allow-commands "(ping .*)|(traceroute .*)|(show .*)|(configure .*)|(edit)|(exit)|(commit)|(rollback .*)"
allow-commandsステートメントで複雑な正規表現を指定する場合は、アンカーを使用する必要があります。次に例を示します。
[edit system login] user@host# set class test allow-commands "(^monitor)|(^ping)|(^show)|(^exit)"
設定階層の一部へのアクセス権限を定義するには、 allow-configuration および deny-configuration ステートメントで拡張正規表現を指定します。フルパスを括弧( )で囲み、パイプ( | )記号を使用して表現を区切ります。パイプ記号で結ばれた正規表現の間にはスペースを使用しないでください。完全な式は、二重引用符で囲まれています。
allow-configuration "(config1)|(config2)|(confign)"
次に例を示します。
[edit system login class test] user@host# set deny-configuration "(system login class)|(system services)"
allow/deny-commands-regexpsまたはallow/deny-configuration-regexpsステートメントを使用して拡張正規表現を指定する場合は、それぞれの式を引用符(" ")で囲み、スペースで区切ってください。複数の式を角括弧[ ]で囲みます。次に例を示します。
[edit system login class test] user@host# set allow-configuration-regexps ["interfaces .* description .*" "interfaces .* unit .* description .*" “interfaces .* unit .* family inet address .*" "interfaces.* disable"]
set、log、count などの修飾子は、一致させる正規表現文字列内ではサポートされていません。修飾子を使用した場合は、何も一致しません。
正しい設定:
[edit system login class test] user@host# set deny-commands protocols
誤った設定:
[edit system login class test] user@host# set deny-commands "set protocols"
許可と拒否ステートメントの優先とマッチングを理解する
デフォルトでは、 allow-commands および allow-configuration 正規表現が deny-commands および deny-configuration 表現よりも優先されます。そのため、 allow-commands ステートメントと deny-commands ステートメントの両方に同じコマンドを設定すると、許可の操作が拒否の操作よりも優先されます。同様に、 allow-configuration ステートメントと deny-configuration ステートメントの両方に同じステートメントを設定すると、許可操作が拒否操作よりも優先されます。
例えば、以下の設定では、deny-commandsステートメントに同じコマンドが含まれていても、testログインクラスのユーザーがrequest system software addコマンドを使用してソフトウェアをインストールすることができます。
[edit system login class test] user@host# set allow-commands "request system software add" user@host# set deny-commands "request system software add"
同様に、以下の設定では、deny-configurationステートメントに同じ階層が含まれていても、testログインクラステストのユーザーが[edit system services]の設定階層を表示および変更することができます。
[edit system login class test] user@host# set allow-configuration "system services" user@host# set deny-configuration "system services"
allow-commandsステートメントとdeny-commandsステートメントに2つの異なるバリエーションのコマンドがある場合は、常に最も長く一致するものが実行されます。以下の設定では、testログインクラスのユーザーがcommit synchronizeコマンドを実行できますが、commitコマンドは実行できません。これは、commit synchronizeがcommitとcommit synchronizeの間で最も長く一致し、allow-commandsに指定されているためです。
[edit system login class test] user@host# set allow-commands "commit synchronize" user@host# set deny-commands commit
以下の設定では、 test ログインクラスのユーザーが commit コマンドを実行できますが、 commit synchronize コマンドは実行できません。これは、 commit synchronize が commit と commit synchronizeの間で最も長く一致し、 deny-commandsに指定されているためです。
[edit system login class test] user@host# set allow-commands commit user@host# set deny-commands "commit synchronize"
他のステートメントとは対照的に、*-regexpsステートメントのデフォルトの動作は、deny-commands-regexpsおよびdeny-configuration-regexps正規表現がallow-commands-regexpsおよびallow-configuration-regexps表現よりも優先されます。[edit system]階層レベルでregex-additive-logicステートメントを設定すると、allow-configuration-regexps正規表現がdeny-configuration-regexpsステートメントよりも優先されるようになります。ステートメントを設定することで、上位の設定階層を拒否した上で、特定のサブ階層へのアクセスのみをユーザーに許可することができます。
許可と拒否ステートメントのルールを理解する
allow/deny-commands、allow/deny-configuration、allow/deny-commands-regexps、およびallow/deny-configuration-regexpsステートメントは、ログインクラスのパーミッションよりも優先されます。これらのステートメントを設定する場合、以下のルールが適用されます。
-
allow-commandsおよびdeny-commandsステートメントの正規表現には、commit、load、rollback、save、status、およびupdateコマンドを含めることもできます。 -
allログインクラスのパーミッションビットは、ユーザーがrollbackパーミッションフラグを有効にしてrollbackコマンドを発行すると、拡張された正規表現よりも優先されます。 -
拡張正規表現を指定した場合、ユーザーは
load overrideコマンドを発行できません。ユーザーは、merge、replace、patch設定コマンドのみを発行できます。 -
正規表現を表す際には、ワイルドカード文字*を使用できます。ただし、正規表現の一部として使用する必要があります。
[ * ]または[ .* ]だけの式を使用することはできません。また、allow-configurationステートメントに(interfaces (description (|.*))などの式を設定することはできません。これはallow-configuration .*と評価されるためです。
*-正規表現ステートメントの違いを理解する
このセクションでは、 allow/deny-configuration ステートメントと allow/deny-configuration-regexps ステートメントの違いについて説明します。
allow/deny-configuration-regexpsステートメントは正規表現をトークンに分割し、それぞれを指定された設定のフルパスの各部分にマッチさせますが、allow/deny-configurationステートメントは完全な文字列とマッチさせます。allow/deny-configuration-regexpsステートメントでは、各文字列が正規表現である一連の文字列を設定し、文字列の用語の間にはスペースが入ります。この構文は、非常に高速なマッチングを実現しますが、柔軟性に欠けます。ワイルドカード式を指定するには、マッチさせたいスペース区切りの文字列の各トークンに対してワイルドカードを設定する必要があります。そのため、これらのステートメントにワイルドカード式を使用することが難しくなります。
次に例を示します。
-
allow-configuration-regexpsを使用して1つのトークンに一致する正規表現
この例では、ステートメントの最初のトークンに対して
optionsが唯一マッチする式であることを示しています。[edit system] login { class test { permissions configure; allow-configuration-regexps .*options; } }前述の設定は、以下のステートメントと一致します。
-
set policy-options condition condition dynamic-db
-
ネクストホップstatic-routeルーティングオプション静的ルートの設定next-hop
-
set event-options generate-event event time-interval seconds
前述の設定は、以下のステートメントと一致しません。
-
システム ホスト-ネーム ホストオプション
-
インターフェイス interface-name 説明 オプション
-
-
allow-configuration-regexpsを使用して3つのトークンにマッチする正規表現
この例では、ステートメントの3つ目のトークンに対して
sshが唯一マッチする式であることを示しています。[edit system] login { class test { permissions configure; allow-configuration-regexps ".* .* .*ssh"; } }前の例では、3 つのトークンにそれぞれ
.*、.*、.*sshが含まれます。前述の設定は、以下のステートメントと一致します。
-
システム ホスト-ネーム ホスト-ネームssh
-
システムサービス ssh
-
システムサービス アウトバウンド-ssh
前述の設定は、以下のステートメントと一致しません。
-
インターフェイスinterface-name説明SSH
-
設定アクセスを制限するために deny-configuration ステートメントを使用する方が、 deny-configuration-regexps ステートメントを使用するよりも簡単です。 表2は 、特定の設定へのアクセスを制限するという同じ結果を得るために、異なる設定で deny-configuration ステートメントと deny-configuration-regexps ステートメントの両方を使用する方法を示しています。
| 設定拒否 |
使用: |
使用: |
結果 |
|
|
[edit system]
login {
class test {
permissions configure;
allow-configuration .*;
deny-configuration .*xnm-ssl;
}
}
|
[edit system]
login {
class test {
permissions configure;
allow-configuration .*;
deny-configuration-regexps ".* .* .*-ssl"";
}
}
|
以下の設定ステートメントは拒否されます。
|
|
|
[edit system]
login {
class test {
permissions configure;
allow-configuration .*;
deny-configuration ".*ssh";
}
}
|
[edit system]
login {
class test {
permissions configure;
allow-configuration .*;
deny-configuration-regexps ".*ssh";
deny-configuration-regexps ".* .*ssh";
deny-configuration-regexps ".* .* .*ssh";
}
}
|
以下の設定ステートメントは拒否されます。
|
シンプルな設定が必要な場合、 allow/deny-configuration ステートメントも有効ですが、 allow/deny-configuration-regexps ステートメントの方がパフォーマンスが高く、 allow/deny-configuration ステートメントで式を組み合わせる際にあった曖昧さを解消しています。
リモート認証サーバーでの正規表現の使用
拡張正規表現を使用して、特定のユーザーに許可または拒否される動作モードおよび設定モードのコマンドや設定ステートメント、階層を指定できます。これらの正規表現は、[edit system login class class-name]階層レベルのallow/deny-commands、allow/deny-configuration、allow/deny-commands-regexps、およびallow/deny-configuration-regexpsステートメントでローカルで指定します。認証サーバーの設定でジュニパーネットワークスベンダー固有のTACACS+またはRADIUS属性を指定することで、これらの正規表現をリモートで指定します。ローカルとリモートの両方で認証パラメータを設定する場合、デバイスは、TACACS+またはRADIUS認証時に受け取った正規表現を、ローカルデバイスで定義された正規表現とマージします。
Junos OSリリース18.1以降、 allow-commands-regexps および deny-commands-regexps ステートメントがTACACS+認証にサポートされています。
allow-commands、deny-commands、allow-configuration、またはdeny-configurationステートメントを使用してローカル設定で複数の正規表現を指定する場合、正規表現を括弧内に設定し、パイプ記号で区切ります。完全な式を二重引用符で囲みます。例えば、以下の構文で複数のallow-commandsパラメーターを指定することができます。
allow-commands "(cmd1)|(cmd2)|(cmdn)"
RADIUS認証サーバーは、以下の属性と構文を使用します。
Juniper-Allow-Commands += "(cmd1)|(cmd2)|(cmd3)", Juniper-Deny-Commands += "(cmd1)|(cmd2)", Juniper-Allow-Configuration += "(config1)|(config2)", Juniper-Deny-Configuration += "(config1)|(config2)",
TACACS+ 認証サーバーは、以下の属性と構文を使用します。
allow-commands = "(cmd1)|(cmd2)|(cmdn)" deny-commands = "(cmd1)|(cmd2)|(cmdn)" allow-configuration = "(config1)|(config2)|(confign)" deny-configuration = "(config1)|(config2)|(confign)"
allow-commands-regexps、deny-commands-regexps、allow-configuration-regexps、またはdeny-configuration-regexpsステートメントを使用してローカル設定で複数の正規表現を指定する場合は、正規表現を二重引用符で囲み、スペース運用担当者で区切ります。完全な式を角括弧で囲みます。例えば、以下のシンタックスで複数の許可コマンドパラメーターを指定することができます。
allow-commands-regexps [ "cmd1" "cmd2" "cmdn" ]
RADIUS認証サーバーは、以下の属性と構文を使用します。
Juniper-Allow-Configuration-Regexps += "(config1)|(config2)|(confign)", Juniper-Deny-Configuration-Regexps += "(config1)|(config2)|(confign)",
TACACS+ 認証サーバーは、以下の属性と構文を使用します。
allow-commands-regexps = "(cmd1)|(cmd2)|(cmdn)" deny-commands-regexps = "(cmd1)|(cmd2)|(cmdn)" allow-configuration-regexps = "(config1)|(config2)|(confign)" deny-configuration-regexps = "(config1)|(config2)|(confign)"
RADIUSおよびTACACS+サーバーは、個々の式を別の行で指定する簡略化された構文もサポートしています。例えば、RADIUSサーバーの簡略化された構文は次のとおりです。
Juniper-Allow-Commands += "cmd1", Juniper-Allow-Commands += "cmd2", Juniper-Allow-Commands += "cmdn",
同様に、TACACS+ サーバーの簡略化されたシンタックスは次のとおりです。
allow-commands-regexps1 = "cmd1" allow-commands-regexps2 = "cmd2" allow-commands-regexpsn = "cmdn"
表3は 、ローカル認証設定とTACACS+サーバー認証設定を正規表現で区別しています。
| ローカル設定 |
リモートTACACS+ 設定 |
|---|---|
login {
class local {
permissions configure;
allow-commands "(ping .*)|(traceroute .*)|(show .*)|(configure .*)|(edit)|(exit)|(commit)|(rollback .*)";
deny-commands .*;
allow-configuration "(interfaces .* unit 0 family ethernet-switching vlan mem.* .*)|(interfaces .* native.* .*)|(interfaces .* unit 0 family ethernet-switching interface-mo.* .*)|(interfaces .* unit .*)|(interfaces .* disable)|(interfaces .* description .*)|(vlans .* vlan-.* .*)"
deny-configuration .*;
}
}
|
user = remote {
login = username
service = junos-exec {
allow-commands1 = "ping .*"
allow-commands2 = "traceroute .*"
allow-commands3 = "show .*"
allow-commands4 = "configure"
allow-commands5 = "edit"
allow-commands6 = "exit"
allow-commands7 = "commit"
allow-commands8 = ".*xml-mode"
allow-commands9 = ".*netconf.*"
allow-commands10 = ".*need-trailer"
allow-commands11 = "rollback.*"
allow-commands12 = "junoscript"
deny-commands1 = ".*"
allow-configuration1 = "interfaces .* unit 0 family ethernet-switching vlan mem.* .*"
allow-configuration2 = "interfaces .* native.* .*"
allow-configuration3 = "interfaces .* unit 0 family ethernet-switching interface-mo.* .*"
allow-configuration4 = "interfaces .* unit .*"
allow-configuration5 = "interfaces .* disable"
allow-configuration6 = "interfaces .* description .*"
allow-configuration7 = "interfaces .*"
allow-configuration8 = "vlans .* vlan-.* .*"
deny-configuration1 = ".*"
local-user-name = local-username
user-permissions = "configure"
}
}
|
-
xml-mode、netconf、need-trailerの3つのコマンドを発行して、ローカルまたはリモートでNETCONFモードへのアクセスを明示的に許可する必要があります。 -
deny-configuration = ".*"ステートメントを使用する場合、allow-configurationステートメントを使用して、希望するすべての設定を許可する必要があります。ただし、この設定は、allow-configurationステートメントで許可される正規表現のバッファ制限に影響を与える可能性があります。この制限を超えると、許可された設定が機能しない可能性があります。
正規表現の指定
コマンドや設定ステートメントで正規表現を指定する場合、以下の例に注意してください。無効なシンタックスの正規表現では、設定がエラーなくコミットされたとしても、望ましい結果が得られない場合があります。
コマンドおよび設定ステートメントの正規表現は、完全なコマンドまたはステートメントを実行するのと同じ方法で指定する必要があります。 表4 は、 [edit interfaces] および [edit vlans] ステートメント階層のアクセス権限を設定する正規表現を示しています。
| ステートメント |
正規表現 |
設定ノート |
|---|---|---|
| [edit interfaces] インターフェイスの [edit] user@host# set interfaces interface-name unit interface-unit-number |
その結果、 [edit system login class class-name] user@host# set permissions configure user@host# set deny-configuration "interfaces .* unit .*" |
|
| [edit vlans] VLANの [edit] user@host# set vlans vlan-name vlan-id vlan-id |
ここでは、 その結果、 [edit system login class class-name] user@host# set permissions configure user@host# set allow-configuration "vlans .* vlan-id .*" |
|
正規表現演算子
表5 に、運用モードと設定モードの許可または拒否に使用できる一般的な正規表現演算子を示します。
コマンド正規表現は、POSIX 1003.2で定義されている拡張(最新)正規表現を実装します。
| オペレーター |
マッチ |
例文 |
|---|---|---|
| | |
パイプで区切られた2つ以上の条件の1つです。各用語は、括弧( )で囲まれた完全な独立した式でなければならず、パイプと隣の括弧の間にスペースは入れません。 |
[edit system login class test] user@host# set permissions configure user@host# set allow-commands "(ping)|(traceroute)|(show system alarms)|(show system software)" user@host# set deny-configuration "(access)|(access-profile)|(accounting-options)|(applications)|(apply-groups)|(bridge-domains)|(chassis)|(class-of-service)" 前述の設定により、テストログインクラスに割り当てられたユーザーは、 |
| ^ |
式の先頭には、コマンドの開始位置を示すために使用され、曖昧さがある場合があります。 |
[edit system login class test] user@host# set permissions interface user@host# set permissions interface-control user@host# set allow-commands "(^show) (log|interfaces|policer))|(^monitor)" 前述の設定により、テストログインクラスに割り当てられたユーザーは、インターフェイス設定の表示と設定へのアクセスができます。 最初のフィルターでは、指定されたコマンドには、 |
| $ |
コマンドの末尾の文字。そのポイントまで正確に一致する必要があるコマンドを示すために使用します。 |
[edit system login class test] user@host# set permissions interface user@host# set allow-commands "(show interfaces$)" 前述の設定により、テストログインクラスに割り当てられたユーザーは、インターフェイスの設定を設定モードで表示できます。ユーザーは、 |
| [ ] |
文字または数字の範囲。範囲の開始と終了を区切るには、ハイフン( - |
[edit system login class test] user@host# set permissions clear user@host# set permissions configure user@host# set permissions network user@host# set permissions trace user@host# set permissions view user@host# set allow-configuration-regexps [ "interfaces [gx]e-.* unit [0-9]* description .*" ] 前述の設定により、テストログインクラスに割り当てられたユーザーは、運用担当者レベルのユーザー権限を持っています。これらのユーザーは、指定されたインターフェイス名とユニット番号(0〜9)の範囲内でインターフェイスを設定するためのアクセスも持っています。 |
| ( ) |
評価される完全なスタンドアロン式を示すコマンドのグループ。結果は、全体的な式の一部として評価されます。括弧は、説明されているように、パイプ演算子と組み合わせて使用する必要があります。 |
[edit system login class test] user@host# set permissions all user@host# set allow-commands "(clear)|(configure)" user@host# deny-commands "(mtrace)|(start)|(delete)" 上記の設定により、テストログインクラスに割り当てられたユーザーはスーパーユーザーレベルの権限を持ち、 |
| * |
ゼロまたはそれ以上の条件。 |
[edit system login class test] user@host# set permissions configure user@host# set deny-configuration "(system login class m*)" 上記の設定では、テストログインクラスに割り当てられたユーザーのうち、ログインユーザーネームが |
| + |
1 つまたは複数の条件。 |
[edit system login class test] user@host# set permissions configure user@host# set deny-configuration "(system login class m+)" 上記の設定では、テストログインクラスに割り当てられたユーザーのうち、ログインユーザーネームが |
| . |
スペース" "を除く任意の文字。 |
[edit system login class test] user@host# set permissions configure user@host# set deny-configuration "(system login class m.)" 上記の設定では、テストログインクラスに割り当てられたユーザーのうち、ログインユーザーネームが |
| .* |
指定されたポイントから先はすべて。 |
[edit system login class test] user@host# set permissions configure user@host# set deny-configuration "(system login class m .*)" 上記の設定では、テストログインクラスに割り当てられたユーザーのうち、ログインユーザーネームが 同様に、
注:
|
!正規表現運用担当者はサポートされていません。
正規表現の例
表6 は、正規表現を指定する例として、[edit system ntp server] と [edit protocols rip]という2つの設定階層で設定オプションを許可するために使用される正規表現を示しています。
表6 は、すべての設定ステートメントと階層のすべての正規表現とキーワードの包括的なリストを示しているわけではありません。表に示されている正規表現は、 [edit system ntp server] および [edit protocols rip] ステートメント階層でのみ有効です。
| ステートメント階層 |
正規表現 |
許可された設定 |
拒否された設定 |
|---|---|---|---|
|
|
|||
| キー key-number |
[edit system login class test] set permissions configure set allow-configuration-regexps [ "system ntp server .*" "system ntp server .* key .*" ] set deny-configuration-regexps [ "system ntp server .* version .*" "system ntp server .* prefer" ] |
|
|
| バージョン version-number |
[edit system login class test] set permissions configure set allow-configuration-regexps [ "system ntp server .*" "system ntp server .* version .*" ] set deny-configuration-regexps [ "system ntp server .* key .*" "system ntp server .* prefer" ] |
|
|
| 優先 |
[edit system login class test] set permissions configure set allow-configuration-regexps [ "system ntp server .*" "system ntp server .* prefer" ]; set deny-configuration-regexps [ "system ntp server .* key .*" "system ntp server .* version .*" ] |
|
|
|
|
|||
| メッセージサイズ message-size |
[edit system login class test] set permissions configure set allow-configuration-regexps "protocols rip message-size .*" set deny-configuration-regexps [ "protocols rip metric-in .*" "protocols rip route-timeout .*" "protocols rip update-interval .*" ] |
|
|
| メトリックイン metric-in |
[edit system login class test] set permissions configure set allow-configuration-regexps "protocols rip metric-in .*" set deny-configuration-regexps [ "protocols rip message-size .*" "protocols rip route-timeout .*" "protocols rip update-interval .*" ] |
|
|
| ルート-タイムアウト route-timeout |
[edit system login class test] set permissions configure set allow-configuration-regexps "protocols rip route-timeout .*" set deny-configuration-regexps [ "protocols rip metric-in .*" "protocols rip message-size .*" "protocols rip update-interval .*" ] |
|
|
| アップデート-インターバル update-interval |
[edit system login class test] set permissions configure set allow-configuration-regexps "protocols rip update-interval .*" set deny-configuration-regexps [ "protocols rip metric-in .*" "protocols rip route-timeout .*" "protocols rip message-size .*" ] |
|
|
許可設定および拒否設定ステートメントでアクセス権限を定義する方法
以下のタイプのステートメントを組み合わせて使用することで、設定ステートメント階層のアクセス権限を定義することができます。
パーミッションフラグ
allow-configurationおよびdeny-configurationステートメント
パーミッションフラグは、ユーザーまたはログインクラスがアクセスおよび制御できるもののより大きな境界を定義します。 allow-configuration および deny-configuration ステートメントには、特定の設定階層とステートメントを許可または拒否する正規表現が1つ以上含まれています。 allow-configuration ステートメントと deny-configuration ステートメントはパーミッションフラグよりも優先され、ユーザーが表示および設定できる正確な階層とステートメントに対して、管理者は詳細に制御できます。
このトピックでは、 allow-configuration および deny-configuration ステートメントを使用するログインクラス設定の例を示して、これらのステートメントを使用してアクセス権限を定義する方法について説明します。例 1 から 3 は、 deny-configuration ステートメントで定義されたものを除くすべてのコマンドとステートメントにユーザーがアクセスできるようにするログインクラスを作成します。
パーミッションビットとパーミッションフラグは同じ意味で使用されていることに注意してください。
例1
ユーザーがすべてのコマンドを実行し、telnetパラメーター以外のすべてを設定できるログインクラスを作成するには、以下を行います。
例2
ユーザーがすべてのコマンドを実行し、「m」で始まる名前のログインクラス内のステートメント以外のすべてを設定できるログインクラスを作成するには、以下を行います。
-
ユーザーのログインクラスの権限を
allに設定します。[edit system login] user@host# set class all-except-login-class-m permissions all
-
以下の
deny-configurationステートメントをインクルードします。[edit system login class all-except-login-class-m] user@host# set deny-configuration "system login class m.*"
例3
ユーザーがすべてのコマンドを実行し、 [edit system login class] または [edit system services] 階層レベル以外のすべてを設定できるログインクラスを作成するには、以下を行います。
-
ユーザーのログインクラスの権限を
allに設定します。[edit system login] user@host# set class all-except-login-class-or-system-services permissions all
-
以下の
deny-configurationステートメントを含めます。[edit system login class all-except-login-class-or-system-services] user@host# set deny-configuration "(system login class) | (system services)"
次の例は、 allow-configuration ステートメントと deny-configuration ステートメントを使用して、 [edit system services] 階層レベルで互いに逆の権限を決定する方法を示しています。
例4
ユーザーが [edit system services] 階層レベルでのみ完全な設定権限を持つことができるログインクラスを作成するには:
-
ユーザーのログインクラスの許可を
configureに設定します。[edit system login] user@host# set class configure-only-system-services permissions configure
-
以下の
allow-configurationステートメントを含めます。[edit system login class configure-only-system-services] user@host# set allow-configuration "system services"
例5
すべてのコマンドと [edit system services] 階層レベルを除くすべての設定階層に対する完全な権限をユーザーに許可するログインクラスを作成するには、以下を行います。
-
ユーザーのログインクラスの権限を
allに設定します。[edit system login] user@host# set class all-except-system-services permissions all
-
以下の
deny-configurationステートメントを含めます。[edit system login class all-except-system-services] user@host# set deny-configuration "system services"
例:正規表現による追加論理を使用したアクセス権限の指定
この例では、正規表現を使用して設定アクセス権限を設定する際に追加論理を使用する方法を示しています。
要件
この例では、Junos OSリリース16.1以降を実行しているデバイスを使用します。
概要
正規表現を定義して、誰がどの設定を変更できるかを制御できます。これらの正規表現は、ログイン クラスのユーザーがアクセスできる特定の設定階層を示しています。例えば、ユーザーがルーティングインスタンスのグループを変更できる正規表現を定義したり、ユーザーが他のルーティングインスタンスやその他の設定レベルを変更できなくする正規表現を定義したりできます。ログイン クラスに allow-configuration-regexps ステートメントと deny-configuration-regexps ステートメントを設定することで、正規表現を定義します。
デフォルトでは、 deny-configuration-regexps ステートメントが allow-configuration-regexps ステートメントよりも優先されます。設定階層がログインクラスの deny-configuration-regexps ステートメントに表示された場合、 allow-configuration-regexps ステートメントの内容に関係なく、そのクラスのユーザーに表示されません。設定階層が deny-configuration-regexps ステートメントに表示されない場合、 allow-configuration-regexps ステートメントに表示されるとそのクラスのユーザーに表示されます。
*-configuration-regexpsステートメントの追加論理を有効にすることで、このデフォルトの動作を変更できます。追加論理を有効にすると、allow-configuration-regexpsステートメントがdeny-configuration-regexpsステートメントよりも優先されます。
したがって、 deny-configuration-regexps ステートメントが特定のレベル(プロトコル .*)のすべての設定階層へのアクセスを拒否するが、 allow-configuration-regexps ステートメントが1つのサブ階層(プロトコル bgp .*)へのアクセスを許可する場合、デフォルトでは、 deny-configuration-regexps ステートメントが優先されるため、デバイスはそのログイン クラスのユーザーの階層へのアクセスを拒否します。ただし、追加論理を有効にした場合、この場合は allow-configuration-regexps が優先されるため、デバイスはそのログイン クラスのユーザーの指定されたサブ階層へのアクセスを許可します。
設定
ステップバイステップの手順
追加論理が、特定のログインクラスのユーザーに1つ以上の個別の設定階層へのアクセスを明示的に許可できるようにするには:
-
deny-configuration-regexpsステートメントを含め、設定階層へのアクセスを明示的に拒否します。[edit system login class class-name] user@host# set deny-configuration-regexps ["regular expression 1" "regular expression 2" "regular expression 3"]
次に例を示します。
[edit system login class class-name] user@host# set deny-configuration-regexps "protocols .*"
-
allow-configuration-regexpsステートメントを含め、許可する特定の階層の正規表現を定義します。[edit system login class class-name] user@host# set allow-configuration-regexps ["regular expression 1" "regular expression 2" "regular expression 3"]
次に例を示します。
[edit system login class class-name] user@host# set allow-configuration-regexps ["protocols bgp .*" "protocols ospf .*"]
-
allow-configuration-regexpsおよびdeny-configuration-regexps正規表現の追加論理を有効にします。[edit system] user@host# set regex-additive-logic
-
1 人以上のユーザーにログインクラスを割り当てます。
[edit system login] user@host# set user username class class-name
-
変更をコミットします。
このログイン クラスに割り当てられたユーザーは、
allow-configuration-regexpsステートメントに含まれる設定階層にアクセスできますが、deny-configuration-regexpsステートメントで指定された他の階層にはアクセスできません。
regex-additive-logicステートメントを設定すると、すべてのログインクラスに存在するすべてのallow-configuration-regexpsおよびdeny-configuration-regexpsステートメントに動作変更が適用されます。追加論理を有効にした場合、既存のステートメントの影響を評価し、必要に応じて正規表現を更新する必要があります。
使用例
追加論理による正規表現の使用
目的
このセクションでは、システムに適した設定を作成するためのアイデアを提供するため、追加論理を使用した正規表現の例を示します。
特定のルーティングインスタンスの許可
以下のログインクラスの例には、名前が CUST-VRF-で始まるルーティングインスタンスの設定を許可する正規表現が含まれています(例: CUST-VRF-1、 CUST-VRF-25、 CUST-VRF-100など)。この例には、ルーティング インスタンスの設定を防ぐ正規表現も含まれています。
[edit system login class class-name] user@host# set permissions [configure routing-control view view-configuration] user@host# set deny-configuration-regexps "routing-instances .*" user@host# set allow-configuration-regexps "routing-instances CUST-VRF-.* .*"
デフォルトでは、 deny-configuration-regexps ステートメントが優先され、名前に関係なく、ログインクラスのユーザーはルーティングインスタンスを設定できません。
ただし、以下のステートメントを設定した場合は、 allow-configuration-regexps ステートメントが優先されます。そのため、ユーザーは名前が CUST-VRF-で始まるルーティングインスタンスを設定することはできますが、他のルーティングインスタンスを設定することはできません。
[edit system] user@host# set regex-additive-logic
BGPピア設定のみの許可
以下のログイン クラスの例には、 [edit protocols] 階層レベルでの設定を防止するが、BGPピアの設定を許可する正規表現が含まれています。
[edit system login class class-name] user@host# set permissions [configure routing-control view view-configuration] user@host# set deny-configuration-regexps "protocols .*" user@host# set allow-configuration-regexps "protocols bgp group .*"
デフォルトでは、以前の設定によって、ログイン クラスのユーザーは [edit protocols]以下の階層を変更できません。
ただし、以下のステートメントを設定した場合、ログイン クラスのユーザーは BGP ピアを変更できますが、許可された階層レベル以外の他のプロトコルまたは他の BGP ステートメントを設定することはできません。
[edit system] user@host# set regex-additive-logic
検証
アクセス権限を正しく設定したことを確認するには:
-
ログイン クラスを設定し、変更をコミットします。
-
ログインクラスを usernameに割り当てます。
-
新しいログインクラスで割り当てられた username でログインします。
-
許可された階層レベルを設定するように試みます。
-
許可された階層レベルでステートメントを設定できる必要があります。
-
拒否された階層レベルは表示されません。
-
許可または拒否された式は、
permissionsステートメントで付与された権限よりも優先されます。
-
例:動作モードコマンドのアクセス権限を使用したユーザー権限の設定
カスタムログインクラスを設定し、運用モードコマンドのアクセス権限を割り当てる方法を示しています。ログインクラスのユーザーは、アクセス権を持つコマンドのみを実行できます。これにより、権限のないユーザーがネットワークに損害を与える可能性のある機密性の高いコマンドを実行するのを防ぎます。
要件
この例では、以下のハードウェアおよびソフトウェアコンポーネントを使用しています。
-
1台のジュニパーネットワークスデバイス
-
1台のTACACS+(またはRADIUS)サーバー
開始する前に、デバイスとTACACS+サーバーの間のTCP接続を確立します。RADIUSサーバーの場合、デバイスとRADIUSサーバーの間にUDP接続を確立します。
概要とトポロジー
図1 は、ルーターR1がジュニパーネットワークスのデバイスで、TACACS+サーバーとTCP接続を確立している場合のシンプルなトポロジーを示しています。
この例では、R1 を Class1、Class2、Class3 の 3 つのカスタマイズされたログイン クラスで設定します。各クラスは、 permissions ステートメントを設定し、 allow-commands および deny-commands ステートメントを使用して拡張正規表現を定義することで、ユーザーのアクセス権限を定義します。
各ログインクラスの目的は次のとおりです。
-
Class1—
allow-commandsステートメントのみでユーザーのアクセス権限を定義します。このログインクラスは、デバイスの再起動のための運用担当者レベルのユーザー権限と認証を提供します。 -
Class2—
deny-commandsステートメントのみでユーザーのアクセス権限を定義します。このログインクラスは、運用担当者レベルのユーザー権限を提供し、setコマンドへのアクセスを拒否します。 -
Class3—
allow-commandsステートメントとdeny-commandsステートメントの両方でユーザーのアクセス権限を定義します。このログインクラスは、インターフェイスへのアクセスとデバイス情報の表示のためのスーパーユーザーレベルのユーザー権限と認証を提供します。また、editおよびconfigureコマンドへのアクセスも拒否します。
ルーター R1 には、それぞれクラス 1、クラス 2、およびクラス 3 ログイン クラスに割り当てられたユーザー 1、ユーザー 2、およびユーザー 3 という 3 つのユーザーがあります。
設定
- CLIクイックコンフィグレーション
- ルーター R1 の認証パラメーターの設定
- 許可コマンド ステートメント(クラス 1)によるアクセス権限の設定
- 拒否コマンド ステートメント(クラス 2)によるアクセス権限の設定
- 許可コマンドおよび拒否コマンド ステートメント(クラス 3)によるアクセス権限の設定
- 結果
CLIクイックコンフィグレーション
この例を迅速に設定するには、以下のコマンドをコピーしてテキストファイルに貼り付け、改行を削除し、ネットワーク設定に一致させる必要がある詳細情報を変更し、コマンドを [edit] 階層レベルでCLIにコピーアンドペーストして、設定モードで commit を入力します。
R1
set system authentication-order tacplus set system authentication-order radius set system authentication-order password set system radius-server 10.209.1.66 secret "$ABC123" set system tacplus-server 10.209.1.66 secret "$ABC123" set system radius-options enhanced-accounting set system tacplus-options enhanced-accounting set system accounting events login set system accounting events change-log set system accounting events interactive-commands set system accounting traceoptions file auditlog set system accounting traceoptions flag all set system accounting destination tacplus server 10.209.1.66 secret "$ABC123" set system login class Class1 permissions clear set system login class Class1 permissions network set system login class Class1 permissions reset set system login class Class1 permissions trace set system login class Class1 permissions view set system login class Class1 allow-commands "request system reboot" set system login class Class2 permissions clear set system login class Class2 permissions network set system login class Class2 permissions reset set system login class Class2 permissions trace set system login class Class2 permissions view set system login class Class2 deny-commands set set system login class Class3 permissions all set system login class Class3 allow-commands configure set system login class Class3 deny-commands .* set system login user User1 uid 2001 set system login user User1 class Class1 set system login user User1 authentication encrypted-password "$ABC123" set system login user User2 uid 2002 set system login user User2 class Class2 set system login user User2 authentication encrypted-password "$ABC123" set system login user User3 uid 2003 set system login user User3 class Class3 set system login user User3 authentication encrypted-password "$ABC123" set system syslog file messages any any
ルーター R1 の認証パラメーターの設定
ステップバイステップの手順
ルーター R1 の認証を設定するには:
-
R1がユーザーの認証を試みる順序を設定します。この例では、TACACS+ サーバー認証が最初に行われ、次に RADIUS サーバー認証、次にローカルパスワードが続きます。
[edit system] user@R1# set authentication-order tacplus user@R1# set authentication-order radius user@R1# set authentication-order password
-
TACACS+サーバーを設定します。
[edit system] user@R1# set tacplus-server 10.209.1.66 secret "$ABC123" user@R1# set tacplus-options enhanced-accounting user@R1# set accounting destination tacplus server 10.209.1.66 secret "$ABC123"
-
RADIUSサーバーを設定します。
[edit system] user@R1# set radius-server 10.209.1.66 secret "$ABC123" user@R1# set radius-options enhanced-accounting
-
R1 アカウンティング パラメーターを設定します。
[edit system] user@R1# set accounting events login user@R1# set accounting events change-log user@R1# set accounting events interactive-commands user@R1# set accounting traceoptions file auditlog user@R1# set accounting traceoptions flag all
許可コマンド ステートメント(クラス 1)によるアクセス権限の設定
ステップバイステップの手順
allow-commandsステートメントを使用して正規表現を指定するには:
-
クラス1 ログインクラスを設定し、運用担当者レベルのユーザー権限を割り当てます。
[edit system login] user@R1# set class Class1 permissions [clear network reset trace view]
-
クラス内のユーザーがデバイスを再起動できるように、
allow-commands正規表現を設定します。[edit system login] user@R1# set class Class1 allow-commands "request system reboot"
-
クラス1ログインクラスにユーザーアカウントを設定します。
[edit system login] user@R1# set user User1 uid 2001 user@R1# set user User1 class Class1 user@R1# set user User1 authentication encrypted-password "$ABC123"
拒否コマンド ステートメント(クラス 2)によるアクセス権限の設定
ステップバイステップの手順
deny-commandsステートメントを使用して正規表現を指定するには:
-
クラス2ログインクラスを設定し、運用担当者レベルのユーザー権限を割り当てます。
[edit system login] user@R1# set class Class1 permissions [clear network reset trace view]
-
クラス内のユーザーが
setコマンドを実行できないように、deny-commands正規表現を設定します。[edit system login] user@R1# set class Class1 deny-commands "set"
-
クラス2ログインクラスにユーザーアカウントを設定します。
[edit system login] user@R1# set user User2 uid 2002 user@R1# set user User2 class Class2 user@R1# set user User2 authentication encrypted-password "$ABC123"
許可コマンドおよび拒否コマンド ステートメント(クラス 3)によるアクセス権限の設定
ステップバイステップの手順
allow-commandsステートメントとdeny-commandsステートメントの両方を使用して正規表現を指定するには:
-
クラス3ログインクラスを設定し、スーパーユーザーレベルの権限を割り当てます。
[edit system login] user@R1# set class Class3 permissions all
-
クラス内のユーザーがコマンドを実行できなくするために、
deny-commands正規表現を設定します。[edit system login] user@R1# set class Class3 deny-commands ".*"
-
ユーザーが設定モードに入ることを許可するように、
allow-commands正規表現を設定します。[edit system login] user@R1# set class Class3 allow-commands configure
-
クラス3ログインクラスにユーザーアカウントを設定します。
[edit system login] user@R1# set user User3 uid 2003 user@R1# set user User3 class Class3 user@R1# set user User3 authentication encrypted-password "$ABC123"
結果
設定モードで、 show system コマンドを入力して設定を確認します。出力に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@R1# show system
authentication-order [ tacplus radius password ];
radius-server {
10.209.1.66 secret "$ABC123";
}
tacplus-server {
10.209.1.66 secret "$ABC123";
}
radius-options {
enhanced-accounting;
}
tacplus-options {
enhanced-accounting;
}
accounting {
events [ login change-log interactive-commands ];
traceoptions {
file auditlog;
flag all;
}
destination {
tacplus {
server {
10.209.1.66 secret "$ABC123";
}
}
}
}
login {
class Class1 {
permissions [ clear network reset trace view ];
allow-commands "request system reboot";
}
class Class2 {
permissions [ clear network reset trace view ];
deny-commands set;
}
class Class3 {
permissions all;
allow-commands configure;
deny-commands .*;
}
user User1 {
uid 2001;
class Class1;
authentication {
encrypted-password "$ABC123";
}
}
user User2 {
uid 2002;
class Class2;
authentication {
encrypted-password "$ABC123";
}
}
user User3 {
uid 2003;
class Class3;
authentication {
encrypted-password “$ABC123”;
}
}
}
syslog {
file messages {
any any;
}
}
検証
新しいログインクラスで割り当てられたユーザー名でログインし、設定が正しく機能していることを確認します。
クラス1の設定の確認
目的
クラス1ログインクラスで許可される権限とコマンドが機能していることを確認します。
アクション
動作モードで、 show system users コマンドを実行します。
User1@R1> show system users 12:39PM up 6 days, 23 mins, 6 users, load averages: 0.00, 0.01, 0.00 USER TTY FROM LOGIN@ IDLE WHAT User1 p0 abc.example.net 12:34AM 12:04 cli User2 p1 abc.example.net 12:36AM 12:02 -cli (cli) User3 p2 abc.example.net 10:41AM 11 -cli (cli)
動作モードで、 request system reboot コマンドを実行します。
User1@R1> request system ? Possible completions: reboot Reboot the system
意味
ユーザー1が割り当てられたクラス1ログインクラスは、運用担当者レベルのユーザー権限を有しており、クラス内のユーザーは request system reboot コマンドを実行できます。
定義済みの運用担当者ログインクラスには、以下のパーミッションフラグが指定されています。
clear—
clearコマンドを使用して、デバイスがネットワークから学習し、さまざまなネットワークデータベースに保存した情報をクリア(削除)できます。network—
ping、ssh、telnet、tracerouteコマンドを使用してネットワークにアクセスできます。reset—
restartコマンドを使用してソフトウェアプロセスを再開できます。trace—トレースファイルの設定を表示し、トレースファイルのプロパティを構成できます。
view—さまざまなコマンドを使用して、システム全体、ルーティングテーブル、プロトコル固有の現在の値と統計情報を表示できます。シークレット設定は表示できません。
クラス1ログインクラスでは、上記のユーザー権限に加えて、ユーザー1は request system reboot コマンドを実行できます。最初の出力は表示権限を運用担当者として表示し、2 番目の出力は、ユーザー1が運用担当者として実行できる唯一の request system コマンドが request system reboot コマンドであることを示しています。
クラス2設定の確認
目的
クラス 2 ログイン クラスに許可される権限とコマンドが機能していることを確認します。
アクション
動作モードで、 ping コマンドを実行します。
User2@R1> ping 10.209.1.66 ping 10.209.1.66 PING 10.209.1.66 (10.209.1.66): 56 data bytes 64 bytes from 10.209.1.66: icmp_seq=0 ttl=52 time=212.521 ms 64 bytes from 10.209.1.66: icmp_seq=1 ttl=52 time=212.844 ms 64 bytes from 10.209.1.66: icmp_seq=2 ttl=52 time=211.304 ms 64 bytes from 10.209.1.66: icmp_seq=3 ttl=52 time=210.963 ms ^C --- 10.209.1.66 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max/stddev = 210.963/211.908/212.844/0.792 ms
CLI プロンプトから、使用可能なコマンドを確認します。
User2@R1> ? Possible completions: clear Clear information in the system file Perform file operations help Provide help information load Load information from file monitor Show real-time debugging information mtrace Trace multicast path from source to receiver op Invoke an operation script ping Ping remote target quit Exit the management session request Make system-level requests restart Restart software process save Save information to file show Show system information ssh Start secure shell on another host start Start shell telnet Telnet to another host test Perform diagnostic debugging traceroute Trace route to remote host
CLI プロンプトから、任意のセット コマンドを実行します。
User2@R1> set
^
unknown command.
意味
ユーザー2が割り当てられたクラス2ログインクラスは、運用担当者レベルのユーザー権限を持ち、すべての set コマンドへのアクセスを拒否します。
定義済みの運用担当者ログインクラスに指定された権限フラグは、クラス1に指定されたものと同じです。
クラス 3 設定の確認
目的
クラス3ログインクラスに許可される権限とコマンドが機能していることを確認します。
アクション
動作モードで、使用可能なコマンドを確認します。
User3@R1> ? Possible completions: configure Manipulate software configuration information
構成モードにします。
User3@R1> configure Entering configuration mode [edit] User3@R1#
意味
ユーザー3に割り当てられたクラス3ログインクラスは、スーパーユーザー(すべての)権限を持っていますが、このクラスはユーザーに configure コマンドの実行のみを許可します。このクラスは、他のすべての動作モード コマンドへのアクセスを拒否します。 allow/deny-commands ステートメントで指定された正規表現はユーザー権限よりも優先されるため、R1上のユーザー3は設定モードにのみアクセスでき、他のすべての動作モードコマンドへのアクセスが拒否されます。
例:設定ステートメントと階層のアクセス権限を持つユーザーパーミッションの設定
この例では、カスタムログインクラスを設定し、特定の設定階層にアクセス権限を割り当てる方法を示しています。ログインクラスのユーザーは、アクセス権を持つ設定ステートメントと階層のみを表示および変更できます。これにより、不正ユーザーがデバイス設定を変更してネットワークに損害を及ぼす可能性があることを防ぎます。
要件
この例では、以下のハードウェアおよびソフトウェアコンポーネントを使用しています。
-
1台のジュニパーネットワークスデバイス
-
1台のTACACS+(またはRADIUS)サーバー
開始する前に、デバイスとTACACS+サーバーの間のTCP接続を確立します。RADIUSサーバーの場合、デバイスとRADIUSサーバーの間にUDP接続を確立します。
概要とトポロジー
図2 は、ルーターR1がジュニパーネットワークスのデバイスで、TACACS+サーバーとのTCP接続を確立している場合のシンプルなトポロジーを示しています。
この例では、R1 に 2 つのカスタマイズされたログイン クラス(クラス 1 とクラス 2)を設定します。各クラスは、 permissions ステートメントを設定し、 allow-configuration、 deny-configuration、 allow-configuration-regexps、および deny-configuration-regexps ステートメントを使用して拡張正規表現を定義することで、ユーザーのアクセス権限を定義します。
各ログインクラスの目的は次のとおりです。
-
Class1—
allow-configurationおよびdeny-configurationステートメントでユーザーのアクセス権限を定義します。このログインクラスは、[edit interfaces]階層を設定するためのアクセスのみを提供し、デバイス上の他のすべてのアクセスを拒否します。これを行うには、ユーザーのパーミッションには設定アクセスを提供するconfigureが含まれます。さらに、allow-configurationステートメントはインターフェイス設定へのアクセスを許可し、deny-configurationステートメントは他のすべての設定階層へのアクセスを拒否します。許可ステートメントは拒否ステートメントよりも優先されるため、クラス1ログインクラスに割り当てられたユーザーは、[edit interfaces]階層レベルにのみアクセスできます。 -
Class2—
allow-configuration-regexpsおよびdeny-configuration-regexpsステートメントでユーザーのアクセス権限を定義します。このログインクラスは、スーパーユーザーレベルのユーザー権限を提供し、インターフェイスの複数の階層レベルでの設定を明示的に許可します。また、[edit system]および[edit protocols]階層レベルへのアクセスも拒否します。
ルーターR1には、それぞれクラス1とクラス2のログインクラスに割り当てられたユーザー1とユーザー2の2人のユーザーがいます。
設定
- CLIクイックコンフィグレーション
- ルーター R1 の認証パラメーターの設定
- 許可設定および拒否設定ステートメント(クラス1)によるアクセス権限の設定
- allow-configuration-regexpsおよびdeny-configuration-regexpsステートメント(クラス2)でアクセス権限を設定します。
- 結果
CLIクイックコンフィグレーション
この例を迅速に設定するには、以下のコマンドをコピーしてテキストファイルに貼り付け、改行を削除し、ネットワーク設定に一致させる必要がある詳細情報を変更し、コマンドを [edit] 階層レベルでCLIにコピーアンドペーストして、設定モードで commit を入力します。
R1
set system authentication-order tacplus set system authentication-order radius set system authentication-order password set system radius-server 10.209.1.66 secret "$ABC123" set system tacplus-server 10.209.1.66 secret "$ABC123" set system radius-options enhanced-accounting set system tacplus-options enhanced-accounting set system accounting events login set system accounting events change-log set system accounting events interactive-commands set system accounting traceoptions file auditlog set system accounting traceoptions flag all set system accounting destination tacplus server 10.209.1.66 secret "$ABC123" set system login class Class1 permissions configure set system login class Class1 allow-configuration "interfaces .* unit .*" set system login class Class1 deny-configuration .* set system login class Class2 permissions all set system login class Class2 allow-configuration-regexps [ "interfaces .* description .*" "interfaces .* unit .* description .*" "interfaces .* unit .* family inet address .*" "interfaces.* disable" ] set system login class Class2 deny-configuration-regexps [ "system" "protocols" ] set system login user User1 uid 2004 set system login user User1 class Class1 set system login user User1 authentication encrypted-password "$ABC123" set system login user User2 uid 2006 set system login user User2 class Class2 set system login user User2 authentication encrypted-password "$ABC123" set system syslog file messages any any
ルーター R1 の認証パラメーターの設定
ステップバイステップの手順
ルーター R1 の認証を設定するには:
-
R1がユーザーの認証を試みる順序を設定します。この例では、TACACS+ サーバー認証が最初に行われ、次に RADIUS サーバー認証、次にローカルパスワードが続きます。
[edit system] user@R1# set authentication-order tacplus user@R1# set authentication-order radius user@R1# set authentication-order password
-
TACACS+サーバーを設定します。
[edit system] user@R1# set tacplus-server 10.209.1.66 secret "$ABC123" user@R1# set tacplus-options enhanced-accounting user@R1# set accounting destination tacplus server 10.209.1.66 secret "$ABC123"
-
RADIUSサーバーを設定します。
[edit system] user@R1# set radius-server 10.209.1.66 secret "$ABC123" user@R1# set radius-options enhanced-accounting
-
R1 アカウンティング パラメーターを設定します。
[edit system] user@R1# set accounting events login user@R1# set accounting events change-log user@R1# set accounting events interactive-commands user@R1# set accounting traceoptions file auditlog user@R1# set accounting traceoptions flag all
許可設定および拒否設定ステートメント(クラス1)によるアクセス権限の設定
ステップバイステップの手順
allow-configurationおよびdeny-configurationステートメントを使用して正規表現を指定するには:
-
Class1 ログインクラスを
configure権限で設定します。[edit system login] user@R1# set class Class1 permissions configure
-
クラス内のユーザーが
[edit interfaces]階層レベルの一部を表示および変更できるように、allow-configuration正規表現を設定します。[edit system login] user@R1# set class Class1 allow-configuration "interfaces .* unit .*"
-
deny-configuration正規表現を設定して、すべての設定階層へのアクセスを拒否します。[edit system login] user@R1# set class Class1 deny-configuration .*
-
クラス1ログインクラスにユーザーアカウントを設定します。
[edit system login] user@R1# set user User1 uid 2004 user@R1# set user User1 class Class1 user@R1# set user User1 authentication encrypted-password "$ABC123"
allow-configuration-regexpsおよびdeny-configuration-regexpsステートメント(クラス2)でアクセス権限を設定します。
ステップバイステップの手順
allow-configuration-regexpsおよびdeny-configuration-regexpsステートメントを使用して正規表現を指定するには:
-
クラス2ログインクラスを設定し、スーパーユーザー(all)パーミッションを割り当てます。
[edit system login] user@R1# set class Class2 permissions all
-
allow-configuration-regexps正規表現を設定して、クラス内のユーザーが[edit interfaces]階層レベルの下で複数の階層にアクセスできるようにします。[edit system login] user@R1# set class Class2 allow-configuration-regexps [ "interfaces .* description .*" "interfaces .* unit .* description .*" "interfaces .* unit .* family inet address .*" "interfaces.* disable" ]
-
クラス内のユーザーが
[edit system]および[edit protocols]階層レベルで設定を表示または変更できないように、deny-configuration-regexps正規表現を設定します。[edit system login] user@R1# set class Class2 deny-configuration-regexps [ "system" "protocols" ]
-
クラス2ログインクラスにユーザーアカウントを設定します。
[edit system login] user@R1# set user User2 uid 2006 user@R1# set user User2 class Class2 user@R1# set user User2 authentication encrypted-password "$ABC123"
結果
設定モードで、 show system コマンドを入力して設定を確認します。出力に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@R1# show system
authentication-order [ tacplus radius password ];
radius-server {
10.209.1.66 secret "$ABC123";
}
tacplus-server {
10.209.1.66 secret "$ABC123";
}
radius-options {
enhanced-accounting;
}
tacplus-options {
enhanced-accounting;
}
accounting {
events [ login change-log interactive-commands ];
traceoptions {
file auditlog;
flag all;
}
destination {
tacplus {
server {
10.209.1.66 secret "$ABC123";
}
}
}
}
login {
class Class1 {
permissions configure;
allow-configuration "interfaces .* unit .*";
deny-configuration .*;
}
class Class2 {
permissions all;
allow-configuration-regexps [ "interfaces .* description .*" "interfaces .* unit .* description .*" "interfaces .* unit .* family inet address .*" "interfaces.* disable" ];
deny-configuration-regexps [ "system" "protocols" ];
}
user User1 {
uid 2001;
class Class1;
authentication {
encrypted-password "$ABC123";
}
}
user User2 {
uid 2002;
class Class2;
authentication {
encrypted-password "$ABC123";
}
}
}
syslog {
file messages {
any any;
}
}
検証
新しいログインクラスで割り当てられたユーザー名でログインし、設定が正しく機能していることを確認します。
クラス1の設定を確認する
目的
クラス1 ログインクラスで許可されたパーミッションが機能していることを確認します。
アクション
動作モードで、使用可能なコマンドを確認します。
User1@R1> ? Possible completions: clear Clear information in the system configure Manipulate software configuration information file Perform file operations help Provide help information load Load information from file op Invoke an operation script quit Exit the management session request Make system-level requests save Save information to file set Set CLI properties, date/time, craft interface message start Start shell test Perform diagnostic debugging
設定モードで、使用可能な設定パーミッションを確認します。
User1@R1# edit ? Possible completions: > interfaces Interface configuration
意味
最初の出力に見られるように、User1 は configure ユーザー権限を持っています。さらに、設定モードでは、User1は interfaces 階層レベルにアクセスできますが、2番目の出力に見られるように、その階層レベルのみにアクセスできます。
クラス2の設定を確認する
目的
クラス2の設定が想定どおりに機能していることを確認します。
アクション
設定モードで、 interfaces 設定にアクセスします。
[edit interfaces] User2@R1# set ? Possible completions: <interface-name> Interface name + apply-groups Groups from which to inherit configuration data + apply-groups-except Don't inherit configuration data from these groups ge-0/0/3 Interface name > interface-range Interface ranges configuration > interface-set Logical interface set configuration > traceoptions Interface trace options
設定モードで、 system および protocols の設定階層にアクセスします。
User2@R1# edit system
^
Syntax error, expecting <statement> or <identifier>.
User2@R1# edit protocols
^
Syntax error, expecting <statement> or <identifier>.
意味
User2はR1でインターフェイスを設定する権限を持っていますが、 [edit system] または [edit protocols] 階層レベルを表示または変更する権限を持っていません。
変更履歴テーブル
サポートされる機能は、使用しているプラットフォームとリリースによって決まります。 機能エクスプローラー を使用して、機能がお使いのプラットフォームでサポートされているかどうかを確認します。
allow-commands-regexps および
deny-commands-regexps ステートメントがTACACS+認証にサポートされています。