shell
Shell
This guide describes the shell utility nw-shell that can be used to troubleshoot the operations of NetWitness management services like security-server, investigate-server, and correlation-server. It is the equivalent of the NwConsole utility used to interact with NetWitness capture services like Decoders and Concentrators. The shell utility is independent of the business logic of the service, and works the same with most NetWitness services.
Features
The nw-shell utility implements the following features:
- Supports secure connections to the local NetWitness service instances.
- Supports navigation of the service tree to explore its operational state (for more information, see Tree View).
- Provides an intuitive display of configuration, metrics, and health-check information to help with troubleshooting.
- Supports scripting to automate simple administration tasks in field deployments.
- Supports Linux, OSX and Windows terminals.
Installation
The nw-shell utility can be installed with the rsa-nw-shell RPM as shown here:
$ sudo yum install rsa-nw-shell $ /usr/local/bin/nw-shell ████████ ██████ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ RSA NetWitness Shell. Version: 4.0.0 See "help" to list available commands, "help connect" to get started. offline »
Usage
The primary goal of nw-shell is to help a human operator explore the runtime state of a NetWitness service. It is, essentially, an interactive program that invokes APIs on running NetWitness services. Each NetWitness service includes a system API that exposes its runtime state as a logical tree. The shell leverages the Tree API structure to present a hierarchical view of a service that is similar to a file system view. Users can navigate the tree by using the cd command to access directories, and can view or modify the corresponding configuration at the location, or invoke API methods and view the current state of components in the node.
The set of commands available to users at a given time depend on the current shell context, for example, their placement inside the logical tree. Certain commands, however, are always available, and we begin with a description of those commands.
System Commands
Shell system commands operate on the shell itself, instead of the nodes of a connected service. These commands are always available.
- Command:
help [] - Function: Provides help on available commands or a particular command.
- Example:
helporhelp connect
- Command:
clear - Function: Clears the screen (shortcut Ctrl-l).
- Example:
clear
- Command:
exitorquit - Function: Exits the shell.
- Example:
quit
- Command:
history - Function: Displays the history of previously-run commands.
- Example:
history
- Use the
helpto explore the available commands. It is always available. nw-shellsupports tab completion of a command, and the applicable parameter names wherever possible. For example, pressing the Tab key after typingecompletes the command toexit.nw-shellalso supports a non-interactive mode where it executes scripts from a provided file, used by specifying the absolute filepath prefixed by the@argument. See Shell for details.
Available Commands
Built-In Commands clear: Clear the shell screen. exit, quit: Exit the shell. help: Display help about available commands. history: Display or save the history of previously run commands script: Read and execute commands from a file. stacktrace: Display the full stacktrace of the last error. Context Commands * cd: Change the current node. Usage: cd
connect: Connect to a service. One of --service or --port must be specified.Usage: connect [--service
[.
]] [--broker amqp://localhost/rsa/system] [--host localhost] [--port] [--insecure false] * where: Which service shell is connected to? Token Commands login: Authenticate to a service. Usage: login [connect-parameters] login-insecure: Authenticate to a service providing user and password on the command prompt. The password is recorded in the shell history so this command must be used with care.Usage: login-insecure --user
--password
[connect-parameters] * logout: Clear the authentication context: logout * whoami: Who am I? Tree Node Commands * json: Print the current node as a JSON string * show: Pretty print the current node Tree Node List Commands * config: Summarize configuration of the current subtree * health: Summarize health of the current subtree * ls: List the children of the current node. Usage: ls [
] [--values] [--types] * lsv: Shorthand for ls --values. Usage: lsv [
] [--types] * method: Summarize methods of the current subtree * metrics: Summarize metrics of the current subtree * snapshot: Snapshot the current subtree Tree Node Method Commands * invoke: Invokes the method that exists on the current method type node. Usage: invoke [argument] [--file jsonfile] Tree Node Value Commands * get: Get the value of the current node * set: Set the value of the current node. Usage: set
Commands marked with (*) are currently unavailable. Type `help
` to learn more.
Help, History Command Usage
offline » help connect connect - Connect to a service. One of --service or --port must be specified. Usage: connect [--service
[.
]] [--broker amqp://localhost/rsa/system] [--host localhost] [--port] [--insecure false] ... ... offline » history help help connect history offline »
You can navigate previously-typed commands in nw-shell by using the Up and Down arrow keys, which can help minimize typing by recalling previously-executed commands.
Authentication Commands
As an administration and monitoring tool, it is important that nw-shell authenticates users before handing them control over a running service. The following commands manage the shell authentication context:
- Command:
login - Function: Authenticates and retains tokens for future interactions.
- Command:
logout - Function: Clears the security context and token.
- Command:
whoami - Function: Prints a summary of the current identity.
The login command can be used to authenticate the user and establish an identity. Service operators can log in once (against the NetWitness Security Server) and then use the token to connect to multiple services and perform administration based on the roles assigned. This single-sign-on workflow is simplified by separating the login and connect commands to allow the operator to authenticate once (using login) and then switch services seamlessly using connect.
In general, the login command takes the same parameters as connect (described below) to specify the service that performs the credential validation. For example:
offline » login user: admin password: ******** admin@offline » connect --service respond-server INFO: Connected to respond-server (23e1dab7-0658-41a5-bb1e-d716a37d5ea5) admin@respond-server:Folder:/rsa » admin@respond-server:Folder:/rsa » connect --service investigate-server INFO: Connected to investigate-server 2f21db20-4b50-48cf-8f7f-c0be0d1d1d12) admin@investigate-server:Folder:/rsa »
The current logged-in identity can be confirmed at any point using the whoami command. For example:
admin@offline » whoami
- Column 1:
Subject - Column 2:
admin
- Column 1:
Issued ByIssued AtExpires AfterRoles - Column 2:
security-server-ebeb90da-761b-4f14-b9ec-30410499d2b82018-10-04T17:22:52.041Z2018-10-05T05:22:52.041Z[ebeb90da-761b-4f14-b9ec-30410499d2b8]
The shell security context can be cleared by using the logout command.
security-server:Folder:/rsa » logout security-server:Folder:/rsa » whoami You are not logged in.
Some operations, such as setting certain configuration properties or invoking a method, require a certain RBAC. To perform such privileged operations, you need to authenticate with an identity that has the necessary permissions. For example:
security-server:Configuration » /rsa/logging/operations/max-file-count » get 10 security-server:Configuration:/rsa/logging/operations/max-file-count » set 15 ERROR: Failed to set the node value: Access is denied security-server:Configuration:/rsa/logging/operations/max-file-count » login user: admin password: ********** admin@security-server:Configuration:/rsa/logging/operations/max-file-count » set 15 security-server:Configuration:/rsa/logging/operations/max-file-count » get 15
Context-Changing Commands
The following commands change the current shell context.
- Command:
connect - Function: Connect to a service
- Options:
servicehost,port,http,broker - Examples:
connect --service security-server.d6a55b48...
- Command:
cd - Function: Change context to a node
- Options:
- Examples:
cd /rsa/security,cd ../sys,cd ..,cd
Connecting to a Service
The shell can connect to services over AMQP or HTTP(S), however, AMQP is the preferred and default option.
To connect to a specific instance of a service, name and serviceId needs to be supplied in the format:connect --service {service-name}.{serivceId}
For example, foo-server.d6a55b48-6103-46bd-9ead-3b4d589b302b.
If the service identifier is skipped, it is assumed to be any, for example, connect --service foo-server will connect with any service named foo-server that is connected to the AMQP broker.
Change Node
The cd command can be used to change the current node. Just like cd on a file system shell, it takes relative or absolute paths as input and changes the current context to the node at that path.
offline » cd Command 'cd' was found but is not currently available because you are not connected to any service. offline » connect security-server:Folder:/rsa » cd log security-server:Folder:/rsa/logging » cd ../security security-server:Component:/rsa/security » cd /rsa/security/fips-mode security-server:Configuration:/rsa/security/fips-mode » cd security-server:Folder:/rsa »
The shell prompt summarizes and presents the user’s current context. It starts off with offline, and once the shell is connected to a service, it displays the service name it is connected to, and the type and the path of the current node. Once the user is authenticated, the userId is included in the prompt.
Invoking cd before connecting to a service reminds the user that some commands work only in certain contexts.
Note: Some commands are available only in certain contexts. For example, cd works only when the shell is online. The Help command lists all the commands, but commands marked with (*) are unavailable in the given context.
Certain node-specific commands are enabled only when the current node is of a certain type. For example, method nodes support a command invoke, which is not enabled for any other node type.
Node Display Commands
The following commands are available with all node types. They do not take any arguments, and display the node details for the user to review.
- Command:
show - Function: Pretty-print the current node.
- Command:
json - Function: Print the current node as a JSON string.
For example:
security-server:Configuration:/rsa/security/authentication/token-lifetime » show
- Column 1:
Configuration - Column 2:
/rsa/security/authentication/token-lifetime
- Column 1: value
valueType
defaultValue
description - Column 2: 10 hours
com.rsa.asoc.launch.api.helpers.Seconds
10
The time-to-live on a token.
security-server:Configuration » /rsa/security/authentication/token-lifetime » json { "path" : "/rsa/security/authentication/token-lifetime", "type" : "Configuration", "value" : "10 HOURS", "parent" : { "path" : "/rsa/security/authentication", "type" : "Component" }, "attributes" : { "defaultValue" : 10, "valueType" : "com.rsa.asoc.launch.api.helpers.Seconds", "description" : "The time-to-live on a token." } }
The output of json dumps the API payload and may contain more details than those shown by show.
Node Value Commands
Configuration, Metric and Health nodes have values. Their current values can be obtained using the get command.
- Command:
get - Function: Get the current value of the node.
- Examples:
- Command:
set - Function: Update the value of the node.
- Examples:
set false,set '{"enabled": false}'
For example:
security-server:Gauge:/rsa/process/hostname » get "hostxyz.corp.emc.com" security-server:Gauge:/rsa/process/hostname » cd /rsa/transport/http/secure security-server:Configuration:/rsa/transport/http/secure » get true
The value of a Configuration node can be changed by invoking the set command. For example:
admin@security-server:Configuration:/rsa/security/pki/tls-protocols » show
- Column 1:
Configuration - Column 2:
/rsa/security/pki/tls-protocols
- Column 1: value
valueType
description - Column 2: [TLSv1.2]
java.lang.String[]
This property controls the TLS protocol versions supported by the applications.
admin@security-server:Configuration:/rsa/security/pki/tls-protocols » set '["SSLv3"]' admin@security-server:Configuration:/rsa/security/pki/tls-protocols » value [ "SSLv3" ]
Node List Commands
Folder, Component and Method nodes can contain other nodes as their children. You can use the ls command to list the children nodes, their types, and where available, their current values.
- Comman , values:
lsv - Column 2: Shorthand for
ls--values - Column 3:
types - Column 4:
lsv metricsls name:fips
invoke command will invoke the method. For example:, , , , , , , then
invoke will invoke the
method with given parameters., , , , , , , , , , , , , , , , , , , , , , , in cases where the input contains any special characters such as \, \n, \r, \t , ", the input needs to be properly escaped with a backslash (\)., payload can be supplied with a file reference. In this case, payload does not need any special escaping., , , , commands like
health,
metrics,
config or
snapshot can be used to retrieve the current state of the service at the current node, and all the sub-folders under the current node., , , , , and the all the sub-folders, under the current node., , , , , , , , , , , , , make sure that the relevant APIs are exposed. You can perform following actions using these APIs., , , , , , , , priority, risk score, status, alert count, etc. The
invoke command returns all the incidents with the matching criteria., for example, filter by name or priority. Depending on the load, a large number of results might cause the request time-out., , , , , "
", "
invoke command returns the alert with the matching criteria., for example, filter by name or type. Depending on the load, a large number of results might cause the request time-out., , , , , "
", "
-
"]', , the output returns all the alert fields., , , the alerts_req.txt file contains the following information., "Event Stream Analysis", "20", "alert.severity"], , , , "Event Stream Analysis", "20", "alert.severity"], , "Event Stream Analysis", "20", "null"], , , , , , , , , , , "603dcc5091e818391ee57e1d","603dcc5091e818391ee57e1c", "603dcc5091e818391ee57e1e"]', , , , you can specify the add alert query in an input file., , , , , the /tmp/add_alerts.txt file contains the following information., , "603dcc5091e818391ee57e1d","603dcc5091e818391ee57e1c", "603dcc5091e818391ee57e1e"], 603dcc5091e818391ee57e1e) to be added to the incident mentioned in the first parameter., , , , , , , , , , , , , "603dcc5091e818391ee57e1d","603dcc5091e818391ee57e1c", "603dcc5091e818391ee57e1e"]', , , , you can specify the delete alert query in an input file., , , , , the file /tmp/delete_alerts.txt file contains the following information., , "603dcc5091e818391ee57e1d","603dcc5091e818391ee57e1c", "603dcc5091e818391ee57e1e"], 603dcc5091e818391ee57e1e) to be removed from the incident mentioned in the first parameter., , , , , , , , and all the sub-folders, under the current node., , , , , , , , , , , ,
/rsa/tree/node/get/invoked 14 shows that the method
get is invoked
14 times, and
timer shows that it took on average
5666541.077918259 nano seconds to process the
get request., , , such as rate of requests, for the current node for per-minute and five minutes. For example:, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
configuration, and
health of the current state of the service node and all the sub-folders under the current node. This command is very useful for troubleshooting purposes. When opening a support case, take a
snapshot dump at the root node
\rsa of a service that might be having issues, and attach it to the case., , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , it is usually best to use the service published APIs., , , , you can use the fix-keystore command to fix this issue. This command reads the keystore file of the services running on the host and attempts to reestablish trust with the NetWitness Platform CA. For example, the following is the command to repair the respond-server 's keystore:, , , for example, keystore.p12.good. If no fixes can be made to the keystore, this command does not write the new keystore.p12.good file., the system admin can restore the service’s communication by renaming keystore.p12.good to keystore.p12 and restart the service., , only a few key attributes of the certificates are printed to the file. For example, the following command prints the respond-server's keystore certificates., , , , , , , , restore keystore.p12.new to keystore.p12, and restart the service., , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , 30 mins, 30 m, 5 seconds, 5 sec, 5s,5, 8000 milliseconds, or 8000 ms (ms = milliseconds). , ,
%s) for three strings which are replaced, in order, by:, , it only disables colors used by
nw-shell in its output. The underlying libraries that the program uses may still output some text in color., , , , , , , , , , ,