Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ GROUND_CONTROL_URL=http://127.0.0.1:8080
TOKEN=

# TLS/SPIFFE registration.
# USE_UNSECURE allows plain-HTTP connections to registries only. It does not
# affect verification of Ground Control's TLS certificate.
USE_UNSECURE=false
# GC_SKIP_TLS_VERIFY disables verification of Ground Control's TLS certificate.
# INSECURE: anyone on the network path can then impersonate Ground Control and
# capture the registration token and Harbor credentials. Testing only.
GC_SKIP_TLS_VERIFY=false
SPIFFE_ENABLED=false
SPIFFE_ENDPOINT_SOCKET=unix:///run/spire/sockets/agent.sock
SPIFFE_EXPECTED_SERVER_ID=
Expand Down
12 changes: 10 additions & 2 deletions cmd/satellite/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type SatelliteOptions struct {
GroundControlURL string
Token string
UseUnsecure bool
GCSkipTLSVerify bool
Mirrors mirrorFlags
SPIFFEEnabled bool
SPIFFEEndpointSocket string
Expand Down Expand Up @@ -71,6 +72,7 @@ func main() {
opts := SatelliteOptions{
GroundControlURL: envCfg.GroundControlURL,
UseUnsecure: envCfg.UseUnsecure,
GCSkipTLSVerify: envCfg.GCSkipTLSVerify,
SPIFFEEnabled: envCfg.SPIFFEEnabled,
SPIFFEEndpointSocket: envCfg.SPIFFEEndpointSocket,
SPIFFEExpectedServerID: envCfg.SPIFFEExpectedServerID,
Expand All @@ -89,7 +91,8 @@ func main() {
flag.StringVar(&opts.GroundControlURL, "ground-control-url", opts.GroundControlURL, "URL to ground control")
flag.BoolVar(&opts.JSONLogging, "json-logging", true, "Enable JSON logging")
flag.StringVar(&opts.Token, "token", "", "Satellite token")
flag.BoolVar(&opts.UseUnsecure, "use-unsecure", opts.UseUnsecure, "Use insecure (HTTP) connections to registries")
flag.BoolVar(&opts.UseUnsecure, "use-unsecure", opts.UseUnsecure, "Use insecure (HTTP) connections to registries. Does not affect Ground Control certificate verification")
flag.BoolVar(&opts.GCSkipTLSVerify, "gc-skip-tls-verify", opts.GCSkipTLSVerify, "INSECURE: skip verification of Ground Control's TLS certificate. Exposes the registration token and Harbor credentials to network interception")
flag.Var(&opts.Mirrors, "mirrors", "Override CRI registry config. Format: CRI:registry1,registry2")
flag.BoolVar(&opts.SPIFFEEnabled, "spiffe-enabled", opts.SPIFFEEnabled, "Enable SPIFFE/SPIRE authentication")
flag.StringVar(&opts.SPIFFEEndpointSocket, "spiffe-endpoint-socket", opts.SPIFFEEndpointSocket, "SPIFFE Workload API endpoint socket")
Expand Down Expand Up @@ -254,12 +257,17 @@ func run(opts SatelliteOptions, pathConfig *config.PathConfig, shutdownTimeout s
defer cancel()
wg, ctx := errgroup.WithContext(ctx)

cm, warnings, err := config.InitConfigManager(opts.Token, opts.GroundControlURL, pathConfig.ConfigFile, pathConfig.PrevConfigFile, opts.JSONLogging, opts.UseUnsecure)
cm, warnings, err := config.InitConfigManager(opts.Token, opts.GroundControlURL, pathConfig.ConfigFile, pathConfig.PrevConfigFile, opts.JSONLogging, opts.UseUnsecure, opts.GCSkipTLSVerify)
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
if err != nil {
fmt.Printf("Error initiating the config manager: %v\n", err)
return err
}

// Warn once at startup rather than on every registration and heartbeat.
if cm.GroundControlSkipTLSVerify() {
warnings = append(warnings, config.GroundControlSkipTLSVerifyWarning)
}

// Apply SPIFFE config from CLI flags
if opts.SPIFFEEnabled {
cm.With(config.SetSPIFFEConfig(config.SPIFFEConfig{
Expand Down
1 change: 1 addition & 0 deletions internal/env/harbor-satellite.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type HarborSatellite struct {
SPIFFEEndpointSocket string `env:"SPIFFE_ENDPOINT_SOCKET" envDefault:"unix:///run/spire/sockets/agent.sock"`
SPIFFEExpectedServerID string `env:"SPIFFE_EXPECTED_SERVER_ID"`
UseUnsecure bool `env:"USE_UNSECURE" envDefault:"false"`
GCSkipTLSVerify bool `env:"GC_SKIP_TLS_VERIFY" envDefault:"false"`
BYORegistry bool `env:"BYO_REGISTRY" envDefault:"false"`
RegistryURL string `env:"REGISTRY_URL"`
RegistryUsername string `env:"REGISTRY_USERNAME"`
Expand Down
Loading