Accessing ca-certificates.crt from a snap

Hi there

Just wanted to spread my knowledge with the hopes that this shows up in somebody’s Google search.

The foliate snap. Couldn’t download anything. When it tried to download data from a website, it printed the following error:

(process:12483): GLib-Net-WARNING **: 20:59:38.452: couldn't load TLS file database: Failed to open file ?/etc/ssl/certs/ca-certificates.crt?: Permission denied
file:///snap/foliate/current/usr/share/com.github.johnfactotum.Foliate/assets/lookup.html:41:26: CONSOLE ERROR TypeError: Error resolving “en.wiktionary.org”: Temporary failure in name resolution

I tried to figure out why it couldn’t access /etc/ssl/certs/ca-certificates.crt. For some reason it took me way too long to figure out that the snap didn’t have the network plug. So the solution was this:

apps:
  foliate:
    command: usr/bin/com.github.johnfactotum.Foliate
    extensions: [gnome-3-28]
    plugs:
      - home
      - opengl
      - network     # <- Just add this 
    slots:
      - dbus-daemon
    common-id: com.github.johnfactotum.Foliate

Fixed by adding the network plug