Skip to content

Draft: Initial implementation of agent functionality

Max B requested to merge maxb/initial-functionality into main

This is the initial functionality of a "menshen agent". menshen-agent is the agent running on a host (bridge or gateway) which communicates with menshen in order to provide configuration information and allow for dynamic registration/inventory.

This should replace menshen_agent which we will deprecate and remove as this is deployed.

I wanted to get this up as a draft in order to get feedback before necessarily just committing it to main, though we can always use future/additional MRs for tweaks/additional functionality.

Potential TODOs remaining:

  • Monitor something useful in the gateway-agent. Check that the gateway/openvpn process is running? Check openvpn stats? Check /proc stats? Check prometheus stats? See https://0xacab.org/leap/menshen_agent/-/blob/main/pkg/collector/openvpn.go?ref_type=heads https://0xacab.org/leap/menshen_agent/-/blob/main/pkg/collector/conntrack.go?ref_type=heads etc
  • A License!
  • Functionality for updating configuration from the API. We could do something as simple as just add a mutex for mutating the Config struct while the agent is running or a channel listener or 🤷 ?
  • Better tests. I'm kinda lazily testing various outcomes and maybe slightly mixing up different test types. For example, the forceError bool which causes the tests to error and then checks that is a bodge.
  • An integration test against an actual menshen container??
  • Figure out if we want to use the Load/Overloaded fields and what kinds of things would actually go into them.
Edited by Max B

Merge request reports

Loading