Skip to content

Commit

Permalink
backport of commit a81f54b
Browse files Browse the repository at this point in the history
  • Loading branch information
dhiaayachi committed Aug 29, 2024
1 parent 492ea12 commit bc44515
Show file tree
Hide file tree
Showing 34 changed files with 270 additions and 565 deletions.
3 changes: 0 additions & 3 deletions .changelog/565.txt

This file was deleted.

9 changes: 0 additions & 9 deletions .changelog/571.txt

This file was deleted.

7 changes: 0 additions & 7 deletions .changelog/595.txt

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,12 @@ jobs:
server:
- version: v1.15.0-dev
image: hashicorppreview/consul:1.15-dev
- version: v1.17.0-dev
image: hashicorppreview/consul:1.17-dev
- version: v1.18.0-dev
image: hashicorppreview/consul:1.18-dev
- version: v1.19.0-dev
image: hashicorppreview/consul:1.19-dev
- version: v1.20.0-dev
image: hashicorppreview/consul:1.20-dev
dataplane:
- image_suffix: ""
docker_target: "release-default"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
repository: hashicorp/security-scanner
token: ${{ secrets.HASHIBOT_PRODSEC_GITHUB_TOKEN }}
#TODO: replace w/ HASHIBOT_PRODSEC_GITHUB_TOKEN once provisioned
token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
path: security-scanner
ref: main

Expand All @@ -65,4 +66,4 @@ jobs:
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@c4fb451437765abf5018c6fbf22cce1a7da1e5cc # codeql-bundle-v2.17.1
with:
sarif_file: results.sarif
sarif_file: results.sarif
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.5.1 (July 15, 2024)

SECURITY:

* Upgrade envoy version to 1.29.7 to address [CVE-2024-39305](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-39305) [[GH-578](https://github.com/hashicorp/consul-dataplane/pull/578)]
* Upgrade go version to address [CVE-2024-24791](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-24791) [[GH-573](https://github.com/hashicorp/consul-dataplane/pull/573)]

## 1.5.0 (June 12, 2024)

IMPROVEMENTS:
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ docker-run: docker ## run the image of $(TAG)

.PHONY: dev-docker
dev-docker: docker ## build docker image and tag the image to local
echo '$(ARCH)'
docker tag '$(PRODUCT_NAME):$(VERSION)' '$(PRODUCT_NAME):local'

##@ Testing
Expand Down
3 changes: 0 additions & 3 deletions cmd/consul-dataplane/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type FlagOpts struct {
}

type DataplaneConfigFlags struct {
Mode *string `json:"mode,omitempty"`
Consul ConsulFlags `json:"consul,omitempty"`
Service ServiceFlags `json:"service,omitempty"`
Proxy ProxyFlags `json:"proxy,omitempty"`
Expand Down Expand Up @@ -210,7 +209,6 @@ func (f *FlagOpts) buildConfigFromFile() (DataplaneConfigFlags, error) {
func buildDefaultConsulDPFlags() (DataplaneConfigFlags, error) {
data := `
{
"mode": "sidecar",
"consul": {
"grpcPort": 8502,
"serverWatchDisabled": false,
Expand Down Expand Up @@ -318,7 +316,6 @@ func constructRuntimeConfig(cfg DataplaneConfigFlags, extraArgs []string) (*cons
InsecureSkipVerify: boolVal(cfg.Consul.TLS.InsecureSkipVerify),
},
},
Mode: consuldp.ModeType(stringVal(cfg.Mode)),
Proxy: &proxyCfg,
Logging: &consuldp.LoggingConfig{
Name: DefaultLogName,
Expand Down
10 changes: 0 additions & 10 deletions cmd/consul-dataplane/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeSidecar,
Consul: &consuldp.ConsulConfig{
Addresses: stringVal(flagOpts.dataplaneConfig.Consul.Addresses),
GRPCPort: intVal(flagOpts.dataplaneConfig.Consul.GRPCPort),
Expand Down Expand Up @@ -112,7 +111,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeSidecar,
Consul: &consuldp.ConsulConfig{
Addresses: stringVal(flagOpts.dataplaneConfig.Consul.Addresses),
GRPCPort: intVal(flagOpts.dataplaneConfig.Consul.GRPCPort),
Expand Down Expand Up @@ -191,7 +189,6 @@ func TestConfigGeneration(t *testing.T) {
if err != nil {
return nil, err
}
opts.dataplaneConfig.Mode = strReference("dns-proxy")
opts.dataplaneConfig.Consul.Credentials.Login.BearerTokenPath = strReference("/consul/bearertokenpath/")
opts.dataplaneConfig.Consul.Credentials.Login.Datacenter = strReference("dc100")
opts.dataplaneConfig.Consul.Credentials.Login.Meta = map[string]string{
Expand All @@ -209,7 +206,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeDNSProxy,
Consul: &consuldp.ConsulConfig{
Addresses: stringVal(flagOpts.dataplaneConfig.Consul.Addresses),
GRPCPort: intVal(flagOpts.dataplaneConfig.Consul.GRPCPort),
Expand Down Expand Up @@ -314,7 +310,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeSidecar,
Consul: &consuldp.ConsulConfig{
Addresses: stringVal(flagOpts.dataplaneConfig.Consul.Addresses),
GRPCPort: intVal(flagOpts.dataplaneConfig.Consul.GRPCPort),
Expand Down Expand Up @@ -413,7 +408,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeSidecar,
Consul: &consuldp.ConsulConfig{
Addresses: stringVal(flagOpts.dataplaneConfig.Consul.Addresses),
GRPCPort: intVal(flagOpts.dataplaneConfig.Consul.GRPCPort),
Expand Down Expand Up @@ -527,7 +521,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeSidecar,
Consul: &consuldp.ConsulConfig{
Addresses: "consul_server.dc1",
GRPCPort: 8502,
Expand Down Expand Up @@ -634,7 +627,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeSidecar,
Consul: &consuldp.ConsulConfig{
Addresses: stringVal(flagOpts.dataplaneConfig.Consul.Addresses),
GRPCPort: intVal(flagOpts.dataplaneConfig.Consul.GRPCPort),
Expand Down Expand Up @@ -714,7 +706,6 @@ func TestConfigGeneration(t *testing.T) {
desc: "test whether CLI flag values override the file values with proxy flags",
flagOpts: func() (*FlagOpts, error) {
opts, err := generateFlagOptsWithProxyFlags()
opts.dataplaneConfig.Mode = strReference("dns-proxy")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -763,7 +754,6 @@ func TestConfigGeneration(t *testing.T) {
},
makeExpectedCfg: func(flagOpts *FlagOpts) *consuldp.Config {
return &consuldp.Config{
Mode: consuldp.ModeTypeDNSProxy,
Consul: &consuldp.ConsulConfig{
Addresses: stringVal(flagOpts.dataplaneConfig.Consul.Addresses),
GRPCPort: intVal(flagOpts.dataplaneConfig.Consul.GRPCPort),
Expand Down
24 changes: 12 additions & 12 deletions cmd/consul-dataplane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ func init() {
flagOpts = &FlagOpts{}
flags.BoolVar(&flagOpts.printVersion, "version", false, "Prints the current version of consul-dataplane.")

StringVar(flags, &flagOpts.dataplaneConfig.Mode, "mode", "DP_MODE", "dataplane mode. Value can be:\n"+
"1. sidecar - used when running as a sidecar to Consul services with xDS Server, Envoy, and DNS Server running; OR\n"+
"2. dns-proxy - used when running as a standalone application where DNS Server runs, but Envoy and xDS Server are enabled.\n")

StringVar(flags, &flagOpts.dataplaneConfig.Consul.Addresses, "addresses", "DP_CONSUL_ADDRESSES", "Consul server gRPC addresses. Value can be:\n"+
"1. A DNS name that resolves to server addresses or the DNS name of a load balancer in front of the Consul servers; OR\n"+
"2. An executable command in the format, 'exec=<executable with optional args>'. The executable\n"+
Expand Down Expand Up @@ -61,17 +57,21 @@ func init() {
"[Deprecated; use -proxy-partition instead] The Consul Enterprise partition in which the proxy service instance is registered.")

StringVar(flags, &flagOpts.dataplaneConfig.Proxy.NodeName, "proxy-node-name", "DP_PROXY_NODE_NAME",
"The name of the Consul node to which the proxy service instance is registered.")
"The name of the Consul node to which the proxy service instance is registered."+
"In Consul's V2 Catalog API, this value is ignored.")
StringVar(flags, &flagOpts.dataplaneConfig.Proxy.NodeID, "proxy-node-id", "DP_PROXY_NODE_ID",
"The ID of the Consul node to which the proxy service instance is registered.")
"The ID of the Consul node to which the proxy service instance is registered."+
"In Consul's V2 Catalog API, this value is ignored.")
StringVar(flags, &flagOpts.dataplaneConfig.Proxy.ID, "proxy-id", "DP_PROXY_ID",
"In Consul's V1 Catalog API, the proxy service instance's ID.")
"In Consul's V1 Catalog API, the proxy service instance's ID."+
"In Consul's V2 Catalog API, the workload ID associated with the proxy.")
StringVar(flags, &flagOpts.dataplaneConfig.Proxy.IDPath, "proxy-id-path", "DP_PROXY_ID_PATH",
"In Consul's V1 Catalog API, the path to a file containing the proxy service instance's ID.")
"In Consul's V1 Catalog API, the path to a file containing the proxy service instance's ID."+
"In Consul's V2 Catalog API, the path to a file containing the workload ID associated with the proxy.")
StringVar(flags, &flagOpts.dataplaneConfig.Proxy.Namespace, "proxy-namespace", "DP_PROXY_NAMESPACE",
"The Consul Enterprise namespace in which the proxy service instance is registered.")
"The Consul Enterprise namespace in which the proxy service instance (V1 API) or workload (V2 API) is registered.")
StringVar(flags, &flagOpts.dataplaneConfig.Proxy.Partition, "proxy-partition", "DP_PROXY_PARTITION",
"The Consul Enterprise partition in which the proxy service instance is registered.")
"The Consul Enterprise partition in which the proxy service instance (V1 API) or workload (V2 API) is registered.")

StringVar(flags, &flagOpts.dataplaneConfig.Consul.Credentials.Type, "credential-type", "DP_CREDENTIAL_TYPE", "The type of credentials, either static or login, used to authenticate with Consul servers.")
StringVar(flags, &flagOpts.dataplaneConfig.Consul.Credentials.Static.Token, "static-token", "DP_CREDENTIAL_STATIC_TOKEN", "The ACL token used to authenticate requests to Consul servers when -credential-type is set to static.")
Expand Down Expand Up @@ -111,8 +111,8 @@ func init() {
StringVar(flags, &flagOpts.dataplaneConfig.Consul.TLS.ServerName, "tls-server-name", "DP_TLS_SERVER_NAME", "The hostname to expect in the server certificate's subject. This is required if -addresses is not a DNS name.")
BoolVar(flags, &flagOpts.dataplaneConfig.Consul.TLS.InsecureSkipVerify, "tls-insecure-skip-verify", "DP_TLS_INSECURE_SKIP_VERIFY", "Do not verify the server's certificate. Useful for testing, but not recommended for production.")

StringVar(flags, &flagOpts.dataplaneConfig.DNSServer.BindAddr, "consul-dns-bind-addr", "DP_CONSUL_DNS_BIND_ADDR", "The address that will be bound to the consul dns listener.")
IntVar(flags, &flagOpts.dataplaneConfig.DNSServer.BindPort, "consul-dns-bind-port", "DP_CONSUL_DNS_BIND_PORT", "The port the consul dns listener will listen on. By default -1 disables the dns listener.")
StringVar(flags, &flagOpts.dataplaneConfig.DNSServer.BindAddr, "consul-dns-bind-addr", "DP_CONSUL_DNS_BIND_ADDR", "The address that will be bound to the consul dns proxy.")
IntVar(flags, &flagOpts.dataplaneConfig.DNSServer.BindPort, "consul-dns-bind-port", "DP_CONSUL_DNS_BIND_PORT", "The port the consul dns proxy will listen on. By default -1 disables the dns proxy")

// Default is false because it will generally be configured appropriately by Helm
// configuration or pod annotation.
Expand Down
15 changes: 8 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ require (
dario.cat/mergo v1.0.0
github.com/armon/go-metrics v0.4.1
github.com/hashi-derek/grpc-proxy v0.0.0-20231207191910-191266484d75
github.com/hashicorp/consul-server-connection-manager v0.1.9
github.com/hashicorp/consul-server-connection-manager v0.1.6
github.com/hashicorp/consul/proto-public v0.6.2
github.com/hashicorp/go-hclog v1.5.0
github.com/hashicorp/go-hclog v1.2.2
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-rootcerts v1.0.2
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/client_golang v1.13.0
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.8.4
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.33.0
)
Expand All @@ -24,21 +24,22 @@ require (
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-netaddrs v0.1.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.3.0 // indirect
Expand Down
Loading

0 comments on commit bc44515

Please sign in to comment.