この製品のマニュアルセットは、偏向のない言語を使用するように配慮されています。このマニュアルセットでの偏向のない言語とは、年齢、障害、性別、人種的アイデンティティ、民族的アイデンティティ、性的指向、社会経済的地位、およびインターセクショナリティに基づく差別を意味しない言語として定義されています。製品ソフトウェアのユーザーインターフェイスにハードコードされている言語、RFP のドキュメントに基づいて使用されている言語、または参照されているサードパーティ製品で使用されている言語によりドキュメントに例外が存在する場合があります。シスコのインクルーシブランゲージに対する取り組みの詳細は、こちらをご覧ください。
このドキュメントは、米国シスコ発行ドキュメントの参考和訳です。リンク情報につきましては、日本語版掲載時点で、英語版にアップデートがあり、リンク先のページが移動/変更されている場合がありますことをご了承ください。あくまでも参考和訳となりますので、正式な内容については米国サイトのドキュメントを参照ください。
この章では、ACS 5.5 の Monitoring and Report Viewer コンポーネントで提供される Web サービスを使用するために設定する必要がある環境について説明します。以降、Viewer Web サービスと記載します。これらの Web サービスを使用して、ACS イベントのトラッキングおよびトラブルシューティングを行うカスタム アプリケーションを作成できます。
Viewer Web サービスは、次のメソッドで構成されています。
• getVersion():Monitoring and Report Viewer サーバのバージョンを返します。
• getAuthenticationStatusByDate():日付別のユーザの認証ステータスを返します。
• getAuthenticationStatusByTimeUnit():時間別のユーザの認証ステータスを返します。
• getFailureReasons():失敗の理由のリストを返します。
• getRadiusAccounting():RADIUS アカウンティング レコードのリストを返します。
• getAPIVersion():Viewer Web サービスのバージョンを返します。
ACS CLI での Web インターフェイスのイネーブル化
Viewer Web サービスを使用する前に、ACS で Web インターフェイスをイネーブルにする必要があります。ACS で Web インターフェイスをイネーブルにするには、ACS CLI から次のように入力します。
acs config web-interface コマンドの詳細については、次の URL を参照してください。
http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.5/command/
reference/cli_app_a.html#wp1887278
ACS CLI からの Web インターフェイスのステータス表示
Web インターフェイスのステータスを表示するには、ACS CLI から次のように入力します。
show acs-config-web-interface コマンドの詳細については、次の URL を参照してください。
http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.5/command/
reference/cli_app_a.html#wp1890877
ここでは、Monitoring and Report Viewer Web サービスの使用方法について説明します。
ここでは、Viewer Web サービスで使用できるメソッドについて説明します。
表 3-1 で、Viewer Web サービスで使用されるクラスについて説明します。
|
|
---|---|
Monitoring and Report Viewer サーバがユーザの認証に使用する ACS ユーザ名とユーザ パスワードが含まれます。 |
|
Web サービスで問題が発生した場合に Monitoring and Report Viewer が表示するエラーが含まれます。 |
(注) Monitoring and Report Viewer では、すべての Web サービス クラスが com.cisco.acsview.nbapi パッケージに含まれます。
getVersion メソッドを使用して、ACS サーバにインストールされている Monitoring and Report Viewer のバージョンを表示します。このコマンドを CLI で入力して Web サービスを呼び出すと、Monitoring and Report Viewer のバージョンを表示できます。
• userCtx:(必須)ユーザ コンテキスト オブジェクト
• authParam:(必須)AuthenticationParam オブジェクト
• startDate:(必須)認証ステータスを取得する日付範囲の開始日付
• endDate:(必須)認証ステータスを取得する日付範囲の終了日付
getAuthenticationStatusByDate メソッドを使用して、指定された期間のユーザの認証ステータスを日付の古い方から順に表示します。
• userCtx:(必須)ユーザ コンテキスト オブジェクト
• authParam:(必須)AuthenticationParam オブジェクト
• lastX:(必須)認証ステータスを取得する時間範囲の終了時刻
• timeUnit:(必須)分、時間、または日数で指定した時間単位
getAuthenticationStatusByTimeUnit メソッドを使用して、指定された期間のユーザの認証ステータスを時刻の古い方から順に表示します。
• userCtx:(必須)ユーザ コンテキスト オブジェクト
• acctParam:(必須)アカウンティング検索パラメータ。有効な matchOperator の値は、valueLIKE、valueEQ、valueNE、valueGE、valueLE、valueGT、valueLT、attrEQ、valueIN、valueINNOT。式の形式は、次のいずれかになります。
– AttributeName, MatchArgument, MatchOp=[ valueLIKE | valueEQ | valueNE | valueGE | valueLE | valueGT | valueLT | attrEQ]
– AttributeName, MultipleValueMatchArgument, MatchOp=[ valueIN | valueINNOT ]
Attribute Name:標準 RADIUS/Cisco A-V ペア名で定義されているとおり。属性名では大文字と小文字が区別されません。ただし、値では大文字と小文字が区別されます。
valueLIKE:ワイルドカードによる一致(%)を検索。%foo% など。
attrEQ:指定された属性と別の属性を比較し、true または false を返す。
valueIN:matchOperator が valueIN の場合、複数の値を許可する。
valueINNOT:matchOperator が valueINNOT の場合、複数の値を許可しない。
• returnAttributes:(必須)要求された属性の戻りリスト。
• startDate:(必須)RADIUS アカウンティング レコードを取得する日付範囲の開始日付。
• endDate:(必須)RADIUS アカウンティング レコードを取得する日付範囲の終了日付。
getRADIUSAccounting メソッドを使用して、RADIUS アカウンティング レコードのリストを取得します。
• acctParam パラメータの matchOperator に無効な値が含まれている
ここでは、WSDL ファイル、WSDL ファイルをダウンロードできる場所、クラス ファイル、および Viewer Web サービスで使用できるクエリーについて説明します。この項の構成は、次のとおりです。
• 「Viewer Web サービスとアプリケーションの統合」
https: // ip address or hostname /ACSViewWebServices/ACSViewWebServices?wsdl。ここで、 ip address or hostname は、ACS サーバの IP アドレスまたはホスト名です。
WSDL は、Web サービス、サービスの場所、およびサービスが公開する操作を記述する XML ドキュメントです。
ここでは、Viewer Web サービスとアプリケーションを統合する方法について説明します。
コードを Viewer Web サービスと統合し、Web サービスの起動後に応答を受け取るようにするには、次の手順に従います。
ステップ 1 サーバから証明書を取得し、クライアント証明書を作成します。
a. 次の URL から、展開されている Web サービスを確認します。
https:// ip address or hostname /ACSViewWebServices/ACSViewWebServices?wsdl
Web サービスの詳細については、「Viewer Web サービスのメソッドについて」を参照してください。
b. [View Certificate] をクリックし、 [Details] タブに移動します 。
d. [Welcome] ウィンドウで、[Next] をクリックします。
e. [Export File Format] ウィンドウで、[DER encoded binary X.509(.CER)] を選択し、[Next] をクリックします。
f. [File to Export] ウィンドウで、ファイル名を入力し、[Next] をクリックします。
g. [Completing the Certificate Export Wizard] ウィンドウで、[Finish] をクリックします。
証明書が server.cer としてローカル システムに保存されます。
h. 次のコマンドを使用して、サーバ証明書をインポートし、 client.ks (クライアント証明書)として保存します。
keytool -import -file server.cer -keystore client.ks
ステップ 2 次の URL から、展開されている Viewer Web サービスを確認します。
https:// IPaddress(or)HostName /ACSViewWebServices/ACSViewWebServices?wsdl
Web サービスの詳細については、「Viewer Web サービスのメソッドについて」を参照してください。
ステップ 3 次のコマンドを使用して、ソースを表示し、ローカル システムに WSDL ファイルをコピーします。
soap:address location='https:// acsview-cars1:443 /ACSViewWebServices/ACSViewWebServices'/
WSDL ファイルの詳細については、「WSDL ファイルについて」を参照してください。
ステップ 4 Sun Microsystems の Web サイトから JAX-WS 2.0 ライブラリをダウンロードします。
ステップ 5 アーティファクトに関連する情報を表示するために、次の場所で wsimport -keep コマンドを入力します 。 https:// IPAddress:443 /ACSViewWebServ/ACSViewWebServices?wsdl
ステップ 7 クライアント コードをコンパイルして実行します。
ここでは、Java のクライアント コードの例を示します。ここで説明する要件は、クライアント側の変換ツールとして Java を使用する場合にのみ適用されます。この項の構成は、次のとおりです。
Java(JAX-WS)2.0 をクライアント側の変換ツールとして使用するには、次の JAR ファイルが必要です。 .jar ファイルおよび関連ツールは、Sun Microsystems の Web サイトからダウンロードできます。
Viewer Web サービスに接続するには、次の手順に従います。
ステップ 1 次の URL から、展開されている Viewer Web サービスを確認します。
https:// ip address or hostname /ACSViewWebServices/ACSViewWebServices?wsdl
Web サービスの詳細については、「Viewer Web サービスのメソッドについて」を参照してください。
ステップ 2 右クリックして [View Source/View Page Source] オプションを選択し、ソース情報を表示します。
ソース情報はポップアップ ダイアログボックスに表示されます。
ステップ 3 ソース情報をローカル ディレクトリ <SERVICE_HOME> に、ACSViewWebServices.wsdl という名前で保存します。
ステップ 4 次のコマンドを実行して、クラス ファイルを作成します。
ステップ 5 「クライアント コードの例」をコピーして、Client.java として <SERVICE_HOME> に保存し、次のコマンドを使用してコンパイルします。
これでクライアント コードがコンパイルされ、<SERVICE_HOME> ディレクトリにパッケージが保存されます。
ステップ 6 クライアント コードを実行するには、次のコマンドを実行します。
(注) 上記の手順は、Java 1.6.0_25 で実行します。JAVA_HOME は java のインストール ディレクトリで、「path」環境変数に値 <JAVA_HOME>/bin を追加する必要があります。
ここでは、Viewer Web サービスのクライアント コードの例を示します。
package com.cisco.acsview.nbapi.jaws;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.datatype.DatatypeFactory;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class Client
{
private static void install() throws Exception
{
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]
{
new X509TrustManager()
{
public X509Certificate[] getAcceptedIssuers()
{
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType)
{
// Trust always
}
public void checkServerTrusted(X509Certificate[] certs, String authType)
{
// Trust always
}
}
};
// Install the all-trusting trust manager
SSLContext sc = SSLContext.getInstance("SSL");
// Create empty HostnameVerifier
HostnameVerifier hv = new HostnameVerifier()
{
public boolean verify(String arg0, SSLSession arg1)
{
return true;
}
};
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(hv);
}
public static void install1() throws Exception
{
// Bypass hostname verification.
HttpsURLConnection.setDefaultHostnameVerifier(
new HostnameVerifier()
{
public boolean verify(String arg0, SSLSession arg1)
{
return true;
}
});
}
public static void main(String args[])
{
try
{
install();
ACSViewWebServicesService serviceObj = new ACSViewWebServicesService();
ACSViewWebServices service = serviceObj.getACSViewWebServices();
UserContext userCtx = new UserContext();
userCtx.setUserName("acsadmin");
userCtx.setPassword("Acs5.5");
getVersion(service,userCtx);
getAPIVersion(service,userCtx);
getAuthBydate(service,userCtx);
getAuthByTime(service,userCtx);
getRadiusAccounting(service,userCtx);
getFailureReasons(service,userCtx);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
/**
* getVersion provide the application version
*/
public static void getVersion(ACSViewWebServices service, UserContext userCtx)
{
try
{
String result = service.getVersion(userCtx);
System.out.println("-------------------------*** Application Version
***-------------------------"+"\n");
System.out.println("Application Version : "+result);
System.out.println("-----------------------------------------------------------------------------"+"\n");
}
catch(Exception e)
{
e.printStackTrace();
}
}
/**
*getAuthByDate provides the data of the authentication success/failure between
the specified date range
*/
private static void getAuthBydate(ACSViewWebServices service, UserContext userCtx)
{
try
{
System.out.println("-------------------------*** Authentication Status by
Date Starts ***-------------------------"+"\n");
AuthenticationParam authParam = new AuthenticationParam();
/**
*** The following Attributes are optional.
** If the parameters are not set, method will return all the authentications
success/failure between the specified date range.
** The Data will be filtered based on the attribute set which is falling
under the specified date range.
** The attributes set are exactly matched for filtering,ie., only the data
which is matching the below attributes
and with in the specified date range are retrived.
*/
authParam.setAAAClient("MyClient");
authParam.setClientIPAddress("10.77.241.203");
authParam.setClientMACAddress("ABAC00019E05");
authParam.setUserName("user1");
/******* Optional Attributes Ends **************/
DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
GregorianCalendar gc1 = newGregorianCalendar(2011, Calendar.AUGUST, 4);
XMLGregorianCalendar startDate =
datatypeFactory.newXMLGregorianCalendar(gc1).normalize();
GregorianCalendar gc2 = newGregorianCalendar(2011, Calendar.AUGUST, 6);
XMLGregorianCalendar endDate =
datatypeFactory.newXMLGregorianCalendar(gc2).normalize();
java.util.List authStatusArray =
service.getAuthenticationStatusByDate(userCtx,authParam, startDate, endDate);
System.out.println("No of Records Retrieved : "+authStatusArray.size());
for(int i=0; i<authStatusArray.size();i++)
{
System.out.println("*************** Authentication Status : "+(i+1)+"
***************");
AuthenticationStatus status = (AuthenticationStatus)authStatusArray.get(i);
java.util.List sarray = status.getMoreDetails();
System.out.println(sarray.get(0) +" :: "+sarray.get(1));
for(int j=0;j<sarray.size();j++)
{
System.out.println(sarray.get(j)+" :: "+sarray.get(++j));
}
System.out.println("******************************************************************");
}
System.out.println("-------------------------*** Authentication Status by
Date Ends ***-------------------------"+"\n");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
/**
* getAuthByTime provides the data of the authentication success/failure in the
specified time.
* Time can be provided in Minutes, Hours or Days
*/
private static void getAuthByTime(ACSViewWebServices service, UserContext userCtx)
{
try
{
System.out.println("-------------------------*** Authentication Status by
Time Starts ***-------------------------"+"\n");
AuthenticationParam authParam = new AuthenticationParam();
/**
*** The following Attributes are optional.
** If the parameters are not set method will return all the authentications
success/failure between the specified date range.
** The Data will be filtered based on the attribute set which is falling
under the specified date range.
** The attributes set are exactly matched for filtering,ie., only the data
which is matching the below attributes
and with in the specified date range are retrived.
*/
authParam.setAAAClient("MyClient");
authParam.setClientIPAddress("10.77.241.203");
authParam.setClientMACAddress("ABAC00019E05");
authParam.setUserName("user1");
/******* Optional Attributes Ends **************/
java.util.List authStatusArray =
service.getAuthenticationStatusByTimeUnit(userCtx,authParam, 20, "Hours");
System.out.println("No of Records Retrieved : " + authStatusArray.size());
for(int i=0; i<authStatusArray.size();i++)
{
System.out.println("*************** Authentication Status : "+(i+1)+"
***************");
AuthenticationStatus status = (AuthenticationStatus)authStatusArray.get(i);
java.util.List sarray = status.getMoreDetails();
System.out.println(sarray.get(0) +" :: "+sarray.get(1));
for(int j=0;j<sarray.size();j++)
{
System.out.println(sarray.get(j)+" :: "+sarray.get(++j));
}
System.out.println("******************************************************************");
}
System.out.println("-------------------------*** Authentication Status by
Time Ends ***-------------------------"+"\n");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
/**
** getAPIVersion provides the application API Version
*/
public static void getAPIVersion(ACSViewWebServices service, UserContext userCtx)
{
try
{
System.out.println("-------------------------*** API Version
***-------------------------"+"\n");
String apiresult = service.getAPIVersion(userCtx);
System.out.println("API Version : "+apiresult);
System.out.println("-----------------------------------------------------------------------------"+"\n");
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
/**
** getFailureReasons provide the Failure Code, Possible Root Cause and Resolution
*/
public static void getFailureReasons(ACSViewWebServices service, UserContext
userCtx)
{
try
{
// Get Failure reason - Example
System.out.println("-------------------------*** Failure Reasons Starts
***-------------------------"+"\n");
List result1 = service.getFailureReasons(userCtx);
System.out.println("Failure reasons list is : " + result1.size());
for (int i=0;i<result1.size() ;i++ )
{
System.out.println("Authentication Failure Code :
"+((FailureReason)result1.get(i)).getAuthenFailureCode());
System.out.println("Possible Root Cause :
"+((FailureReason)result1.get(i)).getPossibleRootCause());
System.out.println("Resolution :
"+((FailureReason)result1.get(i)).getResolution());
}
System.out.println("-------------------------*** Failure Reasons Ends
***-------------------------"+"\n");
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
/**
** getRadiusAccounting provides the accounting details between the specified
date range.
*/
public static void getRadiusAccounting(ACSViewWebServices service, UserContext
userCtx)
{
try
{
System.out.println("-------------------------*** Radius Accounting Starts
***-------------------------"+"\n");
List acctParam = new ArrayList();
AccountingParam acParam = new AccountingParam();
List valList = acParam.getMatchValues();
valList.add("11");
acParam.setAttributeName("cisco-h323-disconnect-cause/h323-disconnect-cause");
acParam.setMatchOperator("valueINNOT");
acctParam.add(acParam);
List returnAttributes = new ArrayList();
returnAttributes.add("cisco-h323-disconnect-cause/h323-disconnect-cause");
DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
GregorianCalendar gc1 = newGregorianCalendar(2011, Calendar.AUGUST, 5);
XMLGregorianCalendar startDate =
datatypeFactory.newXMLGregorianCalendar(gc1).normalize();
GregorianCalendar gc2 = newGregorianCalendar(2011, Calendar.AUGUST, 7);
XMLGregorianCalendar endDate =
datatypeFactory.newXMLGregorianCalendar(gc2).normalize();
AccountingStatus acctStatus = service.getRadiusAccounting(userCtx,acctParam,
startDate, endDate, returnAttributes);
List attrNames = acctStatus.getAttrNames();
for(int x=0 ; x<attrNames.size() ; x++)
{
System.out.println("Attribute Names : "+attrNames.get(x));
}
List acctDetailsList = (ArrayList)acctStatus.getAcctDetails();
Iterator detailIterator = acctDetailsList.iterator();
while(detailIterator.hasNext())
{
AccountingDetail acctDetailObj = (AccountingDetail)detailIterator.next();
List acctDetails = (List)acctDetailObj.getAttrValues();
for (int i=0;i<acctDetails.size() ;i++ )
{
System.out.println("Attribute Details : "+acctDetails.get(i));
}
}
System.out.println("-------------------------*** Radius Accounting Ends
***-------------------------"+"\n");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}