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

BUG: Environment variables not populated when reading user list #363

Open
jaitaiwan opened this issue Mar 6, 2025 · 2 comments
Open

BUG: Environment variables not populated when reading user list #363

jaitaiwan opened this issue Mar 6, 2025 · 2 comments

Comments

@jaitaiwan
Copy link

jaitaiwan commented Mar 6, 2025

Hey folks,

I've discovered that when reading the haproxy.cfg for the dataplaneapi user list, environment variables aren't interpolated into the file. It's not clear exactly what sort of behaviour should/would be when environment variables are provided; e.g. should the dataplaneapi use the environment variables of a running haproxy or use it's own env vars to inject into the file?

Either way given the following userlist:

userlist default-haproxy-dataplane
    user "$HAPROXY_DATAPLANE_USER" insecure-password "$HAPROXY_DATAPLANE_PASS"
    user static insecure-password static

and the following environment variables set for both haproxy and dataplaneapi:

HAPROXY_DATAPLANE_USER=admin
HAPROXY_DATAPLANE_PASS=mypassword

Running this command will fail with a 401 unauthorized:
curl -u admin:mypassword http://localhost:5555/v3/info

Running this command will succeed outputting info:
curl -u static:static http://localhost:5555/v3/info

I think the minimum fix for this is clearly documenting that environment variables don't work for the dataplane userlist, with an ideal fix being changing the dataplaneapi to interpolate it's own env variables into the file (which should mean they're inherrited when run via haproxy) and have that behaviour clearly documented.

@jaitaiwan
Copy link
Author

Possible duplicate of #268 although this doesn't explicitly mention the haproxy.cfg file.

@jaitaiwan
Copy link
Author

I have a feeling this might belong in haproxytech/client-native ; depending on if it's used for parsing the haproxy.cfg or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant