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

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2016 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 dockerSummary = `allows access to Docker socket`
    23  
    24  const dockerBaseDeclarationSlots = `
    25    docker:
    26      allow-installation: false
    27      deny-connection: true
    28      deny-auto-connection: true
    29  `
    30  
    31  const dockerConnectedPlugAppArmor = `
    32  # Description: allow access to the Docker daemon socket. This gives privileged
    33  # access to the system via Docker's socket API.
    34  
    35  # Allow talking to the docker daemon
    36  /{,var/}run/docker.sock rw,
    37  `
    38  
    39  const dockerConnectedPlugSecComp = `
    40  # Description: allow access to the Docker daemon socket. This gives privileged
    41  # access to the system via Docker's socket API.
    42  
    43  bind
    44  socket AF_NETLINK - NETLINK_GENERIC
    45  `
    46  
    47  func init() {
    48  	registerIface(&commonInterface{
    49  		name:                  "docker",
    50  		summary:               dockerSummary,
    51  		baseDeclarationSlots:  dockerBaseDeclarationSlots,
    52  		connectedPlugAppArmor: dockerConnectedPlugAppArmor,
    53  		connectedPlugSecComp:  dockerConnectedPlugSecComp,
    54  	})
    55  }