Communication between separate snaps

I am currently busy with a project that involves running various snaps on an Ubuntu Core OS (intended use as low-maintenance IoT device). In this confined environment, I would like to retrieve and modify some data using one snap which runs a webserver and then pass the data to another snap which uses that data for among other things setting up a VPN connection to a remote server.

In the ideal situation, I would like to pass data directly from my webserver snap to my VPN snap and have the former snap start the latter for the following reasons:

  • Security/ confinement: another solution would be to write the data to some directory in the local filesystem and have the VPN snap import data from that directory, but that kind of goes against the point of running the applications in confined containers for security purposes (correct me if Iā€™m wrong though)
  • Continuity: another solution would be to incorporate both snaps into one snap by for example passing openvpn apt package as a stage-package for the first webserver snap and simply containing all functionality in that single snap (not sure how that would exactly be implemented). However, this leaves dependency on updates of openvpn not breaking any of my code. Even though the odds of this happening are small, I would rather take another solution if there is one.

I hope with this information the context and my goal is clear. This leaves the question: Can this interaction between snaps be done and if so, how do I do this? Thanks in advance for any reply!

Two things come to mind:

Passing a socket or files via the content interface: The content interface would (by default) only auto-connect for snaps of the same publisher.


Using DBus:


additionally just using a network listener socket that only allows connections from localhost and simply using TCP (with the network-bind interface) would save you from the added complexity of a content or dbus interface ā€¦

1 Like