Switch back to strict confinement

The following are included in the switch to strict confinement:
* Set snapcraft.yaml confinement to strict and restore/update plugs
* Drop building of python as it's not required for strict snaps
* Switch back to running apps under root

Change-Id: I4704cac75230df5514ce42cdd6cde2b7ad9ed9b3
This commit is contained in:
Corey Bryant 2017-06-13 14:55:02 +00:00
parent 6ff4a7c6b4
commit 05001ec249
3 changed files with 14 additions and 53 deletions

View File

@ -7,7 +7,7 @@ service, Glance.
The glance snap can be installed directly from the snap store: The glance snap can be installed directly from the snap store:
sudo snap install --edge --classic glance sudo snap install --edge glance
The glance snap is working towards publication across tracks for The glance snap is working towards publication across tracks for
OpenStack releases. The edge channel for each track will contain the tip OpenStack releases. The edge channel for each track will contain the tip
@ -17,8 +17,8 @@ will be published progressively to beta, then candidate, and then stable once
CI validation completes for the channel. This should result in an experience CI validation completes for the channel. This should result in an experience
such as: such as:
sudo snap install --classic --channel=ocata/stable glance sudo snap install --channel=ocata/stable glance
sudo snap install --classic --channel=pike/edge glance sudo snap install --channel=pike/edge glance
## Configuring glance ## Configuring glance
@ -64,11 +64,6 @@ The services for the glance snap will log to its $SNAP_COMMON writable area:
## Managing glance ## Managing glance
The glance snap will drop privileges to run daemons and commands under
a regular user named snap-glance. Additionally, permissions and ownership
of files and directories in /var/snap/glance/common/ are modified to
restrict access from other users.
The glance snap has alias support that enables use of the well-known The glance snap has alias support that enables use of the well-known
glance-manage command. To enable the alias, run the following prior to glance-manage command. To enable the alias, run the following prior to
using the command: using the command:

View File

@ -1,20 +1,11 @@
setup: setup:
users:
snap-glance: [snap-glance]
default-owner: "root:snap-glance"
dirs: dirs:
- "{snap_common}/etc"
- "{snap_common}/etc/glance/glance.conf.d" - "{snap_common}/etc/glance/glance.conf.d"
- "{snap_common}/lib"
- "{snap_common}/lib/images" - "{snap_common}/lib/images"
- "{snap_common}/lock" - "{snap_common}/lock"
- "{snap_common}/log" - "{snap_common}/log"
templates: templates:
glance-snap.conf.j2: "{snap_common}/etc/glance/glance.conf.d/glance-snap.conf" glance-snap.conf.j2: "{snap_common}/etc/glance/glance.conf.d/glance-snap.conf"
rchown:
"{snap_common}/lib": "snap-glance:snap-glance"
"{snap_common}/lock": "snap-glance:snap-glance"
"{snap_common}/log": "snap-glance:snap-glance"
entry_points: entry_points:
glance-manage: glance-manage:
binary: "{snap}/bin/glance-manage" binary: "{snap}/bin/glance-manage"
@ -24,8 +15,6 @@ entry_points:
- "{snap_common}/etc/glance/glance-manage.conf" - "{snap_common}/etc/glance/glance-manage.conf"
config-dirs: config-dirs:
- "{snap_common}/etc/glance/glance.conf.d" - "{snap_common}/etc/glance/glance.conf.d"
run-as:
snap-glance: [snap-glance]
glance-registry: glance-registry:
binary: "{snap}/bin/glance-registry" binary: "{snap}/bin/glance-registry"
config-files: config-files:
@ -35,8 +24,6 @@ entry_points:
config-dirs: config-dirs:
- "{snap_common}/etc/glance/glance.conf.d" - "{snap_common}/etc/glance/glance.conf.d"
log-file: "{snap_common}/log/glance-registry.log" log-file: "{snap_common}/log/glance-registry.log"
run-as:
snap-glance: [snap-glance]
glance-api: glance-api:
binary: "{snap}/bin/glance-api" binary: "{snap}/bin/glance-api"
config-files: config-files:
@ -46,5 +33,3 @@ entry_points:
config-dirs: config-dirs:
- "{snap_common}/etc/glance/glance.conf.d" - "{snap_common}/etc/glance/glance.conf.d"
log-file: "{snap_common}/log/glance-api.log" log-file: "{snap_common}/log/glance-api.log"
run-as:
snap-glance: [snap-glance]

View File

@ -6,30 +6,30 @@ description: |
to store, browse, share, distribute and manage bootable disk images, to store, browse, share, distribute and manage bootable disk images,
other data closely associated with initializing compute resources, other data closely associated with initializing compute resources,
and metadata definitions. and metadata definitions.
confinement: classic confinement: strict
grade: devel grade: devel
apps: apps:
api: api:
command: > command: snap-openstack glance-api
env PYTHONPATH=$PYTHONPATH:$SNAP/lib/python2.7/site-packages
$SNAP/usr/bin/python2 $SNAP/bin/snap-openstack glance-api
daemon: simple daemon: simple
plugs:
- network-bind
registry: registry:
command: > command: snap-openstack glance-registry
env PYTHONPATH=$PYTHONPATH:$SNAP/lib/python2.7/site-packages
$SNAP/usr/bin/python2 $SNAP/bin/snap-openstack glance-registry
daemon: simple daemon: simple
plugs:
- network
- network-bind
manage: manage:
command: > command: snap-openstack glance-manage
env PYTHONPATH=$PYTHONPATH:$SNAP/lib/python2.7/site-packages
$SNAP/usr/bin/python2 $SNAP/bin/snap-openstack glance-manage
aliases: aliases:
- glance-manage - glance-manage
plugs:
- network
parts: parts:
glance: glance:
after: [python]
plugin: python plugin: python
python-version: python2 python-version: python2
source: http://tarballs.openstack.org/glance/glance-stable-ocata.tar.gz source: http://tarballs.openstack.org/glance/glance-stable-ocata.tar.gz
@ -50,11 +50,6 @@ parts:
- libssl-dev - libssl-dev
- libxml2-dev - libxml2-dev
- libxslt1-dev - libxslt1-dev
stage:
- -usr/bin/2to3
- -usr/bin/pydoc
- -usr/bin/python2.7
- -usr/lib/python2.7
install: | install: |
touch $SNAPCRAFT_PART_INSTALL/lib/python2.7/site-packages/paste/__init__.py touch $SNAPCRAFT_PART_INSTALL/lib/python2.7/site-packages/paste/__init__.py
touch $SNAPCRAFT_PART_INSTALL/lib/python2.7/site-packages/repoze/__init__.py touch $SNAPCRAFT_PART_INSTALL/lib/python2.7/site-packages/repoze/__init__.py
@ -65,7 +60,6 @@ parts:
after: [glance] after: [glance]
plugin: dump plugin: dump
source: snap source: snap
# TODO: replace below with scriplets once implemented in snapcraft
config: config:
after: [glance] after: [glance]
plugin: dump plugin: dump
@ -81,16 +75,3 @@ parts:
- etc/glance/*.json - etc/glance/*.json
stage: [$etc] stage: [$etc]
prime: [$etc] prime: [$etc]
python:
source: https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz
plugin: autotools
configflags:
- --prefix=/usr
- --enable-shared
- --enable-unicode=ucs4
build-packages:
- libssl-dev
prime:
- -usr/include
install:
$SNAPCRAFT_PART_INSTALL/usr/bin/python2 -m ensurepip