github.com/kubiko/snapd@v0.0.0-20201013125620-d4f3094d9ddf/interfaces/builtin/lxd.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2016-2017 Canonical Ltd
     5   *
     6   * This program is free software: you can redistribute it and/or modify
     7   * it under the terms of the GNU General Public License version 3 as
     8   * published by the Free Software Foundation.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17   *
    18   */
    19  
    20  package builtin
    21  
    22  const lxdSummary = `allows access to the LXD socket`
    23  
    24  const lxdBaseDeclarationSlots = `
    25    lxd:
    26      allow-installation: false
    27      deny-connection: true
    28      deny-auto-connection: true
    29  `
    30  
    31  const lxdConnectedPlugAppArmor = `
    32  # Description: allow access to the LXD daemon socket. This gives privileged
    33  # access to the system via LXD's socket API.
    34  
    35  /var/snap/lxd/common/lxd/unix.socket rw,
    36  `
    37  
    38  const lxdConnectedPlugSecComp = `
    39  # Description: allow access to the LXD daemon socket. This gives privileged
    40  # access to the system via LXD's socket API.
    41  
    42  socket AF_NETLINK - NETLINK_GENERIC
    43  `
    44  
    45  func init() {
    46  	registerIface(&commonInterface{
    47  		name:                  "lxd",
    48  		summary:               lxdSummary,
    49  		baseDeclarationSlots:  lxdBaseDeclarationSlots,
    50  		connectedPlugAppArmor: lxdConnectedPlugAppArmor,
    51  		connectedPlugSecComp:  lxdConnectedPlugSecComp,
    52  	})
    53  }