CLI Agent

 


  1. What is craft interface? Is craft interface support available in all OSs?

  2. What is the difference between Telnet and TCP interface?

  3. Does Character Mode agent support all interfaces?

  4. Does Multi-protocol CLI agent support Character Mode?

  5. What are the command line features supported in CLI agent?

  6. What are the topics covered in help?

  7. Does the CLI Agent support Telnet Server according to any standards?

  8. What are the various emulation modes in which the agent has been tested?

  9. What is the default character echo settings?

  10. What are the column width settings supported by the agent?

  11. What is the command history buffer size?

  12. Why PuTTY client cannot be used to connect WebNMS CLI Agent with SSH support?

  13. I need to provide an warning or information message when a user tries to establish a telnet client session after the maximum telnet client sessions has been reached. How to do it?

  14. How to bind the Telnet interface of CLI Agent to a specific IpAddress of the system?

  15. I need to develop a command "reboot" which should be executed only after getting the confirmation from the user. How it can be achieved in CLI Agent?

  16. What can be the size of the password and is there any complexity checking?


 

1. What is craft interface? Is craft interface support available in all OSs?

 

Craft interface is a local interface to the agent. It receives input message from user on console and passes it to CLI engine. Craft Interface support is not available in all OSs.

Questions

 

2. What is the difference between Telnet and TCP interface?

 

In TCP Interface, connect the client to the agent using system telnet server. In Telnet Interface, connect the client to the agent using our own telnet sever implementation. It supports command line features.

Questions

 

3. Does Character Mode agent support all interfaces?

 

Yes, it supports all interfaces. However, Character mode execution is supported in craft and telnet interfaces. In TCP and serial interfaces press the character followed by enter key.

Questions

 

4. Does Multi-protocol CLI agent support Character Mode?

 

No, it supports only string mode execution.

Questions

 

5. What are the command line features supported in CLI agent?

 

CLI agent supports Command Line editing, Command History, Command completion, and "?" operation.

Questions

 

6. What are the topics covered in help?

 

CLI Help covers syntax, optional description, general description, usage, example, and related commands.

Questions

 

7. Does the CLI Agent support Telnet Server according to any standards?

 

Yes, the CLI Agent has implemented the Telnet Server as specified in RFC 854.

Questions

 

8. What are the various emulation modes in which the agent has been tested?

 

The Agent has been tested in the following terminal settings:

Questions

9. What is the default character echo settings?

 

By default the character echo is set "off" on the client side.

Questions

 

10. What are the column width settings supported by the agent?

 

The default column width value is set as 80 character. This value will be used when pressing the tab key to list command codes. It is independent of the client terminal session settings. The agent supports the following column width terminal settings:

Questions

11. What is the command history buffer size?

 

By default, the command history buffer size is 40. If required, you can configure the size of the history by modifying the value of the macro CLI_COMMAND_HISTORY_SIZE available in the clicmdshell.h file present under <WebNMS>\C-Agent\projects\<project name>\agent\source\protocols\cli\include directory.

Questions

 

12. Why PuTTY SSH client cannot be used to connect to WebNMS CLI Agent with SSH support?

 

Generally, all the Linux based operating systems supports either OpenSSH or ssh.com SSH-2 private keys. Also, libSSH uses these private keys. But PuTTY doesn't natively have the support for reading OpenSSH or ssh.com SSH-2 private keys. For more information, refer to PuTTY's FAQ.

Questions

 

13. I need to provide an warning or information message when a user tries to establish a telnet client session after the maximum telnet client sessions has been reached. How to do it?  

 

This can be done by adding new code snippet in CLIServerSessions() function available in clisession.c file present under "projects/<project-name>/agent/source/protocols/cli/src" directory.

The code snippet highlighted in blue needs to be added in the else part of the following if condition.

 

if(serverNode->numOfClientsCnt < serverNode->maxNumOfClients)

{
....
.....
}
else
{
    if(__Strcasecmp(serverNode->tpName,"CRAFT") && __Strcasecmp(serverNode->tpName,"RS232"))
                            {
                                ERRMSG2("MAX number of %s connections reached!\n",serverNode->tpName);
                                
serverNode->transportProvider->write((U_CHAR*)"\r\nMAX CONN REACHED\r\n",__Strlen("\r\nMAX CONN REACHED\r\n"),clientSockPtr);
                                
serverNode->transportProvider->close(clientSockPtr, CLIENT_SESSION,0);
                                FREE_IF_NOT_NULL( clientSockPtr );
                            }
}

 

Questions

 

14. How to bind the Telnet interface of CLI Agent to a specific IpAddress of the system?

 

Suppose, if the user's system has two IpAddress in it and if the CLI Agent's Telnet interface has to be bound to a specific IpAddress, then the command line option '-ci' can be used while starting the agent. For more information, refer to Building CLI Agents -> Creating a Simple Agent in String Mode -> Starting and Stopping of CLI Agent topic

Questions

 

15. I need to develop a command "reboot" which should be executed only after getting the confirmation from the user. How it can be achieved in CLI Agent?

 

This can be implemented by doing some custom instrumentation in the clisession.c file present under the "<project-name>/agent/source/protocols/cli/src" directory. Define a integer variable say "rebootflag" in clisession.h. Follow the code snippet given below on the implementation for the asking for confirmation

 

 

DEBUGMSG3("LAST MSG RCVD TIME  %d  : %ld",clientSesPtr->sessionID,clientSesPtr->lastMsgRcvdTime);

 

/* REBOOT/LOGOUT command confirmation - START */

 

if((cliSesInfoPtr->rebootFlag==1) )

{

if(curChar == 89)

{

EnQueueCLIMessageInRcvQ(clientSesPtr->sessionID,"logout",__Strlen("logout"));

cliSesInfoPtr->mode=STRING_MODE_ENTRY;

}

else

{

cliSesInfoPtr->mode=STRING_MODE_ENTRY;

cliSesInfoPtr->rebootFlag=0;

CLIPrompt(clientSesPtr->sessionID);

}

}

else if(msgBuff[0]==13 && !(__Strcmp(temp,"logout")))

{

cliSesInfoPtr->rebootFlag=1;

cliSesInfoPtr->mode=CHARACTER_MODE_ENTRY;

EnQueueCLIMessageInTxQ(clientSesPtr->sessionID,(U_CHAR*)"\r\nDo you want to continue:",__Strlen("\r\nDo you want to continue:"));

}

else

{

if(EnQueueCLIMessageInRcvQ( clientSesPtr->sessionID,(U_CHAR *)temp,retLen) != SUCCESS)

{

DEBUGMSG1("Error in  enqueueing message");

}

}

/* REBOOT/LOGOUT command confirmation END */

......

.....

cliSesInfoPtr->createSessionTime = 0;

 

/* REBOOT/LOGOUT command confirmation - START */

 

cliSesInfoPtr->rebootFlag = 0;

 

/* REBOOT/LOGOUT command confirmation END */

 

InitCircularQueue(&cliSesInfoPtr->cmdHistory,CLI_COMMAND_HISTORY_SIZE,FreeHistoryRecord);

 

 

Once the user presses 'Y', the agent should execute the corresponding action() function and if any other key is pressed then the agent should return to the CLI prompt.

Questions

 

16. What can be the size of the password and is there any complexity checking?

 

The size of the user password should be between 6 and 10 characters (both including). There should be at least one lower case alphabet, one upper case alphabet and one number. If you want to change the default behaviour, refer the "CheckPasswordComplexity()" function in cliusersecu.c file

Questions

 



Copyright © 2012, ZOHO Corp. All Rights Reserved.