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

[postgresql] using peer auth through unix socket #2361

Open
zerc opened this issue Mar 17, 2016 · 1 comment
Open

[postgresql] using peer auth through unix socket #2361

zerc opened this issue Mar 17, 2016 · 1 comment
Labels

Comments

@zerc
Copy link

zerc commented Mar 17, 2016

Hi, everyone!

It seems like currently this feature doesn't work or I can't understand how I can use it. Look:

if host == 'localhost' and password == '':
    # Use ident method
    connection = pg.connect("user=%s dbname=%s" % (user, dbname))

So this string goes into the user kwarg:

def connect(
        user=None, host='localhost', unix_sock=None, port=5432, database=None,
        password=None, ssl=False, timeout=None, **kwargs):

Also according to pg8000 we need to provide a path to unix_sock instead of host:

:keyword unix_sock:
    The path to the UNIX socket to access the database through, for
    example, ``'/tmp/.s.PGSQL.5432'``.  One of either ``host`` or
    ``unix_sock`` must be provided.

And I can't find a way to do this through the agent.

So anyone knows how I can make peer connection with the agent or is it really not working now?

Thanks

@DylanFrese
Copy link
Contributor

I would also like to be able to use a UNIX Socket to monitor a postgres instance, it would simplify authentication as I wouldn't have to put credentials in the DataDog configuration file (the DataDog configuration is managed by SaltStack, but the Postgres configuration is deployed from another project and differs between server environments). Ideally, postgres.yaml would be able to take a unix_sock field in place of host/port.

If nobody wants to pick this up, I'll try creating a PR in the next few days, I just imagine it'll take me longer than someone who's more familiar with the project/Python.

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

No branches or pull requests

3 participants