Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replication token needs acl write on all ns's #370

Merged
merged 1 commit into from
Oct 29, 2020
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## UNRELEASED

BUG FIXES:
* Federation: ensure replication ACL token can replicate policies and tokens in Consul namespaces other than `default` (Consul-enterprise only). [[GH-364](https://github.com/hashicorp/consul-k8s/issues/364)]

## 0.19.0 (October 12, 2020)

FEATURES:
Expand Down
2 changes: 1 addition & 1 deletion subcommand/server-acl-init/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ func (c *Command) aclReplicationRules() (string, error) {
// datacenters during federation since in order to start ACL replication,
// we need a token with both replication and agent permissions.
aclReplicationRulesTpl := `
acl = "write"
operator = "write"
agent_prefix "" {
policy = "read"
Expand All @@ -233,6 +232,7 @@ node_prefix "" {
{{- if .EnableNamespaces }}
namespace_prefix "" {
{{- end }}
acl = "write"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key is here. Moving this inside the namespace_prefix "" block.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does namespace_prefix "" mean the token created from these rules has that permission for any namespace?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes exactly. If it was namespace "blah" then it would be only for blah and if it was namespace_prefix "blah-" it would be for blah-.*

service_prefix "" {
policy = "read"
intentions = "read"
Expand Down
8 changes: 4 additions & 4 deletions subcommand/server-acl-init/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,14 @@ func TestReplicationTokenRules(t *testing.T) {
{
"Namespaces are disabled",
false,
`acl = "write"
operator = "write"
`operator = "write"
agent_prefix "" {
policy = "read"
}
node_prefix "" {
policy = "write"
}
acl = "write"
service_prefix "" {
policy = "read"
intentions = "read"
Expand All @@ -553,15 +553,15 @@ node_prefix "" {
{
"Namespaces are enabled",
true,
`acl = "write"
operator = "write"
`operator = "write"
agent_prefix "" {
policy = "read"
}
node_prefix "" {
policy = "write"
}
namespace_prefix "" {
acl = "write"
service_prefix "" {
policy = "read"
intentions = "read"
Expand Down