A store of your own
purpose for Ubuntu Core developers for administrators
On the public store a device vendor does not decide which snaps its devices can install or who may publish for them. A dedicated snap store formerly called a brand store lets the vendor control what is available and when. A device uses it because its model names it. Privileges granted to the brand's snaps can be limited to devices of that store. The store service itself is outside snapd.
On the map: getting snaps district
01 Anyone's snap, on your gateway
A dedicated snap store, formerly called a brand store, "allows vendors running Ubuntu Core and snap-based devices to control exactly what snaps are available and when".
Somebody logs in to one of your gateways and types snap install, with the name of a game. Should that work? On the public store, it isn't your decision. Acme's gateways follow the public Snap Store, so they can install any public snap, and acme's own snaps sit on the shelf next to everyone else's. Acme doesn't get to say what its gateways are offered, or when. The Ubuntu Core docs describe the alternative: a dedicated snap store, once called a brand store. It lets a vendor control exactly which snaps are available, and when. Ask for that game again, and it isn't there.
02 What a dedicated store adds
Compared with the public Snap Store, a dedicated store has restricted access, content curated by its owner, account delegation and proxy support. Both are hosted by Canonical.
You might picture a dedicated store as a server in acme's basement. It isn't. It's the same service, with a different owner for four decisions. Access is restricted, so snaps published there are seen only by that store's users. The content is curated by its owner, and it can include selected snaps from other stores, so the gateway still gets the public snaps it needs. The brand can hand out roles: admin, reviewer, viewer and publisher. And it can sit behind a proxy on site. Canonical hosts and monitors both kinds, and both have over-the-air updates. All of this is the store's side. Snapd implements none of it.
03 One account behind it all
The brand account holds the signing keys, signs models and registers kernel and gadget snap names. Other accounts get the store's roles; the brand account's use is kept strictly limited.
So far, acme decides. Who, exactly, is acme? One account, and you'd better look after it. The docs call it the brand account: an ordinary sign-on account that the store team augments. It generates and holds the brand's signing keys. It signs the models of images that point at the store. It registers the kernel and gadget snap names. And it defines the store's scope of authority. On the gateway, that account is the brand in the model, and also its signer. So the docs ask you to keep its use strictly limited. Daily work goes to accounts with roles; the brand account shouldn't be an admin, reviewer or viewer.
04 One header points the device at the store
The model's optional store header names the device's store, and snapd sends it with store requests. A device session based on the serial tells the store which device is asking.
You won't find a switch on the gateway that says use acme's store. So how does it know where to shop? The model says so. It has an optional store header, and a model without one uses the main store. Snapd reads that header and sends the store id along with its store requests. On its own, anybody could claim that, so the store also wants to know who's asking. The gateway signs in to a device session with its serial, issued for acme's model. And when the model names a store, snapd also fetches that store's assertion, if there is one, while it checks a snap.
05 Privileges that stay inside the store
A grant with on-store applies only on devices whose model names that store. It narrows only the rule it is in: under allow-auto-connection it stops the connection, under allow-installation snapd also refuses the install.
The store gave acme-agent a powerful permission, because on acme's gateways it needs it. What happens if that snap turns up on somebody else's device? The grant carries a condition: on-store, naming acme's store. Snapd compares it with the store in the device's model. On the gateway they match, and the plug connects by itself. On a generic device with no store in its model, the plug stays unconnected. The docs call it a safeguard against auto-connections outside a dedicated store. The condition narrows only the rule it sits in. Put it on installation too, as the docs' example does, and snapd refuses the install there.
06 When you do not need one
A model without a store header uses the main store. A network without internet access calls for a store proxy and proxy.store, not necessarily a dedicated store.
Do you need all this to ship a device? Often not. If everything your device needs is public, leave the store header out. The model then uses the main store, and you still sign your own model and pick your snaps. Next, gateways on a factory network with no route out. That's a job for a store proxy, an on-premise cache. Snapd accepts proxy.store only when it has a matching store assertion. Reach for a dedicated store when you need to decide who sees and publishes your snaps, and what your devices are offered. Those decisions are made in the store service, not in snapd.
07 Where to go from here
Roads: the store client, the model, the store assertion, the serial and its hook, store-scoped rules in snap-declarations, validation sets and update control.
A store of your own is mostly a decision about who's in charge. Here's where the moving parts are. The store deck shows what snapd asks a store, and how proxy.store redirects it. The model deck has the header that names the store. Identity and store covers the store assertion, and the accounts and keys behind it. The device assertions and the device hooks show the serial, and how the gadget asks for one. The snap-declaration rules cover on-store, on-brand and on-model. And validation sets and update control are what the brand decides after the device ships.
Read more
Public and dedicated store compared
The table is the one in the Ubuntu Core documentation. Everything in it is done by the store service, not by snapd.
| Dedicated snap store | Snap Store | |
|---|---|---|
| Access | Restricted | Public |
| Snaps published | Only to dedicated store users | Seen globally |
| Content | Curated by owner | Curated by Canonical |
| Hosting | Canonical hosted and managed | Canonical hosted and managed |
| Security | Monitored by Canonical | Monitored by Canonical |
| Over-the-air updates | Yes | Yes |
| Refresh control | Yes | Yes |
| Account delegation | Yes | No |
| Proxy snap server support | Yes | No |
| Custom dashboard | Yes | No |
| Custom API access | Yes | No |
| Substores | Yes | No |
What snapd does and what the store does
| Step | Done by |
|---|---|
Name the store in the model's store header | the brand when it signs the model |
Send the store id with requests (Snap-Device-Store) | snapd |
| Sign in with the device's serial | snapd; the store checks it |
| Decide which snaps that device is offered | the store |
| Decide who may publish and review | the store's roles set by the brand |
| Fetch the store assertion when the model names a store | snapd, while checking a snap |
Apply on-store rules of a snap-declaration | snapd |
Refuse proxy.store without a matching store assertion | snapd |
snapd takes the store id from the model. On the generic classic model, or with no model yet, it uses the UBUNTU_STORE_ID environment variable instead.
Store scoping in snapd
on-store is a device scope constraint. snapd checks it against the store header of the device's model, and also accepts a store listed in the store assertion's friendly-stores. A model without a store header matches no on-store list.
Where on-store sits | Effect on a device of another store |
|---|---|
allow-auto-connection | the snap installs; the plug is not connected automatically |
allow-installation | snapd refuses the install: installation not allowed by "<plug>" plug rule of interface "<interface>" for "<snap>" snap |
The store-scoping page of the Ubuntu Core documentation says a snap cannot be prevented from being installed. In snapd, an on-store condition under allow-installation of a snap-declaration is checked at install time, as its own example shows. A snap whose interfaces have no installation rule installs anywhere.
Things only the brand account does
- generate, register and hold the signing keys of the brand
- sign model assertions for images that point at a dedicated store
- register kernel and gadget snap names (Canonical can also register them)
The documentation recommends that the brand account is not given the Admin, Reviewer or Viewer role, and that two-factor authentication is enabled on it. The keys it generates are kept locally in ~/.snap/gnupg.
Roles in a dedicated store
| Role | Can |
|---|---|
| Admin | manage the store; the highest level of permissions |
| Reviewer | approve changes to snaps when the store requires reviews |
| Viewer | see and download snaps, for building images or testing |
| Publisher | register names, upload and release revisions, set collaborators |
Words for the same thing
| Word | Where |
|---|---|
| dedicated snap store | the current Ubuntu Core documentation |
| brand store; IoT App Store | older and product names for the same thing |
| non-default store | the snapd code |
| store proxy; Enterprise Store | an on-premise proxy; a different thing |
Further reading
- Dedicated snap store: what it is and the comparison table
- Brand accounts: the brand account and the roles
- Store scoping: why and how grants are tied to a store
- Store overview: the public store, the Enterprise Store and dedicated stores side by side
- Model assertion: the
storeheader - store assertion: the fields of the assertion
Roads from here
GETTING SNAPS
- The store — what snapd asks a store and how proxy.store redirects it
RUNNING SNAPS
- Who decides when a snap updates — every party that can decide when a snap updates
ASSERTIONS · signed statements snapd trusts
- Assertions: identity and store — the store assertion and the accounts behind it
- Assertions: devices — the serial a device needs before the store knows it
- Validation sets: snaps that belong together — keeping the brand's snaps at tested revisions
HOOKS · code snapd runs inside a snap
- Hooks: device setup — the gadget hook that points a device at its serial service
POLICY · who may install and connect what
- Snap-declaration rules — on-store rules that apply only on the brand's devices
UBUNTU CORE · install and recovery
- Model, gadget and kernel — the model that names the store