Jira (PDB-4764) Provide a way to configure Postgres authentication via certs

21 views
Skip to first unread message

Austin Blatt (Jira)

unread,
Jun 2, 2020, 1:54:04 PM6/2/20
to puppe...@googlegroups.com
Austin Blatt created an issue
 
PuppetDB / New Feature PDB-4764
Provide a way to configure Postgres authentication via certs
Issue Type: New Feature New Feature
Assignee: Unassigned
Created: 2020/06/02 10:53 AM
Priority: Normal Normal
Reporter: Austin Blatt

Configuring PostgreSQL authentication via a password in a plaintext is less than ideal, if module is managing postgres for puppetdb, we should allow the users to configure SSL and database access authentication via the puppet CA

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Austin Blatt (Jira)

unread,
Feb 19, 2021, 12:38:04 PM2/19/21
to puppe...@googlegroups.com
Austin Blatt commented on New Feature PDB-4764
 
Re: Provide a way to configure Postgres authentication via certs

The open source module can only configure puppetdb's postgres access via a password.

In PE the default database configuration of PuppetDB is done without a password. This is advantageous because our config files store the password in plain text, which many customers don't want to do. The connection involves using the Puppet agent certs to configure SSL and giving the PuppetDB certname access to the puppetdb database in the pg_hba.conf. It would be ideal to give our open source users an easy way to improve their security, for now this should be opt-in as we shouldn't change this in a y release, but once it's circulated in the community we should do a major release of the module and make this connection strategy the default.

When I want to deploy a quick open source monolithic primary server I apply a manifest like this to configure an SSL connection with the database. I think this still uses password authentication to access the database, but shows how to configure an agent cert based SSL connection to postgres.

  class { 'puppetdb::globals':
    version => $puppetdb_version,
  }
 
  class { 'puppetdb':
    database_host           => $trusted['certname'],
    database_listen_address => '*',
    jdbc_ssl_properties     => '?ssl=true&sslrootcert=/etc/puppetlabs/puppetdb/ssl/ca.pem',
  }
 
  class { 'puppetdb::master::config':
    manage_report_processor => true,
    enable_reports          => true,
  }
 
  file {'postgres private key':
    ensure  => present,
    path    => "${postgresql::params::datadir}/server.key",
    source  => "file:///etc/puppetlabs/puppet/ssl/private_keys/${trusted['certname']}.pem",
    owner   => 'postgres',
    mode    => '0600',
    require => Package['postgresql-server'],
  }
 
  concat {'postgres cert bundle':
    ensure  => present,
    path    => "${postgresql::params::datadir}/server.crt",
    owner   => 'postgres',
    require => Package['postgresql-server'],
  }
 
  concat::fragment {'agent cert':
    target => 'postgres cert bundle',
    source => "file:///etc/puppetlabs/puppet/ssl/certs/${trusted['certname']}.pem",
    order  => '1',
  }
 
  concat::fragment {'CA bundle':
    target => 'postgres cert bundle',
    source => 'file:///etc/puppetlabs/puppet/ssl/certs/ca.pem',
    order  => '2',
  }
 
  postgresql::server::config_entry {'ssl_key_file':
    ensure  => present,
    value   => "${postgresql::params::datadir}/server.key",
    require => [File['postgres private key'], Concat['postgres cert bundle']],
  }
 
  postgresql::server::config_entry {'ssl_cert_file':
    ensure  => present,
    value   => "${postgresql::params::datadir}/server.crt",
    require => [File['postgres private key'], Concat['postgres cert bundle']],
  }
 
  postgresql::server::config_entry {'ssl':
    ensure  => present,
    value   => 'on',
    require => [File['postgres private key'], Concat['postgres cert bundle']],
  }

And I believe something similar could be used in our module.

Austin Blatt (Jira)

unread,
Feb 19, 2021, 12:39:02 PM2/19/21
to puppe...@googlegroups.com
Austin Blatt updated an issue
 
Change By: Austin Blatt
Acceptance Criteria: - Provide an option that, if the PuppetDB module is managing Postgres, configures PostgreSQL to authenticate both SSL and database authentication via the Puppet Agent certificates.
  - configure cert-based SSL connection
  - configure cert-based authentication to the puppetdb database in {{pg_hba.conf}}

Austin Blatt (Jira)

unread,
Feb 19, 2021, 12:39:03 PM2/19/21
to puppe...@googlegroups.com
Austin Blatt updated an issue
Change By: Austin Blatt
Acceptance Criteria: - * Provide an option that, if the PuppetDB module is managing Postgres, configures PostgreSQL to authenticate both SSL and database authentication via the Puppet Agent certificates.
  -     * configure cert-based SSL connection
  -     * configure cert-based authentication to the puppetdb database in {{pg_hba.conf}}

Austin Blatt (Jira)

unread,
Feb 19, 2021, 12:40:02 PM2/19/21
to puppe...@googlegroups.com
Austin Blatt updated an issue
Change By: Austin Blatt
Acceptance Criteria:
* Provide an option that, if the PuppetDB module is managing Postgres, configures PostgreSQL to authenticate both SSL and database authentication via the Puppet Agent certificates.
    *
#
configure cert-based SSL connection
    * # configure cert-based authentication to the puppetdb database in {{pg_hba.conf}}

Austin Blatt (Jira)

unread,
Feb 19, 2021, 12:40:03 PM2/19/21
to puppe...@googlegroups.com
Austin Blatt updated an issue
Change By: Austin Blatt
Acceptance Criteria:
Provide an option that, if the PuppetDB module is managing Postgres, configures PostgreSQL to authenticate both SSL and database authentication via the Puppet Agent certificates.

# configure cert-based SSL connection
# configure cert-based authentication to the puppetdb database in {{pg_hba.conf}}

Zachary Kent (Jira)

unread,
Feb 22, 2021, 5:31:04 PM2/22/21
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Feb 23, 2021, 8:08:03 AM2/23/21
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Feb 24, 2021, 9:52:01 AM2/24/21
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Feb 24, 2021, 9:52:02 AM2/24/21
to puppe...@googlegroups.com

Andrei Filipovici (Jira)

unread,
Feb 25, 2021, 4:44:03 AM2/25/21
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Mar 10, 2021, 9:14:03 AM3/10/21
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ghost-10.03.2021 , ready for triage 3

Andrei Filipovici (Jira)

unread,
Mar 24, 2021, 6:35:03 AM3/24/21
to puppe...@googlegroups.com
Andrei Filipovici commented on New Feature PDB-4764
 
Re: Provide a way to configure Postgres authentication via certs

In this ticket and PDB-5050, we accomplished setting the SSL connection between PostgreSQL and PuppetDB. However, we in the database.ini config we still need to have specified the user password. Removing it, results in errors regarding the password for the migrator user in PuppetDB.
Also we need to document what the user needs to do, to use SSL communication.

Claudia Petty (Jira)

unread,
Jun 21, 2023, 10:55:02 AM6/21/23
to puppe...@googlegroups.com
Claudia Petty updated an issue
 
Change By: Claudia Petty
Labels: new-feature tsr-pdb-backlog
This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages