[Bug] gRPC API fails to resolve relative policy file path, unlike server startup behavior #761

Closed
opened 2025-12-29 02:23:31 +01:00 by adam · 0 comments
Owner

Originally created by @chuangbo on GitHub (Aug 10, 2024).

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

In headscale v0.23.0-beta1, when using relative paths to configure the policy file, the server starts normally and enables the policy, but the client command headscale policy get returns an error.

Configuration Example

Directory structure:

/etc/headscale
├── config.yaml
└── policy.json

config.yaml content:

# /etc/headscale/config.yaml
...
policy:
  mode: file
  file: policy.json
# acl_policy_path is necessary, see https://github.com/juanfont/headscale/issues/2024
acl_policy_path: policy.json
...

Observed Behavior

  1. The server starts normally and enables the configured policy.
  2. The client command headscale policy get returns an error:
2024-08-10T01:23:08+08:00 FTL Failed to get the policy error="rpc error: code = Unknown desc = open policy.json: no such file or directory"

Expected Behavior

  • The client command headscale policy get should successfully retrieve the policy without errors when the policy file is specified using a relative path.
  • The behavior should be consistent with the server's serve behavior, both supporting relative paths.

Steps To Reproduce

  1. Use headscale version v0.23.0-beta1.
  2. Configure config.yaml and policy.json as shown in the example above.
  3. Start the headscale server headscale serve.
  4. Run the client command headscale policy get.

Environment

- OS: Ubuntu 24.04
- Headscale version: v0.23.0-beta1
- Tailscale version: 1.70.0

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

No response

Originally created by @chuangbo on GitHub (Aug 10, 2024). ### Is this a support request? - [X] This is not a support request ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current Behavior In headscale v0.23.0-beta1, when using relative paths to configure the policy file, the server starts normally and enables the policy, but the client command `headscale policy get` returns an error. ### Configuration Example Directory structure: ``` /etc/headscale ├── config.yaml └── policy.json ``` config.yaml content: ```yaml # /etc/headscale/config.yaml ... policy: mode: file file: policy.json # acl_policy_path is necessary, see https://github.com/juanfont/headscale/issues/2024 acl_policy_path: policy.json ... ``` ### Observed Behavior 1. The server starts normally and enables the configured policy. 2. The client command `headscale policy get` returns an error: ``` 2024-08-10T01:23:08+08:00 FTL Failed to get the policy error="rpc error: code = Unknown desc = open policy.json: no such file or directory" ``` ### Expected Behavior * The client command `headscale policy get` should successfully retrieve the policy without errors when the policy file is specified using a relative path. * The behavior should be consistent with the server's serve behavior, both supporting relative paths. ### Steps To Reproduce 1. Use headscale version v0.23.0-beta1. 2. Configure config.yaml and policy.json as shown in the example above. 3. Start the headscale server `headscale serve`. 4. Run the client command `headscale policy get`. ### Environment ```markdown - OS: Ubuntu 24.04 - Headscale version: v0.23.0-beta1 - Tailscale version: 1.70.0 ``` ### Runtime environment - [ ] Headscale is behind a (reverse) proxy - [ ] Headscale runs in a container ### Anything else? _No response_
adam added the bug label 2025-12-29 02:23:31 +01:00
adam closed this issue 2025-12-29 02:23:31 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#761