Belt And Suspenders

Version 3 (Christian Meloche, 03/08/2010 04:16 pm)

1 1
h1. Belt And Suspenders
2 1
3 2 Christian Meloche
The system is composed of a single bash script running on every client and a secured web server. 
4 2 Christian Meloche
5 2 Christian Meloche
The client script is names watchdog, it depends on curl and auto generates the needed certificate files. It also assumes that /dev/shm is an available ramdisk. The philosophy is that the code should remain simple as it may be the only thing left to gain access to the device. The scripts it invokes should be dynamic but watchdog should be as stable and static as possible. 
6 2 Christian Meloche
7 2 Christian Meloche
Watchdog post its mac adress on  a cgi on the server at a defined rate to see if a new message was posted for action.
8 2 Christian Meloche
9 2 Christian Meloche
The line returned from the cgi will either be "not so much" or a specific number of action lines. In most cases the action have unixtime as parameter. This ensure that they will now be executed twice.
10 2 Christian Meloche
11 2 Christian Meloche
12 2 Christian Meloche
The format of these lines are as followed: 
13 2 Christian Meloche
 <pre>
14 2 Christian Meloche
       ||PROJECT|SITE|ACTION|PARAM1,PARAM2,PARAM3...|
15 2 Christian Meloche
16 3 Christian Meloche
       PROJECT NAME: alphanumerical no spaces ex: mtaz1108, myproject
17 2 Christian Meloche
18 3 Christian Meloche
       SITE: MAC    We may want to allow GROUPNAME or APB as well eventually to apply to many  
19 2 Christian Meloche
20 2 Christian Meloche
       ACTION:
21 2 Christian Meloche
22 2 Christian Meloche
               bas|unixtime,scriptlocation,sha256sum of script|
23 2 Christian Meloche
               ex: ||Myproject|00:01:02:04:05:06|bas|123456789,https://myserver/myscript,ed4375b7ac056019a23ecec3b7f53a8f5856eddf5574c3afe3c93109e97222b5|
24 2 Christian Meloche
               
25 2 Christian Meloche
               reboot|unixtime,|
26 3 Christian Meloche
               ex: ||Myproject|00:01:02:04:05:06|reboot|1225307846,|
27 1
28 3 Christian Meloche
               testing1|unixtime,|                                    (testing1 one will not be affected by unixtime)
29 3 Christian Meloche
               ex: ||Myproject|00:01:02:04:05:06|testing1|unixtime,|      
30 1
31 3 Christian Meloche
               testing1|unixtime,|                                    (testing2 will act normally and be affected by unixtime)
32 3 Christian Meloche
               ex: ||Myproject|00:01:02:04:05:06|testing2|unixtime,|      
33 3 Christian Meloche
             
34 3 Christian Meloche
               ex: active|unixtime,|                                   increases the checking to be every 40 seconds for 3 hours
35 3 Christian Meloche
               ||Myproject|00:01:02:04:05:06|active|unixtime,|       
36 2 Christian Meloche
37 3 Christian Meloche
               ex: activestop|unixtime,|                               reverts back to regular periodicity
38 3 Christian Meloche
               ||Myproject|00:01:02:04:05:06|activestop|unixtime,|    
39 2 Christian Meloche
40 2 Christian Meloche
41 2 Christian Meloche
</pre>