Makes agent quark share common redis code

RM9983

Re-works the quark agent to use the same security groups code as the
plugin. Additionally, moves or removes superfluous files and tests as
appropriate.