How to make Mojo::Pg or DBD::Pg verify postgresql server's SSL certs
2026-03-21
This is undocumented in the sslmode section of DBD::Pg.
Turns out you can use all the possible values of libpq's sslmode option, in DBD::Pg.
So use this DSN:
dbi:Pg:dbname=$dbname;host=$host;sslmode=verify-full;sslrootcert=system;user=$dbuser;password=$dbpass
...in:
my $pg = Mojo::Pg->new->dsn($dsn);
...or:
my $dbh = DBI->connect($dsn);
Comments
Write your comment: