Re: [exim] Solved: Encrypted SSL Postgres Connection

2021-09-17 Thread Pat via Exim-users
‐‐‐ Original Message ‐‐‐
On Friday, September 17, 2021 12:46 PM,  wrote:

> Pat via Exim-users exim-users@exim.org writes:
>
> > I recently asked about configuring encrypted passwordless SSL based
> > database connections to a remote PostgreSQL cluster. With help I was
> > able to do so and wanted to report my findings [...].
>
> Thanks for the nice writeup. Does using an explicit path to the
> certificate work instead of moving it into /var/spool/exim?

That is an excellent question. I was not able to use any path specifiers
at all. I did try. That was some of the quoting and parenthesis playing
that I did, but could not hit on a working solution. The only thing that
worked was moving the files to /var/spool/exim

>
> --
>
> Regards,
> Feri



-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


Re: [exim] Solved: Encrypted SSL Postgres Connection

2021-09-17 Thread Jasen Betts via Exim-users
On 2021-09-16, Pat via Exim-users  wrote:

> That failed with:
> Failed: lookup of "select generate_series(1,10) " gave DEFER: PGSQL 
> connection failed: root certificate file "root.crt" does not exist
> Either provide the file or change sslmode to disable server certificate 
> verification.
>
> I was a little stumped at that point. I was testing from
> /usr/local/etc/exim, and the certificate was indeed present. I tried a
> few different things to the DB_NAME value, such as quoting the redefined
> contents, wrapping some and then all in parenthesis, doing both, etc. but
> nothing changed the output. Then I ran /usr/local/sbin/exim -d +all -be
> '${lookup pgsql{ select generate_series(1,10) }}' which didn't really
> give me anything. However in looking over the output I noticed several
> references to /var/spool/exim, such as:
> lock name: /var/spool/exim/eximuser.lock.
>
> So I moved the two certificates and the key file to /var/spool/exim. Bingo!

This is interesting. it will be hard (impossible) to use slashes in
the database parameters, so yes, you will need to put the key file (or 
a symlink that points to it) in the spool directory.

This explains why the bug report is also asking for the option to use
URL style connection strings. that would allow slashes.

> I am assuming at this point that the DB_PW portion is noise that the
> PG cluster ignores (or at least doesn't parse) because it is set to
> an invalid value but I see no sign of it in the PG log. In fact the
> thepguser role has no password in the cluster.

Exim passes it to libpq. what libpq does with the parameters it gets
from exim is up to the postgresql developers.


-- 
  Jasen.

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


Re: [exim] Solved: Encrypted SSL Postgres Connection

2021-09-17 Thread Ferenc Wágner via Exim-users
Pat via Exim-users  writes:

> I recently asked about configuring encrypted passwordless SSL based
> database connections to a remote PostgreSQL cluster. With help I was
> able to do so and wanted to report my findings [...].

Thanks for the nice writeup.  Does using an explicit path to the
certificate work instead of moving it into /var/spool/exim?
-- 
Regards,
Feri

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/