cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Popup Hotspot Using ISR 1000 with WiFi/LTE for Teleworkers and Micro Branchesr

command over sms

7354
Views
5
Helpful
21
Comments

Attached policy provides CLI access to the Cisco 4G router over text messaging.   Two files are in the attached .tar file:

1.  commandoversms.tcl

2.  PDF with instructions on how to load and use the .tcl file.

Comments
Cisco Employee

Hi @Andreas Foerby 

Thank you for the feedback.   I can see where this feature would be useful.   I have added version 3.1 of this script to deny user configurable CLI commands over SMS.   Users can make a list of CLI commands in the router CLI by executing this command:  "event manager environment denysms "list of deny commands, separated by comma"
 
 

example "event manager environment denysms "write erase, configure"

 

This takes regular expression pattern as well so same line could be written as

"event manager environment denysms "wr[a-z]+ er[a-z]+, conf[a-z]+"

Beginner

Hi @Daniel Frey 

 

Thanks for quick response! 

I have uploadet the new version to the router, removed the old one and I did run a few tests.. 

It do catch the "denysms" and sends it to the console, but it is also executing the commands.. 

Se below: 

 

event manager environment removeprefix 45
event manager environment whitelist (XXXXXXXX)|(XXXXXXXX)
event manager environment denysms "conf[a-z]+ ter[a-z]+, wr[a-z]+ er[a-z]+"
event manager directory user policy "flash:/"
event manager policy commandoversms3-1.tcl type user

Jul 1 18:33:47.025: Cellular0: New SMS received on index 4 . Please issue a view command to see it
Jul 1 18:33:48.577: %HA_EM-6-LOG: commandoversms3-1.tcl: received SMS from XXXXXXXX : Wr erase
Jul 1 18:33:48.625: %HA_EM-6-LOG: commandoversms3-1.tcl: denysms variable exists
Jul 1 18:33:48.645: %HA_EM-6-LOG: commandoversms3-1.tcl: sms-cmd: Wr erase
Jul 1 18:33:53.261: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
Jul 1 18:33:53.693: %HA_EM-6-LOG: commandoversms3-1.tcl: SMS sent = RTR# Erase of nvram: complete [OK] Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
Jul 1 18:33:53.693: %HA_EM-6-LOG: commandoversms3-1.tcl: ---------------------------------------------------------------------------------------
Jul 1 18:33:54.161: sms_delete_by_id, msg_id = 7 message_index = 4
Jul 1 18:33:54.337: %HA_EM-6-LOG: commandoversms3-1.tcl: Successfully deleted SMS message 4 from SIM
Jul 1 18:33:54.553: %CELLWAN-2-SMS_ARCH_PATH_UNCONFIGURED: Cellular0 failed to archive SMS because 'gsm|cdma|lte sms archive path' under cellular controller is not configured.
Jul 1 18:33:54.553: %CELLWAN-5-OUTGOING_SMS_SENT: Cellular0 has just sent an outgoing SMS successfully.

Cisco Employee

I believe this is because the command sent did not match the regular expression.  You sent "Wr erase" and your regexp is "wr[a-z]+ er[a-z]+ .   Regexp [a-z]+ means one or more in the range of a-z.   It will match on "Wr" but nothing is matching on [a-z]+ so regexp did not match.   Two ways to address this condition.

 

1.   Change regexp to "w[a-z]+ er[a-z]+" and send same SMS syntax.   

2.  Keep regexp the same but send "Wri erase".    The "i" will meet the requirement of one or more for [a-z]+.

 

 

 

Beginner

Hi @Daniel Frey 

 

You nailed it..! 

 

I changed the regexp to:

- event manager environment denysms "conf t, con[a-z]+ t[a-z]+, w[a-z]+ e[a-z]+" 

 

Thank you for your time and help on this! 

 

/Andreas Foerby

Beginner

I upgraded the IOS to 159-3.M this script stopped working. Any help is greatly appreciated.

Cisco Employee

Can you provide some details of what is not working, log messages, ect....    I just loaded 15.9.3M and its working for me.

C819-Tmobile#

*Dec  9 18:19:17.523: Cellular0: New SMS received on index 1 . Please issue a view command to see it

*Dec  9 18:19:17.523: %CELLWAN-2-SMS_ARCH_PATH_UNCONFIGURED: Cellular0 failed to archive SMS because 'gsm|cdma|lte sms archive path' under cellular controller is not configured.

*Dec  9 18:19:18.623: %HA_EM-6-LOG: commandoversms3-1.tcl: received SMS from XXXXXXXXX : Show clock

*Dec  9 18:19:18.639: %HA_EM-6-LOG: commandoversms3-1.tcl: denysms variable exists

*Dec  9 18:19:18.655: %HA_EM-6-LOG: commandoversms3-1.tcl: sms-cmd: Show clock

*Dec  9 18:19:18.899: %HA_EM-6-LOG: commandoversms3-1.tcl: SMS sent = C819-XXXXXX# C819-Tmobile# *14:19:18.663 EDT Mon Dec 9 2019

*Dec  9 18:19:18.899: %HA_EM-6-LOG: commandoversms3-1.tcl: ---------------------------------------------------------------------------------------

*Dec  9 18:19:19.135: sms_delete_by_id, msg_id = 0 message_index = 1

*Dec  9 18:19:19.203: %CELLWAN-2-SMS_ARCH_PATH_UNCONFIGURED: Cellular0 failed to archive SMS because 'gsm|cdma|lte sms archive path' under cellular controller is not configured.

*Dec  9 18:19:19.203: %CELLWAN-5-OUTGOING_SMS_SENT: Cellular0 has just sent an outgoing SMS successfully.

*Dec  9 18:19:19.243: %HA_EM-6-LOG: commandoversms3-1.tcl: Successfully deleted SMS message 1 from SIM

C819-Tmobile#

C819-Tmobile#

C819-Tmobile#show ver

Cisco IOS Software, C800 Software (C800-UNIVERSALK9-M), Version 15.9(3)M, RELEASE SOFTWARE (fc5)

Technical Support: http://www.cisco.com/techsupport

Copyright (c) 1986-2019 by Cisco Systems, Inc.

Compiled Tue 13-Aug-19 17:42 by prod_rel_team