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

Authenticate Nginx to Postgres with sslmode enabled #67

Open
joe-at-startupmedia opened this issue Sep 22, 2023 · 1 comment
Open

Authenticate Nginx to Postgres with sslmode enabled #67

joe-at-startupmedia opened this issue Sep 22, 2023 · 1 comment

Comments

@joe-at-startupmedia
Copy link

Is it possible to do this? An sslmode parameter doesn't exist. I was able to find some commentary below on the topic but "adding params" to the postgres_server directive as @PiotrSikora recommends doesn't seem possible.

  • use SSL certificates to authenticate Nginx to Postgres
  • verify that the Postgres instance I'm connecting to presents itself with a correct SSL certificate

You can do that by adding params to postgres_server.

Originally posted by @PiotrSikora in #10 (comment)

@joe-at-startupmedia
Copy link
Author

In fact, sslmode is explicitly hardcoded as disabled:

+ sizeof("sslmode=disable");
connstring = ngx_pnalloc(pgdt->request->pool, len);
if (connstring == NULL) {
#if defined(nginx_version) && (nginx_version >= 8017)
dd("returning NGX_ERROR");
return NGX_ERROR;
#else
goto failed;
#endif
}
/* TODO add unix sockets */
last = ngx_snprintf(connstring, len - 1,
"hostaddr=%V port=%d dbname=%V user=%V password=%V"
" sslmode=disable",

joe-at-startupmedia added a commit to joe-at-startupmedia/ngx_postgres that referenced this issue Sep 22, 2023
joe-at-startupmedia added a commit to joe-at-startupmedia/ngx_postgres that referenced this issue Sep 23, 2023
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