Debugging: tracing the Server Channel command in syslog

The server channel handles downloading the commands to retrieve and then execute your script.   Use the "tail" command as shown to see the script command in real time.

remoteit package

pi@raspberrypi:~ $ tail -f /var/log/syslog | grep -i "Server Channel"
Jul 28 21:27:32 raspberrypi connectd: Server Channel Send SC!80:00:00:00:01:05:9c:5e!CMD!0CD84FFF-24A1-FC0F-2D70-814EECDF4080!api.remot3.it/apv/v27/!cd /tmp;curl -Lks https://$3/t/7rlNDMLeNqw -o Cloak-SSH.sh;chmod +x /tmp/Cloak-SSH.sh;/tmp/Cloak-SSH.sh $2 $3 EZ1xX2o2YUX

connectd package

pi@raspberrypi:~ $  tail -f /var/log/syslog | grep "Server Channel" 
Jul 28 14:49:07 Old-Gigabyte Connectd[16012]: Server Channel Send SC!80:00:00:05:3a:00:4b:21!CMD!355DAFD7-7994-3DC6-9683-36970CE399F8!api.remot3.it/apv/v27/!cd /tmp;curl -Lks https://$3/t/QVFXmU7qx98 -o Get-Pi-Status.sh;chmod +x /tmp/Get-Pi-Status.sh;/tmp/Get-Pi-Status.sh $2 $3 4qrLPFdGX0g

In both cases, the resulting command string can be broken into the following sections:

Command header

SC!

Service ID

80:00:00:00:01:05:9c:5e!

Protocol

CMD!

Task ID ($2)

0CD84FFF-24A1-FC0F-2D70-814EECDF4080!

API URL ($3)

api.remot3.it/apv/v27/!

Linux Command string

The Linux command string uses the Task ID for its first parameter and the API URL for the second parameter.

cd /tmp; Execute in the /tmp folder
curl -Lks https://$3/t/7rlNDMLeNqw -o Cloak-SSH.sh; Download the script and give it the correct name
chmod +x /tmp/Cloak-SSH.sh; Make the script executable
/tmp/Cloak-SSH.sh $2 $3 EZ1xX2o2YUX

Execute the script using the following parameters:

  • Task ID
  • API URL
  • Short code

The short code is used as the Server Channel daemon has a limited buffer size.  In scripts which use the short code, this has to be translated via an API call to expand the full command line.

 

 

Was this article helpful?
0 out of 0 found this helpful