ron/miniccc/minimega: improving reconnect #1177
Conversation
Refactor minimega so that we connect CC when starting a VM. Add test to ensure that we can reconnect after VMs are killed and restarted. Add additional checks in ron to make sure that we aren't trying to listen on the same thing twice and properly cleaning up the listeners that we have closed. Suppress tunnel EOF messages.
Should allow miniccc to reconnect after the VM restarts, even if there is data left in the buffer.
Tested with a debian VM. If you shutdown the VM and then One potentially problematic thing is that the miniccc state is fresh so it doesn't know what the previous command was so it reruns them all. |
Can you have the agent generate a random number and save it to disk on first run? From then on out make this the agents unique identifier. |
@mkunz7: is that to prevent miniccc from rerunning commands? There are some commands that we would want to rerun (e.g. set static IP) and others that we wouldn't (e.g. run setup.bash). It's hard for us to know which those are. I'm leaning towards letting the user figure this out -- run |
Yeah, that's my intent. Perhaps we can add a persistence command.
If persistence is enabled it writes every command it executes to disk. On reconnect it phones home for the list of commands to run, and skips any it has done already. |
Yea the original intent behind having command persist like they do currently is exactly that. If a vm cycles, it can re-ingest all of the past commands. This all looks good to me. |
LGTM |
6ba49ba
into
sandia-minimega:master
Add synchronization bytes to hopefully allow ron and miniccc to reconnect. Write the magic bytes in both directions to flush both sides.
Add redial to the things we do when we start a VM.