Skip to content

Commit

Permalink
Adjust README table formatting and update agent socket in config files
Browse files Browse the repository at this point in the history
Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
  • Loading branch information
maxlambrecht committed Nov 13, 2023
1 parent d45a616 commit 7c761f0
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ If `-config` is not specified, the default value `helper.conf` is assumed.
## Configuration
The configuration file is an [HCL](https://github.com/hashicorp/hcl) formatted file that defines the following configurations:

|Configuration | Description | Example Value |
|--------------------------|------------------------------------------------------------------------------------------------| ------------- |
|`agent_address` | Socket address of SPIRE Agent. | `"/tmp/agent.sock"` |
|`cmd` | The path to the process to launch. | `"ghostunnel"` |
|`cmd_args` | The arguments of the process to launch. | `"server --listen localhost:8002 --target localhost:8001--keystore certs/svid_key.pem --cacert certs/svid_bundle.pem --allow-uri-san spiffe://example.org/Database"` |
|`cert_dir` | Directory name to store the fetched certificates. This directory must be created previously. | `"certs"` |
|`add_intermediates_to_bundle`| Add intermediate certificates into Bundle file instead of SVID file. | `true` |
|`renew_signal` | The signal that the process to be launched expects to reload the certificates. It is not supported on Windows. | `"SIGUSR1"` |
|`svid_file_name` | File name to be used to store the X.509 SVID public certificate in PEM format. | `"svid.pem"` |
|`svid_key_file_name` | File name to be used to store the X.509 SVID private key and public certificate in PEM format. | `"svid_key.pem"` |
|`svid_bundle_file_name` | File name to be used to store the X.509 SVID Bundle in PEM format. | `"svid_bundle.pem"` |
| Configuration | Description | Example Value |
|-------------------------------|----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `agent_address` | Socket address of SPIRE Agent. | `"/tmp/spire-agent/public/api.sock"` |
| `cmd` | The path to the process to launch. | `"ghostunnel"` |
| `cmd_args` | The arguments of the process to launch. | `"server --listen localhost:8002 --target localhost:8001--keystore certs/svid_key.pem --cacert certs/svid_bundle.pem --allow-uri-san spiffe://example.org/Database"` |
| `cert_dir` | Directory name to store the fetched certificates. This directory must be created previously. | `"certs"` |
| `add_intermediates_to_bundle` | Add intermediate certificates into Bundle file instead of SVID file. | `true` |
| `renew_signal` | The signal that the process to be launched expects to reload the certificates. It is not supported on Windows. | `"SIGUSR1"` |
| `svid_file_name` | File name to be used to store the X.509 SVID public certificate in PEM format. | `"svid.pem"` |
| `svid_key_file_name` | File name to be used to store the X.509 SVID private key and public certificate in PEM format. | `"svid_key.pem"` |
| `svid_bundle_file_name` | File name to be used to store the X.509 SVID Bundle in PEM format. | `"svid_bundle.pem"` |

### Configuration example
```
agent_address = "/tmp/agent.sock"
agent_address = "/tmp/spire-agent/public/api.sock"
cmd = "ghostunnel"
cmd_args = "server --listen localhost:8002 --target localhost:8001 --keystore certs/svid_key.pem --cacert certs/svid_bundle.pem --allow-uri-san spiffe://example.org/Database"
cert_dir = "certs"
Expand Down
2 changes: 1 addition & 1 deletion examples/mysql/helper.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPIRE agent unix socket path
agent_address = "/tmp/agent.sock"
agent_address = "/tmp/spire-agent/public/api.sock"

# mysql binary path
cmd = "/usr/bin/mysql"
Expand Down
2 changes: 1 addition & 1 deletion examples/mysql/spire-agent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ agent {
log_level = "DEBUG"
server_address = "127.0.0.1"
server_port = "8081"
socket_path ="/tmp/agent.sock"
socket_path ="/tmp/spire-agent/public/api.sock"
trust_bundle_path = "./conf/agent/dummy_root_ca.crt"
trust_domain = "example.org"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/postgresql/helper.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#

# SPIRE agent unix socket path
agent_address = "/tmp/agent.sock"
agent_address = "/tmp/spire-agent/public/api.sock"

# psql binary path
cmd = "/usr/bin/psql"
Expand Down
2 changes: 1 addition & 1 deletion examples/postgresql/spire-agent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ agent {
log_level = "DEBUG"
server_address = "127.0.0.1"
server_port = "8081"
socket_path ="/tmp/agent.sock"
socket_path ="/tmp/spire-agent/public/api.sock"
trust_bundle_path = "./conf/agent/dummy_root_ca.crt"
trust_domain = "example.org"
}
Expand Down
2 changes: 1 addition & 1 deletion helper.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
agent_address = "/tmp/agent.sock"
agent_address = "/tmp/spire-agent/public/api.sock"
cmd = ""
cmd_args = ""
cert_dir = "certs"
Expand Down
2 changes: 1 addition & 1 deletion helper_envoy.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
agent_address = "/tmp/agent.sock"
agent_address = "/tmp/spire-agent/public/api.sock"
cmd = "hot-restarter.py"
cmd_args = "start_envoy.sh"
cert_dir = "certs"
Expand Down
2 changes: 1 addition & 1 deletion helper_ghostunnel.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
agent_address = "/tmp/agent.sock"
agent_address = "/tmp/spire-agent/public/api.sock"
cmd = "ghostunnel"
cmd_args = "server --listen localhost:8002 --target localhost:8001 --keystore certs/svid_key.pem --cacert certs/svid_bundle.pem --allow-uri-san spiffe://example.org/Database"
cert_dir = "certs"
Expand Down
2 changes: 1 addition & 1 deletion pkg/sidecar/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestParseConfig(t *testing.T) {

assert.NoError(t, err)

expectedAgentAddress := "/tmp/agent.sock"
expectedAgentAddress := "/tmp/spire-agent/public/api.sock"
expectedCmd := "hot-restarter.py"
expectedCmdArgs := "start_envoy.sh"
expectedCertDir := "certs"
Expand Down
6 changes: 3 additions & 3 deletions pkg/sidecar/sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ func TestDefaultAgentAddress(t *testing.T) {
assert.Equal(t, spiffeSidecar.config.AgentAddress, "/tmp/spire-agent/public/api.sock")
}
func TestEnvAgentAddress(t *testing.T) {
os.Setenv("SPIRE_AGENT_ADDRESS", "/tmp/agent.sock")
os.Setenv("SPIRE_AGENT_ADDRESS", "/tmp/spire-agent/public/api.sock")
log, _ := test.NewNullLogger()
spiffeSidecar, err := New("../../test/sidecar/config/helper.conf", log)
require.NoError(t, err)
assert.Equal(t, spiffeSidecar.config.AgentAddress, "/tmp/agent.sock")
assert.Equal(t, spiffeSidecar.config.AgentAddress, "/tmp/spire-agent/public/api.sock")
}

func TestAgentAddress(t *testing.T) {
// This test is used to verify that we get the agent_address of the .conf file instead of the ENV value, if we have both
os.Setenv("SPIRE_AGENT_ADDRESS", "/tmp/agent.sock")
os.Setenv("SPIRE_AGENT_ADDRESS", "/tmp/spire-agent/public/api.sock")
log, _ := test.NewNullLogger()
spiffeSidecar, err := New("../../test/sidecar/configWithAddress/helper.conf", log)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/config/helper.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
agent_address = "/tmp/agent.sock"
agent_address = "/tmp/spire-agent/public/api.sock"
cmd = "hot-restarter.py"
cmd_args = "start_envoy.sh"
cert_dir = "certs"
Expand Down

0 comments on commit 7c761f0

Please sign in to comment.