`secret rotate <node> <module> <name>` makes the secret anew the way the first mint did, seals it
to the machine and the operator, and sends the machine, so the module starts again on the new value
— said in the log with who asked and when, never the value. Only for a secret whose definition says
`"taken": "at-start"`: an own secret is now a path, or {path, taken}, and a definition that says
nothing of how a secret is taken is refused with the word to write, because a credential rotated
under software that never reads it again is worse than one left alone (issue 179). `applied` is
refused by name until the staged form ADR 0114 decided is built; a value given to the mesh is
refused as ADR 0113 says. `rotate` is a verb on the controller's seat with two shapes — a pair
credential by provision, an own secret by machine, module and name — so the console can ask.
Registered manifests keep their bytes: a path alone is written back as a path.
27 lines
1.0 KiB
Go
27 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/novox/mesh-controller/internal/catalogue"
|
|
)
|
|
|
|
// `module issue` makes a broker account and delivers it as the module's own secret named broker.
|
|
// A module that declares none is refused before the account exists, so the bus never carries an
|
|
// account nothing reads (novox/hq 04-ISSUES/078).
|
|
func TestAModuleWithNoBrokerSecretCannotBeIssued(t *testing.T) {
|
|
err := mayIssue(catalogue.Manifest{Module: "step-ca", OwnSecrets: catalogue.OwnSecrets{"password": {Path: "/run/password"}}})
|
|
if err == nil {
|
|
t.Fatal("a module with no broker own secret was issued an account")
|
|
}
|
|
for _, want := range []string{"step-ca", "broker", "own-secrets"} {
|
|
if !strings.Contains(err.Error(), want) {
|
|
t.Errorf("the refusal does not say %q: %v", want, err)
|
|
}
|
|
}
|
|
if err := mayIssue(catalogue.Manifest{Module: "redis", OwnSecrets: catalogue.OwnSecrets{"broker": {Path: "/run/broker"}}}); err != nil {
|
|
t.Errorf("a module declaring its broker secret was refused: %v", err)
|
|
}
|
|
}
|