github.com/stulluk/snapd@v0.0.0-20210611110309-f6d5d5bd24b0/interfaces/builtin/login_session_control.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2019 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 loginSessionControlSummary = `allows setup of login session & seat`
    23  
    24  const loginSessionControlBaseDeclarationSlots = `
    25    login-session-control:
    26      allow-installation:
    27        slot-snap-type:
    28          - core
    29      deny-auto-connection: true
    30  `
    31  
    32  const loginSessionControlConnectedPlugAppArmor = `
    33  # Description: Can setup login session & seat. This grants privileged access to user sessions.
    34  
    35  #include <abstractions/dbus-strict>
    36  
    37  dbus (send,receive)
    38      bus=system
    39      path=/org/freedesktop/login1/{seat,session}/**
    40      interface=org.freedesktop.DBus.Properties
    41      member={GetAll,PropertiesChanged,Get}
    42      peer=(label=unconfined),
    43  
    44  dbus (send,receive)
    45      bus=system
    46      path=/org/freedesktop/login1/seat/**
    47      interface=org.freedesktop.login1.Seat
    48      member={ActiveSession,SwitchTo}
    49      peer=(label=unconfined),
    50  
    51  dbus (send,receive)
    52      bus=system
    53      path=/org/freedesktop/login1/session/**
    54      interface=org.freedesktop.login1.Session
    55      member={TakeControl,TakeDevice,PauseDevice,PauseDeviceComplete,ResumeDevice,ReleaseDevice,Active,State,Lock,Unlock,Activate,ReleaseControl}
    56      peer=(label=unconfined),
    57  
    58  dbus (send,receive)
    59      bus=system
    60      path=/org/freedesktop/login1
    61      interface=org.freedesktop.login1.Manager
    62      member={GetSession,GetSeat}
    63      peer=(label=unconfined),
    64  `
    65  
    66  func init() {
    67  	registerIface(&commonInterface{
    68  		name:                  "login-session-control",
    69  		summary:               loginSessionControlSummary,
    70  		implicitOnCore:        true,
    71  		implicitOnClassic:     true,
    72  		baseDeclarationSlots:  loginSessionControlBaseDeclarationSlots,
    73  		connectedPlugAppArmor: loginSessionControlConnectedPlugAppArmor,
    74  	})
    75  }