From be76bef14c2e2a8b98333c558e61b9e17c0e028b Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Fri, 10 Jul 2026 15:02:39 +0200 Subject: [PATCH] Add trust center base domain configuration Introduce the trust center base domain setting (default probopage.com) so managed default domains can be minted for every compliance page. This configuration is a prerequisite for the domain-ownership migration and the default-domain provisioning that happens at organization creation. Signed-off-by: Bryan Frimin --- compose/postgres/01_probod.sh | 2 ++ pkg/bootstrap/builder.go | 5 +++-- pkg/bootstrap/builder_test.go | 3 +++ pkg/probodconfig/config.go | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compose/postgres/01_probod.sh b/compose/postgres/01_probod.sh index ad18b10d9..685f08ca7 100755 --- a/compose/postgres/01_probod.sh +++ b/compose/postgres/01_probod.sh @@ -15,9 +15,11 @@ EOF psql -v ON_ERROR_STOP=1 -U $POSTGRES_USER -d probod <<-EOF ALTER SCHEMA public OWNER TO probod; GRANT ALL ON SCHEMA public TO probod; +ALTER DATABASE probod SET probo.trust_center_base_domain TO 'probopage.localhost'; EOF psql -v ON_ERROR_STOP=1 -U $POSTGRES_USER -d probod_test <<-EOF ALTER SCHEMA public OWNER TO probod; GRANT ALL ON SCHEMA public TO probod; +ALTER DATABASE probod_test SET probo.trust_center_base_domain TO 'probopage.localhost'; EOF diff --git a/pkg/bootstrap/builder.go b/pkg/bootstrap/builder.go index e357275ef..fd3c35517 100644 --- a/pkg/bootstrap/builder.go +++ b/pkg/bootstrap/builder.go @@ -156,8 +156,9 @@ func (b *Builder) Build() (*probodconfig.FullConfig, error) { }, }, TrustCenter: probodconfig.TrustCenterConfig{ - HTTPAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTP_ADDR"), - HTTPSAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTPS_ADDR"), + HTTPAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTP_ADDR"), + HTTPSAddr: b.resolver.getEnv("PROBOD_TRUST_CENTER_HTTPS_ADDR"), + BaseDomain: b.resolver.getEnv("PROBOD_TRUST_CENTER_BASE_DOMAIN"), ProxyProtocol: probodconfig.ProxyProtocolConfig{ TrustedProxies: b.parseOriginsList(b.resolver.getEnv("PROBOD_TRUST_CENTER_PROXY_PROTOCOL_TRUSTED_PROXIES")), }, diff --git a/pkg/bootstrap/builder_test.go b/pkg/bootstrap/builder_test.go index f085a3ad6..0198f6a1e 100644 --- a/pkg/bootstrap/builder_test.go +++ b/pkg/bootstrap/builder_test.go @@ -190,6 +190,7 @@ func TestBuilder_Build_Defaults(t *testing.T) { // Trust center config assert.Empty(t, cfg.Probod.TrustCenter.HTTPAddr) assert.Empty(t, cfg.Probod.TrustCenter.HTTPSAddr) + assert.Empty(t, cfg.Probod.TrustCenter.BaseDomain) assert.Nil(t, cfg.Probod.TrustCenter.ProxyProtocol.TrustedProxies) // AWS config @@ -335,6 +336,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) { // Trust center env["PROBOD_TRUST_CENTER_HTTP_ADDR"] = ":8080" env["PROBOD_TRUST_CENTER_HTTPS_ADDR"] = ":8443" + env["PROBOD_TRUST_CENTER_BASE_DOMAIN"] = "probopage.example.com" env["PROBOD_TRUST_CENTER_PROXY_PROTOCOL_TRUSTED_PROXIES"] = "10.0.1.1,10.0.1.2" // AWS env["PROBOD_AWS_REGION"] = "eu-west-1" @@ -469,6 +471,7 @@ func TestBuilder_Build_CustomValues(t *testing.T) { // Trust center assert.Equal(t, ":8080", cfg.Probod.TrustCenter.HTTPAddr) assert.Equal(t, ":8443", cfg.Probod.TrustCenter.HTTPSAddr) + assert.Equal(t, "probopage.example.com", cfg.Probod.TrustCenter.BaseDomain) assert.Equal(t, []string{"10.0.1.1", "10.0.1.2"}, cfg.Probod.TrustCenter.ProxyProtocol.TrustedProxies) // AWS assert.Equal(t, "eu-west-1", cfg.Probod.AWS.Region) diff --git a/pkg/probodconfig/config.go b/pkg/probodconfig/config.go index e23621a8a..b9e5f63e4 100644 --- a/pkg/probodconfig/config.go +++ b/pkg/probodconfig/config.go @@ -83,6 +83,7 @@ type ( TrustCenterConfig struct { HTTPAddr string `json:"http-addr,omitempty"` HTTPSAddr string `json:"https-addr,omitempty"` + BaseDomain string `json:"base-domain,omitempty"` ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol,omitzero"` } )