Hi All,
Although I have been working with consul for a while now, I am new to consul ACL concepts and deployments.
Recently, I encountered a strange behavior while using the “consul acl token create” command with the “-secret=” option via CLI. After executing this command, I noticed that the external commands (like curl) as well as UI no longer prompt for authentication, and anyone browsing to the consul URL http://consul-ip:8500 OR doing any HTTP request via curl can directly access key/values, nodes, and services.
Additionally, using the “curl http://consul-ip:8500/v1/kv/(path-to-key-value)” command allows users to easily fetch any key-value without specifying any token.
This behavior seems counterintuitive and defeats the purpose of creating and enabling ACLs in the first place. However, I could be wrong and would appreciate any corrections.
I have tested this issue on two versions of Consul, v1.10.1 and the latest version as of today, and the behavior is the same on both.
To reproduce this issue, I followed these steps:
- Deployed a docker-based Consul cluster on 3 nodes without enabling ACL.
- Enabled ACL support in Consul using the following configuration:
acl = {
enabled = true
default_policy = “allow”
enable_token_persistence = true
tokens {
default = “my-custom-token”
}
}
-
Restarted all server containers.
-
In both the CLI and UI, Consul now prompts for an ACL token to log in.
-
Ran
consul acl bootstrap
and copied the bootstrap secretID. -
Logged in to the UI or CLI using the secretID copied in step 5.
-
Created a new ACL token using the
consul acl token create
command with the “-secret” flag, as follows:
consul acl token create \
-description “cluster-wide access” \
-policy-id 00000000-0000-0000-0000-000000000001 \
-secret=(my-custom-token) \
-token=(bootstrap SecretID)
- After executing step 7, the new token is successfully created with a secretID assigned with the provided secret, as expected.
- However, after executing step 7, if I go back to the UI or CLI (even after logging out of the Consul UI), I no longer need to log in with any token. Any curl command can easily be successful without passing any token. I can fetch key/value either via UI or curl without any tokens.
This behavior suggests that the “-secret” flag breaks all authentication/ACL logic.
In contrast,
- if I don’t pass the “-secret” flag in the
consul acl token create
command in step#7, Consul creates a token with a new secretID assigned by Consul. The UI and outside CLI commands like curl still require an ACL token (either secretIDs), which is the expected behavior. - Similarly, if I try to create a token from the UI, it also creates a Consul-generated secretID for a new token, and the system still expects me to log in with either secretIDs, or the curl command fails if I don’t provide any ACL tokens. Only step 7 seems to be causing this issue.
I have searched for any issues related to the “-secret” flag on Consul GitHub and community but couldn’t find any. Have any of you faced this issue? Can someone please help me?