Taking Automated Action via Unencrypted SMS¶
Previously, support for SMS-initiated action was limited to managing PPP on a Local Manager. The SMS message was encrypted and therefore had to be sent via the Lantronix Control Center.
In LMS 6.2, support for unencrypted SMS messages was added. This not only allows for the message to be sent from any cell phone or email client, but also means the message can be accessed by the rules engine, allowing the Local Manager to take automated actions that you specify.
Why use Unencrypted SMS?¶
Currently, only the Lantronix Control Center is able to send encrypted SMS messages. If one or both of your Control Centers were to go down or become isolated, there would be no way to turn on PPP at remote sites via SMS. It is not possible to send encrypted messages manually via text or email.
Unencrypted SMS-initiated PPP is a failsafe feature that allows you to turn on PPP without a Control Center.
Since the SMS message can be anything, the rules engine can use it to trigger any automated actions we currently support.
Security¶
Please be aware of the following security notes:
- The original SMS-initiated PPP feature is not affected and will continue to operate independently.
- The default smsPppOn rule will not respond to an unencrypted message (unless modified to do so).
Best practices:
- Use the SMS message as an obfuscated codeword rather than a plaintext instruction (i.e., use f91#ba9z3 instead of pppOn).
Requirements¶
Requirements for using this capability are:
- The Local Manager uses a GSM cellular modem or an Iridium modem.
- The Local Manager has been configured with a phone number and SMS domain name. These are configured with the config answer command.
- An SMS modem monitor has been configured on the modem with an accompanying rule that tells the Local Manager to take an action when a valid SMS message is received.
Configure Number and Domain Settings¶
Using the config answer editor, set the Local Manager's phone number with the number subcommand, and use the domain subcommand to set the service provider's SMS domain name. The Lantronix Control Center uses these parameters to construct a valid SMS email address, to which it can send the ppp on message to establish contact.
Iridium Example¶
[admin@LantronixLM (modem)]# config answer
[config answer]# number 881652234392
[config answer]# domain msg.iridium.com
[config answer]# exit
AT&T Example¶
[admin@LantronixLM (modem)]# config answer
[config answer]# number 5125551234
[config answer]# domain txt.att.net
[config answer]# exit
Configure Rule¶
In this example, we will be modifying the default smsPppOn rule to allow activation by an unencrypted SMS message of our choosing.
The default rule:
[admin@LantronixLM]# show rule smsPppOn
rule smsPppOn
action pppOn
conditions
sms.command equals pppOn
exit
exit
The existing condition needs an OR operator added, so retype it along with a new condition:
[admin@LantronixLM]# config rule smsPppOn
[config rule smsPppOn]# conditions
[config rule smsPppOn conditions]# sms.command equals pppOn OR
[config rule smsPppOn conditions]# sms.message matches .*pickles2022.*
[config rule smsPppOn conditions]# exit
[config rule smsPppOn]# exit
In the above example, we've added a new condition called sms.message and used the matches argument to compare it to pickles2022. Note the use of the dot-star REGEX to help with matching.
The modified rule should look like this:
[admin@LantronixLM]# show rule smsPppOn
rule smsPppOn
action pppOn
conditions
sms.command equals pppOn OR
sms.message matches .*pickles2022.*
exit
exit
Schedule SMS Monitor¶
CC: Inventory > Local Manager Summary > Schedule
To activate PPP when an SMS message is received, the Local Manager must be configured to check for messages. This can be accomplished with the config monitor sms command and our modified smsPppOn rule.
[admin@LantronixLM (modem)]# config monitor sms smsPppOn :60
Validate scheduled monitor(sms)? (This will execute the job now.) (y/n): y
Job was scheduled 8: [Interval: 00:00:60 Mask: * * * * *] rulesMonitor sms none smsPppOn 60
Note
The sms monitor must be running and the appropriate rule attached for this feature to work.
Activate PPP via SMS¶
Use your phone (or email client via SMS gateway) to send the message "pickles2022" to your Local Manager's phone number. Once the message is received and processed by the sms monitor, the Local Manager will perform the actions specified in the rule.
Extending Functionality¶
If you are trying to automate something other than PPP, you can start with this empty rule:
[admin@LantronixLM]# show rule textReceived
rule textReceived
conditions
sms.message matches .*operationFalconer.*
exit
exit
The "operationFalconer" can be anything you'd like, and you can choose from any supported actions to finish out the rule:
- emailSystemLog
- outband
- power
- powerCycle
- pullConfig
- pushConfig
- reboot
- restartSystem
- writeStatus
- execute
- alarm
- and more...
Let's add an alarm to this rule:
[admin@LantronixLM]# config rule textReceived
[config rule textReceived]# action alarm GENERIC -a "Operation Falconer is a GO!"
[config rule textReceived]# exit
[admin@LantronixLM]# show rule textReceived
rule textReceived
action alarm GENERIC -a "Operation Falconer is a GO!"
conditions
sms.message matches .*operationFalconer.*
exit
exit
Note that these actions will run on the modem resource, so not all of them are applicable. We can, however, use rule variables to signal other monitors running on other ports so that a single text message could issue a reboot of all connected devices! 😬
You can then schedule the monitor and rule as normal:
[admin@LantronixLM (modem)]# config monitor sms textReceived :60
Validate scheduled monitor(sms)? (This will execute the job now.) (y/n): y
Job was scheduled 8: [Interval: 00:00:60 Mask: * * * * *] rulesMonitor sms none textReceived 60
Questions?¶
As with any feature that uses the Rules Engine, the Lantronix Technical Services team is standing by to assist you with configuration and testing. Drop us a line and let us know how we can help!