internal/website/docs/SECURITY_MIGRATION.md
Go Micro v6 verifies TLS certificates by default. This guide is for teams upgrading from v5, where TLS verification was disabled by default for backward compatibility.
Default Behavior: TLS certificate verification is enabled by default
(InsecureSkipVerify: false).
What changed from v5: v5 allowed MICRO_TLS_SECURE=true to opt into
certificate verification. In v6, secure verification is the default and
MICRO_TLS_SECURE is no longer used.
Development escape hatch: for local self-signed certificates only, set
MICRO_TLS_INSECURE=true or provide an explicit insecure TLS config.
Delete any use of the v5-only environment variable:
unset MICRO_TLS_SECURE
No replacement is required for production: verification is already on in v6.
Most services need no TLS-specific code. If you configure TLS explicitly, use a standard crypto/tls config with verification enabled:
import (
"crypto/tls"
"go-micro.dev/v6/broker"
)
// Create broker with certificate verification enabled.
b := broker.NewHttpBroker(
broker.TLSConfig(&tls.Config{MinVersion: tls.VersionTLS12}),
)
For private CAs, provide your own TLS configuration:
import (
"crypto/tls"
"crypto/x509"
"go-micro.dev/v6/broker"
"os"
)
// Load CA certificates
caCert, err := os.ReadFile("/path/to/ca-cert.pem")
if err != nil {
log.Fatal(err)
}
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)
// Create custom TLS config
tlsConfig := &tls.Config{
RootCAs: caCertPool,
MinVersion: tls.VersionTLS12,
}
// Create broker with custom config
b := broker.NewHttpBroker(
broker.TLSConfig(tlsConfig),
)
If a development environment still uses self-signed certificates that are not in your trust store, opt out explicitly:
export MICRO_TLS_INSECURE=true
or in code:
broker.TLSConfig(&tls.Config{InsecureSkipVerify: true, MinVersion: tls.VersionTLS12})
Do not use insecure mode in production.
The default changed at the v6 major-version boundary. Before rolling v6 into a fleet that uses TLS, verify that:
MICRO_TLS_SECURE; they no longer control v6.Certificate Trust: With secure mode as the default, ensure:
Service Mesh Alternative: Consider using a service mesh (Istio, Linkerd, etc.) for:
package main
import (
"crypto/tls"
"fmt"
)
func main() {
config := &tls.Config{MinVersion: tls.VersionTLS12}
fmt.Printf("InsecureSkipVerify: %v (should be false)\n", config.InsecureSkipVerify)
}
Create a test service and verify it:
Cause: The server certificate is not signed by a trusted CA
Solution:
MICRO_TLS_INSECURE=true or an explicit insecure TLS configCause: Server certificate has expired
Solution:
Cause: Certificates that v5 accepted by default are now verified.
Solution:
For issues or questions about TLS security migration, open an issue on GitHub or check the documentation at https://go-micro.dev/docs/.