Documentation
¶
Overview ¶
Package redisacl renders the fleet store's ACL users from the function library a build embeds and the key families its tools use, and compares a rendering with a store's live ACL. It is what `nova-redis acl` runs and what fleet/redis.yml converges a store with (docs/FLEET.md, "The store's ACL").
A role is declared once, here: its user, the key families it reads or writes, the command categories it holds and the library files whose functions it may call. The function names are never listed: they are read out of the library (redisfn.Library.Registered) at render time, FCALL for each and FCALL_RO for each the library flags no-writes, so a function added to a file reaches every role of that file at the next render, and a file added to the library is refused until a role names it or it is declared the coordinator's alone (TestEveryLibraryFileHasItsRoles).
Index ¶
Constants ¶
const ( Coordinator = "coordinator" Member = "member" Table = "table" Friend = "friend" )
The roles, by the name the CLI prints.
const MaxShown = 8
MaxShown bounds each list a drift line prints; the count of the rest follows.
Variables ¶
var CoordinatorOnly = []string{"lua/capacity.lua", "lua/friend_roles.lua"}
CoordinatorOnly are the library files no role but the coordinator calls: nova-config's apply writes the capacity and the friends' roles through them.
var Families = []Family{ {"tables", []string{"table:*", "tables"}, "pkg/ntable DefKey, ChangesKey, RowsKeyAt, Registry"}, {"views", []string{"view:*", "views"}, "pkg/ntable: a view's key and the views registry"}, {"sprint", []string{"sprint:*"}, "internal/sprint Names.Key: the epoch, the beats, the tick's keys"}, {"machines", []string{"machine:*", "machines"}, "pkg/config MachineKey, MachineCeilingKey, MachinesKey"}, {"beats", []string{"bench:*"}, "pkg/config BeatKey: a machine's measured facts"}, {"friends", []string{"friend:*", "friends", "friends:*"}, "pkg/config FriendBeatKey, FriendsKey: a friend's beat, desired slots, width, mode and roles"}, {"fleet", []string{"fleet:*"}, "pkg/config FleetKey"}, {"loops", []string{"loops", "loop:*"}, "pkg/config LoopsKey, LoopKey"}, {"routes", []string{"routes", "route:*"}, "pkg/config RoutesKey, RouteKey"}, {"config", []string{"config:decl"}, "pkg/config DeclKey"}, {"tokens", []string{"tokens:ledger:*"}, "internal/record LedgerPrefix: nova-tokens ledger and report, logged in as the seat's user"}, {"events", []string{"ev:github"}, "internal/ghevent/wire Stream: the CI run receipt (nova-ci github receipt, tools/ci/reportrun.go) XADDs it as the bench user"}, }
Families are the key families of the fleet store, each held to its owner's key functions by TestFamiliesAreTheOwnersKeys. A key a table cell is bound to (a binding may name any key outside table:) is in none of them unless it falls in one: only the coordinator reads such a key.
Functions ¶
Types ¶
type Catalog ¶
Catalog is each command category and its commands, as ACL CAT prints them, read from the store a rendering is compared with: the categories mean what that store's version says they mean.
func (Catalog) Commands ¶
Commands expands command rules applied in order into the commands they allow: +@<category> and -@<category> by the catalog, +@all (allcommands) and -@all (nocommands) over every category, +<command> and +<command>|<sub> as named, -<command> with every subcommand of it. Rules that are not command rules are skipped.
type Drift ¶
type Drift struct {
Missing, Off, Selectors bool
KeysAdd, KeysDel []string
ChannelsAdd, ChannelsDel []string
CommandsAdd, CommandsDel []string
}
Drift is how a live user differs from its rendering; zero is none.
func Compare ¶
Compare is the drift of a live user from its rendering, the commands compared as the sets the catalog expands both to, so a store that prints the same permissions in other words is no drift.
type Family ¶
Family is one family of keys the tools use, with the code that names them; render prints each with its source (ACL FAMILY lines).
type Live ¶
type Live struct {
Exists bool
On bool
// NoPass is the nopass flag: the user logs in with any password.
NoPass bool
// Keys, Channels and Commands are the reply's fields as the store
// prints them; Selectors counts the user's selectors.
Keys, Channels, Commands string
Selectors int
}
Live is what a store's ACL GETUSER says of one user: never its passwords.
type Role ¶
type Role struct {
// Name is the role; User the ACL user that holds it.
Name, User string
// Keys are the key rules: ~<pattern> to read and write, %R~<pattern> to
// read.
Keys []string
// Commands are the command rules before the functions.
Commands []string
// Files are the library files whose functions it may call; every file
// when All.
Files []string
All bool
// ReadOnly grants only the no-writes functions, through FCALL_RO.
ReadOnly bool
// Extra are command rules after the functions.
Extra []string
}
Role is one ACL user's declaration.
type User ¶
type User struct {
Role, Name string
Rules []string
// Functions is how many library functions it may call.
Functions int
}
User is one rendered ACL user: the arguments of ACL SETUSER after its name. A rendering never touches a password.