Contract rev 9 removes the instance CA, client certificates, the peer listener and the trust store fleet-wide. Internal traffic is plaintext HTTP on each service single :8080 listener, so there is no peer identity left to authorize: delete lib/pki, lib/federation, devboot, the per-service database role model and the /api/peers* and /api/instances surfaces, and drop the console Trusted services UI. Config delivery now rides a dedicated ES256 token from lib/configsign rather than mTLS, and the instance fingerprint is derived from a persisted random key and is informational only. main.go also wires the surfaces introduced by the later commits, which this change is what makes possible.
55 lines
1.9 KiB
Go
55 lines
1.9 KiB
Go
// Copyright (C) 2026 Dcntrlized
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
package authmgmt
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestSchemeIsAlwaysPlaintext locks the rev-9 transport decision: every
|
|
// satellite peer edge (manifest fetch, action routing) is plaintext HTTP on the
|
|
// single :8080 listener. A future https/peer-port regression must fail here.
|
|
func TestSchemeIsAlwaysPlaintext(t *testing.T) {
|
|
if got := Scheme(); got != "http" {
|
|
t.Fatalf("Scheme() = %q, want %q", got, "http")
|
|
}
|
|
}
|
|
|
|
// TestConfigTokenMintsForService exercises the contract-named mint helper
|
|
// (rev 9 §17.3.6) end to end against a temp data root: it must create the
|
|
// dedicated config-signing keypair, return a 3-segment JWS bound to the target
|
|
// service, and expose a public key whose kid matches the token header.
|
|
func TestConfigTokenMintsForService(t *testing.T) {
|
|
dir := t.TempDir()
|
|
t.Setenv("DCNTRLIZED_INSTALL_DIR", dir)
|
|
|
|
token, err := ConfigToken("calendar")
|
|
if err != nil {
|
|
t.Fatalf("ConfigToken: %v", err)
|
|
}
|
|
parts := strings.Split(token, ".")
|
|
if len(parts) != 3 {
|
|
t.Fatalf("token has %d segments, want 3", len(parts))
|
|
}
|
|
for _, name := range []string{"config-signing.key", "config-signing.pub"} {
|
|
if _, err := os.Stat(dir + "/maestro/" + name); err != nil {
|
|
t.Fatalf("expected %s to exist: %v", name, err)
|
|
}
|
|
}
|
|
}
|