cancel
Showing results for 
Search instead for 
Did you mean: 

failsafe account configuration script

failsafe account configuration script

Justsomebodi
New Contributor III
Hi Guys

I have the below script which is suppose to set the failsafe and admin account passwords. It however just hangs at the first line; Disable clipaging

#@MetaDataStart
#@DetailDescriptionStart
#############################################################################################
# Define your user parameters in this section. For reference, see bundled scripts.
##############################################################################################
#@DetailDescriptionEnd
#@MetaDataEnd
#Enter all CLI commands from here
disable clipaging
#Set failsafe-account
config failsafe-account
regexp {.*enter failsafe user name:.*} ${CLI.OUT} foundfailsafe1
IF ([info exists foundfailsafe1]) THEN
CLI FailSafeAccount
ENDIF
regexp {.*enter failsafe password:.*} ${CLI.OUT} foundfailsafe2
IF ([info exists foundfailsafe2]) THEN
CLI FailSafePassword
ENDIF
regexp {.*enter password again:.*} ${CLI.OUT} foundfailsafe3
IF ([info exists foundfailsafe3]) THEN
CLI FailSafePassword
ENDIF
configure failsafe-account permit all
#Configure Local Admin password
configure account "admin" password
regexp {.*Current user's password:.*} ${CLI.OUT} AdminAccount1
IF ([info exists AdminAccount1]) THEN
CLI Admin
ENDIF
regexp {.*New password:.*} ${CLI.OUT} AdminAccount2
IF ([info exists AdminAccount2]) THEN
CLI AdminPassword
ENDIF
regexp {.*Reenter password:.*} ${CLI.OUT} AdminAccount3
IF ([info exists AdminAccount3]) THEN
CLI AdminPassword
ENDIF
regexp {.*overwrite it?.*} ${CLI.OUT} foundit1
IF ([info exists foundit1]) THEN
CLI yes
ENDIF
save
regexp {.*overwrite it?.*} ${CLI.OUT} foundit2
IF ([info exists foundit2]) THEN
CLI yes
ENDIF

enable clipaging

so the question is, can this be scripted? Any ideas?

Thanks
10 REPLIES 10

Zdeněk_Pala
Extreme Employee

Hi,

If you are doing the configuration from Extreme Management Center then I believe the issue is the following:

After each command execution, the Extreme Management Center does wait for prompt.

The prompt is defined in CLIRules.xml

We need to create myCLIRules.xml and handle the prompt properly.

 

The other option is to use Python and instruct the send function to not wait for the prompt.

emc_cli.send( 'configure failsafe-account', False)

emc_cli.send( 'failUser', False)

emc_cli.send( 'failPassword', False)

emc_cli.send( 'failPassword', False)

 

Regards Zdeněk Pala

Chad_Smith1
Extreme Employee
The problem here seems to be that the "configure failsafe-account" command requires an interactive prompt. The switch/script is waiting for you to enter the user and password and times out. Try a simpler approach to entering that info just by adding it to the next lines after the command:

configure failsafe-acount


So the same concept applies to the local admin accounts as well. This script is attempting to read CLI.OUT and respond. That isn't necessary. Just simply enter the responses for the prompted input line by line.

#@MetaDataStart
#@DetailDescriptionStart
#############################################################################################
# Define your user parameters in this section. For reference, see bundled scripts.
##############################################################################################
#@DetailDescriptionEnd
#@MetaDataEnd
#Enter all CLI commands from here
disable clipaging
#Set failsafe-account
configure failsafe-account


configure failsafe-account permit all
#Configure Local Admin password
configure account "admin" password



enable clipaging

i try that with an XMC Script and also failed.

CLI configure failsafe-account deny all
CLI configure failsafe-account permit serial

CLI configure failsafe-account
CLI failsafe
CLI abcd1234
CLI abcd1234

Test run:

CLI Login: admin
X440G2-48p-10G4 10.1.1.211 08/26/2019 04:41:45 PM at 04:41:45 PM
04:41:45 PM
X440G2-48p-10G4.1 # configure failsafe-account deny all
X440G2-48p-10G4.2 #

X440G2-48p-10G4.2 # configure failsafe-account permit serial
X440G2-48p-10G4.3 #

Error: session exceeded timeout: 30 secs
Error: session exceeded timeout: 30 secs
Error: session exceeded timeout: 30 secs
enter password again:
X440G2-48p-10G4.4 #

It seems XMC does not recognize switch prompt.
GTM-P2G8KFN